use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class VNXFileCommApi method getMoverOrVdmName.
private StorageHADomain getMoverOrVdmName(StorageSystem system, String moverOrVdmId, String portNetworkId) {
_log.info("getMoverOrVdmName(StorageSystem {}, String {})", system.getId(), moverOrVdmId);
StorageHADomain matchingMoverOrVdm = null;
List<StoragePort> ports = CustomQueryUtility.queryActiveResourcesByRelation(_dbClient, system.getId(), StoragePort.class, "storageDevice");
for (StoragePort port : ports) {
if (port.getPortGroup().equalsIgnoreCase(moverOrVdmId) && port.getPortNetworkId().equalsIgnoreCase(portNetworkId)) {
matchingMoverOrVdm = _dbClient.queryObject(StorageHADomain.class, port.getStorageHADomain());
_log.info("getMoverOrVdmName match for Port {} and MoverOrVdm {}", port.getLabel() + ":" + port.getPortNetworkId() + ":" + port.getPortGroup(), matchingMoverOrVdm.getAdapterName() + ":" + matchingMoverOrVdm.getName());
break;
}
}
_log.info("getMoverOrVdmName return () ", matchingMoverOrVdm);
return matchingMoverOrVdm;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class NetAppClusterModeCommIntf method discoverPortGroups.
/**
* Discover the Storage Virtual Machines (Port Groups) for NetApp Cluster mode array
*
* @param system
* Storage system information
* @return Map of new and existing port groups
* @throws NetAppCException
*/
private HashMap<String, List<StorageHADomain>> discoverPortGroups(StorageSystem system, List<StorageVirtualMachineInfo> vServerList) throws NetAppCException {
HashMap<String, List<StorageHADomain>> portGroups = new HashMap<String, List<StorageHADomain>>();
List<StorageHADomain> newPortGroups = new ArrayList<StorageHADomain>();
List<StorageHADomain> existingPortGroups = new ArrayList<StorageHADomain>();
_logger.info("Start port group discovery (vfilers) for storage system {}", system.getId());
NetAppClusterApi netAppCApi = new NetAppClusterApi.Builder(system.getIpAddress(), system.getPortNumber(), system.getUsername(), system.getPassword()).https(true).build();
StorageHADomain portGroup = null;
List<StorageVirtualMachineInfo> svms = netAppCApi.listSVM();
if (null == svms || svms.isEmpty()) {
// Check if default port group was previously created.
URIQueryResultList results = new URIQueryResultList();
String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, DEFAULT_SVM, NativeGUIDGenerator.ADAPTER);
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint(adapterNativeGuid), results);
if (results.iterator().hasNext()) {
StorageHADomain tmpGroup = _dbClient.queryObject(StorageHADomain.class, results.iterator().next());
if (tmpGroup.getStorageDeviceURI().equals(system.getId())) {
portGroup = tmpGroup;
_logger.debug("Found existing port group {} ", tmpGroup.getName());
}
}
if (portGroup == null) {
portGroup = new StorageHADomain();
portGroup.setId(URIUtil.createId(StorageHADomain.class));
portGroup.setName("NetAppC");
portGroup.setVirtual(false);
portGroup.setNativeGuid(adapterNativeGuid);
portGroup.setStorageDeviceURI(system.getId());
StringSet protocols = new StringSet();
protocols.add(StorageProtocol.File.NFS.name());
protocols.add(StorageProtocol.File.CIFS.name());
portGroup.setFileSharingProtocols(protocols);
newPortGroups.add(portGroup);
} else {
existingPortGroups.add(portGroup);
}
} else {
_logger.debug("Number svms found: {}", svms.size());
vServerList.addAll(svms);
StringSet protocols = new StringSet();
protocols.add(StorageProtocol.File.NFS.name());
protocols.add(StorageProtocol.File.CIFS.name());
for (StorageVirtualMachineInfo vs : svms) {
_logger.debug("SVM name: {}", vs.getName());
// Check if port group was previously discovered
URIQueryResultList results = new URIQueryResultList();
String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, vs.getName(), NativeGUIDGenerator.ADAPTER);
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint(adapterNativeGuid), results);
portGroup = null;
if (results.iterator().hasNext()) {
StorageHADomain tmpGroup = _dbClient.queryObject(StorageHADomain.class, results.iterator().next());
if (tmpGroup.getStorageDeviceURI().equals(system.getId())) {
portGroup = tmpGroup;
_logger.debug("Found duplicate {} ", vs.getName());
}
}
if (portGroup == null) {
portGroup = new StorageHADomain();
portGroup.setId(URIUtil.createId(StorageHADomain.class));
portGroup.setName(vs.getName());
portGroup.setVirtual(true);
portGroup.setAdapterType(StorageHADomain.HADomainType.VIRTUAL.toString());
portGroup.setNativeGuid(adapterNativeGuid);
portGroup.setStorageDeviceURI(system.getId());
portGroup.setFileSharingProtocols(protocols);
newPortGroups.add(portGroup);
} else {
existingPortGroups.add(portGroup);
}
}
}
portGroups.put(NEW, newPortGroups);
portGroups.put(EXISTING, existingPortGroups);
return portGroups;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class NetAppClusterModeCommIntf method findMatchingHADomain.
private URI findMatchingHADomain(String domainName, List<StorageHADomain> haDomains) {
_logger.debug("domain name to search for: {}", domainName);
for (StorageHADomain domain : haDomains) {
_logger.debug("current domain name: {}", domain.getName());
if (domainName.equals(domain.getName())) {
_logger.debug("found match for {}", domainName);
return domain.getId();
}
}
_logger.debug("no match for {}", domainName);
return null;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class NetAppFileCommunicationInterface method findMatchingHADomain.
private URI findMatchingHADomain(String domainName, List<StorageHADomain> haDomains) {
_logger.debug("domain name to search for: {}", domainName);
for (StorageHADomain domain : haDomains) {
_logger.debug("current domain name: {}", domain.getName());
if (domainName.equals(domain.getName())) {
_logger.debug("found match for {}", domainName);
return domain.getId();
}
}
_logger.debug("no match for {}", domainName);
return null;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class PortMetricsProcessor method computeStorageSystemAvgPortMetrics.
/**
* Compute storage system's average port metrics. The answer is in percent. This is averaged over all the usable ports.
* For XtremIO, it is StorageHADomain's CPU usage metrics. Port metrics are not available to collect.
*
* @param storageSystemURI -- URI for the storage system.
* @return -- A percent busy from 0 to 100%.
*/
public Double computeStorageSystemAvgPortMetrics(URI storageSystemURI) {
StorageSystem storageDevice = _dbClient.queryObject(StorageSystem.class, storageSystemURI);
Double portMetricsSum = 0.0;
double usablePortCount = 0;
Double storageSystemPortsMetrics = null;
if (storageDevice != null) {
if (!DiscoveredDataObject.Type.xtremio.name().equals(storageDevice.getSystemType())) {
URIQueryResultList storagePortURIs = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStoragePortConstraint(storageSystemURI), storagePortURIs);
// query iteratively to avoid dbsvc warning of too many objects being queried at once
// this will prevent the warning message in the log but will still result in all storage ports
// for a storage system to be in memory at once. There is usually less than 100 but at one
// customer site there are between 100 and 150 for a few storage systems
Iterator<StoragePort> storagePortItr = _dbClient.queryIterativeObjects(StoragePort.class, storagePortURIs);
List<StoragePort> storagePorts = new ArrayList<StoragePort>();
while (storagePortItr.hasNext()) {
storagePorts.add(storagePortItr.next());
}
if (!metricsValid(storageDevice, storagePorts)) {
// The metrics are not valid for this array. Log it and return 50.0%.
_log.info(String.format("Port metrics not valid for array %s (%s), using 50.0 percent for array metric", storageDevice.getLabel(), storageSystemURI.toString()));
// clear the previous value
storageDevice.setAveragePortMetrics(-1.0);
_dbClient.updateObject(storageDevice);
return 50.0;
}
// compute sum of all usable port metrics
for (StoragePort storagePort : storagePorts) {
// if port is usable, compute its port metrics
if (isPortUsable(storagePort, false)) {
portMetricsSum += MetricsKeys.getDouble(MetricsKeys.portMetric, storagePort.getMetrics());
usablePortCount++;
}
}
storageSystemPortsMetrics = (Double.compare(usablePortCount, 0) == 0) ? 0.0 : portMetricsSum / usablePortCount;
_log.info(String.format("Array %s metric %f", storageDevice.getLabel(), storageSystemPortsMetrics));
// persisted into storage system object for later retrieval
storageDevice.setAveragePortMetrics(storageSystemPortsMetrics);
_dbClient.updateObject(storageDevice);
} else {
// For XtremIO, it is StorageHADomain's CPU usage metrics
URIQueryResultList storageHADomainURIs = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStorageHADomainConstraint(storageSystemURI), storageHADomainURIs);
// query iteratively to avoid dbsvc warning of too many objects being queried at once
// this will prevent the warning message in the log but will still result in all StorageHADomain objects
// for a storage system to be in memory at once.
Iterator<StorageHADomain> storageHADomainItr = _dbClient.queryIterativeObjects(StorageHADomain.class, storageHADomainURIs);
List<StorageHADomain> storageHADomains = new ArrayList<StorageHADomain>();
while (storageHADomainItr.hasNext()) {
storageHADomains.add(storageHADomainItr.next());
}
if (!isMetricsValid(storageDevice, storageHADomains)) {
// The metrics are not valid for this array. Log it and return 50.0%.
_log.info(String.format("CPU usage metrics not valid for array %s (%s), using 50.0 percent for array metric", storageDevice.getLabel(), storageSystemURI.toString()));
// clear the previous value
storageDevice.setAveragePortMetrics(-1.0);
_dbClient.updateObject(storageDevice);
return 50.0;
}
// compute sum of all CPU usages
for (StorageHADomain storageHADomain : storageHADomains) {
if (!storageHADomain.getInactive()) {
portMetricsSum += MetricsKeys.getDouble(MetricsKeys.avgCpuPercentBusy, storageHADomain.getMetrics());
usablePortCount++;
}
}
storageSystemPortsMetrics = (Double.compare(usablePortCount, 0) == 0) ? 0.0 : portMetricsSum / usablePortCount;
_log.info(String.format("Array %s CPU usage %f", storageDevice.getLabel(), storageSystemPortsMetrics));
// persisted into storage system object for later retrieval
storageDevice.setAveragePortMetrics(storageSystemPortsMetrics);
_dbClient.updateObject(storageDevice);
}
}
// if no usable port, return null. Otherwise compute average.
return storageSystemPortsMetrics;
}
Aggregations