use of com.emc.storageos.db.client.model.VirtualNAS in project coprhd-controller by CoprHD.
the class IsilonCommunicationInterface method computeStaticLoadMetrics.
private void computeStaticLoadMetrics(final URI storageSystemId) throws BaseCollectionException {
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemId);
_log.info("started computeStaticLoadMetrics for storagesystem: {}", storageSystem.getLabel());
StringMap dbMetrics = null;
String accessZoneId = null;
try {
IsilonApi isilonApi = getIsilonDevice(storageSystem);
VirtualNAS virtualNAS = null;
// //step-1 process the dbmetrics for user define access zones
List<IsilonAccessZone> accessZoneList = isilonApi.getAccessZones(null);
for (IsilonAccessZone isAccessZone : accessZoneList) {
accessZoneId = isAccessZone.getZone_id().toString();
// get the total fs count and capacity for AZ
if (isAccessZone.isSystem() != true) {
virtualNAS = findvNasByNativeId(storageSystem, accessZoneId);
if (virtualNAS != null) {
_log.info("Process db metrics for access zone : {}", isAccessZone.getName());
dbMetrics = virtualNAS.getMetrics();
if (dbMetrics == null) {
dbMetrics = new StringMap();
}
// process db metrics
populateDbMetricsAz(isAccessZone, isilonApi, dbMetrics);
// set AZ dbMetrics in db
virtualNAS.setMetrics(dbMetrics);
_dbClient.updateObject(virtualNAS);
}
} else {
PhysicalNAS physicalNAS = findPhysicalNasByNativeId(storageSystem, accessZoneId);
if (physicalNAS == null) {
_log.error(String.format("computeStaticLoadMetrics is failed for Storagesystemid: %s", storageSystemId));
return;
}
dbMetrics = physicalNAS.getMetrics();
if (dbMetrics == null) {
dbMetrics = new StringMap();
}
/* process the system accesszone dbmetrics */
_log.info("process db metrics for access zone : {}", isAccessZone.getName());
populateDbMetricsAz(isAccessZone, isilonApi, dbMetrics);
physicalNAS.setMetrics(dbMetrics);
_dbClient.updateObject(physicalNAS);
}
}
} catch (Exception e) {
_log.error("CollectStatisticsInformation failed. Storage system: " + storageSystemId, e);
}
}
use of com.emc.storageos.db.client.model.VirtualNAS in project coprhd-controller by CoprHD.
the class IsilonCommunicationInterface method discoverAccessZones.
/**
* discover the access zone and add to vipr db
*
* @param storageSystem
*/
private void discoverAccessZones(StorageSystem storageSystem) {
URI storageSystemId = storageSystem.getId();
VirtualNAS virtualNAS = null;
PhysicalNAS physicalNAS = null;
List<VirtualNAS> newvNASList = new ArrayList<VirtualNAS>();
List<VirtualNAS> existingvNASList = new ArrayList<VirtualNAS>();
List<PhysicalNAS> newPhysicalNASList = new ArrayList<PhysicalNAS>();
List<PhysicalNAS> existingPhysicalNASList = new ArrayList<PhysicalNAS>();
List<VirtualNAS> discoveredVNASList = new ArrayList<VirtualNAS>();
// Discover storage ports
try {
_log.info("discoverAccessZones for storage system {} - start", storageSystemId);
IsilonApi isilonApi = getIsilonDevice(storageSystem);
// Make restapi call to get access zones
List<IsilonAccessZone> accessZoneList = isilonApi.getAccessZones(null);
if (accessZoneList == null || accessZoneList.isEmpty()) {
// No access zones defined. Throw an exception and fail the discovery
IsilonCollectionException ice = new IsilonCollectionException("discoverAccessZones failed. No Zones defined");
throw ice;
}
// Find the smart connect zones
List<IsilonNetworkPool> isilonNetworkPoolsSysAZ = new ArrayList<>();
// get the system access zone and use it later
List<IsilonNetworkPool> isilonNetworkPoolList = discoverNetworkPools(storageSystem);
for (IsilonNetworkPool isilonNetworkPool : isilonNetworkPoolList) {
if (isilonNetworkPool.getAccess_zone().equalsIgnoreCase(SYSTEM_ACCESS_ZONE_NAME)) {
isilonNetworkPoolsSysAZ.add(isilonNetworkPool);
}
}
// set the protocol based storagesystem version
// by default all version support CIFS and version above 7.2 NFS also
StringSet protocols = new StringSet();
protocols.add(CIFS);
boolean isNfsV4Enabled = isilonApi.nfsv4Enabled(storageSystem.getFirmwareVersion());
if (VersionChecker.verifyVersionDetails(ONEFS_V7_2, storageSystem.getFirmwareVersion()) >= 0) {
protocols.add(NFS);
if (isNfsV4Enabled) {
protocols.add(NFSv4);
}
}
List<IsilonNetworkPool> isilonNetworkPools = null;
// process the access zones list
for (IsilonAccessZone isilonAccessZone : accessZoneList) {
// add protocol to NAS servers
// is it a System access zone?
isilonNetworkPools = null;
if (isilonAccessZone.isSystem() == false) {
_log.info("Process the user defined access zone {} ", isilonAccessZone.toString());
isilonNetworkPools = new ArrayList<IsilonNetworkPool>();
// get the smart connect zone information
for (IsilonNetworkPool eachNetworkPool : isilonNetworkPoolList) {
if (eachNetworkPool.getAccess_zone().equalsIgnoreCase(isilonAccessZone.getName())) {
isilonNetworkPools.add(eachNetworkPool);
}
}
// find virtualNAS in db
virtualNAS = findvNasByNativeId(storageSystem, isilonAccessZone.getZone_id().toString());
if (virtualNAS == null) {
if (isilonNetworkPools != null && !isilonNetworkPools.isEmpty()) {
virtualNAS = createVirtualNas(storageSystem, isilonAccessZone);
newvNASList.add(virtualNAS);
}
} else {
copyUpdatedPropertiesInVNAS(storageSystem, isilonAccessZone, virtualNAS);
existingvNASList.add(virtualNAS);
}
// Set authentication providers
setCifsServerMapForNASServer(isilonAccessZone, virtualNAS);
// set protocol support
if (virtualNAS != null) {
virtualNAS.setProtocols(protocols);
}
// set the smart connect
setStoragePortsForNASServer(isilonNetworkPools, storageSystem, virtualNAS);
} else {
_log.info("Process the System access zone {} ", isilonAccessZone.toString());
// set protocols
StringSet protocolSet = new StringSet();
protocolSet.add(CIFS);
protocolSet.add(NFS);
if (isNfsV4Enabled) {
protocolSet.add(NFSv4);
}
physicalNAS = findPhysicalNasByNativeId(storageSystem, isilonAccessZone.getZone_id().toString());
if (physicalNAS == null) {
physicalNAS = createPhysicalNas(storageSystem, isilonAccessZone);
physicalNAS.setProtocols(protocolSet);
// add system access zone
newPhysicalNASList.add(physicalNAS);
} else {
setMaxDbMetricsAz(storageSystem, physicalNAS.getMetrics());
existingPhysicalNASList.add(physicalNAS);
}
// Set authentication providers
setCifsServerMapForNASServer(isilonAccessZone, physicalNAS);
// set the smart connect zone
setStoragePortsForNASServer(isilonNetworkPoolsSysAZ, storageSystem, physicalNAS);
}
}
// Persist the vNAS servers and
if (newvNASList != null && !newvNASList.isEmpty()) {
// add the parent system access zone to user defined access zones
if (physicalNAS != null) {
for (VirtualNAS vNas : newvNASList) {
// set the parent uri or system access zone uri to vNAS
vNas.setParentNasUri(physicalNAS.getId());
}
}
_log.info("New Virtual NAS servers size {}", newvNASList.size());
_dbClient.createObject(newvNASList);
discoveredVNASList.addAll(newvNASList);
}
if (existingvNASList != null && !existingvNASList.isEmpty()) {
_log.info("Modified Virtual NAS servers size {}", existingvNASList.size());
_dbClient.updateObject(existingvNASList);
discoveredVNASList.addAll(existingvNASList);
}
// Persist the NAS servers!!!
if (existingPhysicalNASList != null && !existingPhysicalNASList.isEmpty()) {
_log.info("Modified Physical NAS servers size {}", existingPhysicalNASList.size());
_dbClient.updateObject(existingPhysicalNASList);
}
if (newPhysicalNASList != null && !newPhysicalNASList.isEmpty()) {
_log.info("New Physical NAS servers size {}", newPhysicalNASList.size());
_dbClient.createObject(newPhysicalNASList);
}
DiscoveryUtils.checkVirtualNasNotVisible(discoveredVNASList, _dbClient, storageSystemId);
} catch (Exception e) {
_log.error("discoverAccessZones failed. Storage system: {}", storageSystemId, e);
IsilonCollectionException ice = new IsilonCollectionException("discoverAccessZones failed. Storage system: " + storageSystemId);
throw ice;
}
}
use of com.emc.storageos.db.client.model.VirtualNAS in project coprhd-controller by CoprHD.
the class IsilonCommunicationInterface method createVirtualNas.
/**
* Create Virtual NAS for the specified Isilon cluster storage array
*
* @param system
* @param isiAccessZone
* @return Virtual NAS Server
*/
private VirtualNAS createVirtualNas(final StorageSystem system, final IsilonAccessZone isiAccessZone) {
VirtualNAS vNas = new VirtualNAS();
vNas.setStorageDeviceURI(system.getId());
// set name
vNas.setNasName(isiAccessZone.getName());
vNas.setNativeId(isiAccessZone.getId());
// set base directory path
vNas.setBaseDirPath(isiAccessZone.getPath());
vNas.setNasState(VirtualNasState.LOADED.toString());
vNas.setId(URIUtil.createId(VirtualNAS.class));
// set native "Guid"
String nasNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, isiAccessZone.getZone_id().toString(), NativeGUIDGenerator.VIRTUAL_NAS);
vNas.setNativeGuid(nasNativeGuid);
StringMap dbMetrics = vNas.getMetrics();
_log.info("new Virtual NAS created with guid {} ", vNas.getNativeGuid());
if (dbMetrics == null) {
dbMetrics = new StringMap();
}
// set the Limitation Metrics keys
setMaxDbMetricsAz(system, dbMetrics);
vNas.setMetrics(dbMetrics);
return vNas;
}
use of com.emc.storageos.db.client.model.VirtualNAS in project coprhd-controller by CoprHD.
the class FileStorageScheduler method getVNASServersInProject.
/**
* Get list of VNAS servers assigned to a project
*
* @param project
* @param varrayUri
* @param vpool
* @return vNASList
*/
private List<VirtualNAS> getVNASServersInProject(Project project, URI varrayUri, VirtualPool vpool, List<VirtualNAS> invalidNasServers) {
List<VirtualNAS> vNASList = null;
_log.debug("Get VNAS servers assigned to project {}", project);
StringSet vNASServerIdSet = project.getAssignedVNasServers();
if (vNASServerIdSet != null && !vNASServerIdSet.isEmpty()) {
_log.info("Number of vNAS servers assigned to this project: {}", vNASServerIdSet.size());
List<URI> vNASURIList = new ArrayList<URI>();
for (String vNASId : vNASServerIdSet) {
vNASURIList.add(URI.create(vNASId));
}
vNASList = _dbClient.queryObject(VirtualNAS.class, vNASURIList);
for (Iterator<VirtualNAS> iterator = vNASList.iterator(); iterator.hasNext(); ) {
VirtualNAS virtualNAS = iterator.next();
// Remove inactive, incompatible, invisible vNAS
_log.info("Checking vNAS - {} : {}", virtualNAS.getNasName(), virtualNAS.getId());
if (!isVNASActive(virtualNAS)) {
_log.info("Removing vNAS {} as it is inactive", virtualNAS.getNasName());
iterator.remove();
invalidNasServers.add(virtualNAS);
} else if (!virtualNAS.getAssignedVirtualArrays().contains(varrayUri.toString())) {
_log.info("Removing vNAS {} as it is not part of varray: {}", virtualNAS.getNasName(), varrayUri.toString());
iterator.remove();
invalidNasServers.add(virtualNAS);
} else if (MetricsKeys.getBoolean(MetricsKeys.overLoaded, virtualNAS.getMetrics())) {
_log.info("Removing vNAS {} as it is overloaded", virtualNAS.getNasName());
iterator.remove();
invalidNasServers.add(virtualNAS);
} else if (null != virtualNAS.getProtocols() && null != vpool.getProtocols() && !virtualNAS.getProtocols().containsAll(vpool.getProtocols())) {
_log.info("Removing vNAS {} as it does not support vpool protocols: {}", virtualNAS.getNasName(), vpool.getProtocols());
iterator.remove();
invalidNasServers.add(virtualNAS);
}
}
}
if (vNASList != null) {
_log.info("Got {} assigned VNAS servers for project {}", vNASList.size(), project);
}
return vNASList;
}
use of com.emc.storageos.db.client.model.VirtualNAS in project coprhd-controller by CoprHD.
the class FileStorageScheduler method getRecommendedVirtualNASBasedOnCandidatePools.
/**
* Retrieve list of recommended storage ports for file placement
* Follows the step to get recommendations for file placement.
* 1. Get the valid vNas servers assigned to given project.
* a. Get the active vNas assigned to project.
* b. filter out vNas, if any of them are overloaded.
* c. filter out vNas which based on vPool protocols.
* 2. if any valid assigned vNas found for project, goto step #3
* a. get all vNas servers in given virtual array
* b. filter out vNas server which are assigned to some project
* c. filter out vNas, if any of them are overloaded.
* d. filter out vNas which based on vPool protocols
* 3. If No - vNas servers found, goto step #
* 3. if the dynamic metric collection enabled
* a. sort the list of qualified vNas servers based on
* i. vNas - avgPercentageBusy
* ii. vNas - StorageObjects
* iii. vNas - Storage capacity
* 4. sort the list of qualified vNas servers based on static load
* i. vNas - StorageObjects
* ii. vNas - Storage capacity
* 5. Pick the overlapping vNas server in the order and recommended by vPool.
* 6. Pick the overlapping StorageHADomian recommended by vPool.
*
* @param vPool
* @param vArrayURI
* virtual array URI
* @param candidatePools
* @param project
* @return list of recommended storage ports for VNAS
*/
private Map<VirtualNAS, List<StoragePool>> getRecommendedVirtualNASBasedOnCandidatePools(VirtualPool vPool, URI vArrayURI, List<StoragePool> candidatePools, Project project, List<VirtualNAS> invalidNasServers) {
Map<VirtualNAS, List<StoragePool>> map = new LinkedHashMap<VirtualNAS, List<StoragePool>>();
List<VirtualNAS> vNASList = null;
if (project != null) {
_log.info("Get matching recommendations based on assigned VNAS to project {}", project.getLabel());
vNASList = getVNASServersInProject(project, vArrayURI, vPool, invalidNasServers);
}
if (vNASList == null || vNASList.isEmpty()) {
_log.info("Get matching recommendations based on un-assigned VNAS in varray {}", vArrayURI);
vNASList = getUnassignedVNASServers(vArrayURI, vPool, project, invalidNasServers);
}
if (vNASList != null && !vNASList.isEmpty()) {
boolean meteringEnabled = Boolean.parseBoolean(configInfo.get(ENABLE_METERING));
if (meteringEnabled) {
_log.info("Metering collection is enabled. Sort vNAS list based on performance.");
String dynamicPerformanceEnabled = customConfigHandler.getComputedCustomConfigValue(CustomConfigConstants.NAS_DYNAMIC_PERFORMANCE_PLACEMENT_ENABLED, "vnxfile", null);
_log.info("NAS dynamic performance placement enabled? : {}", dynamicPerformanceEnabled);
if (Boolean.valueOf(dynamicPerformanceEnabled)) {
_log.debug("Considering dynamic load to sort virtual NASs");
sortVNASListOnDyanamicLoad(vNASList);
} else {
_log.debug("Considering static load to sort virtual NASs");
sortVNASListOnStaticLoad(vNASList);
}
} else {
Collections.shuffle(vNASList);
}
}
for (VirtualNAS vNAS : vNASList) {
List<StoragePool> storagePools = new ArrayList<StoragePool>();
for (StoragePool storagePool : candidatePools) {
if (vNAS.getStorageDeviceURI().equals(storagePool.getStorageDevice())) {
storagePools.add(storagePool);
}
}
if (!storagePools.isEmpty()) {
map.put(vNAS, storagePools);
}
}
return map;
}
Aggregations