use of com.emc.storageos.plugins.metering.smis.SMIPluginException in project coprhd-controller by CoprHD.
the class ProfileProcessor method processResult.
/**
* {@inheritDoc}
*/
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
@SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
CIMInstance profileInstance = isRegisteredProfileValid(it);
if (null != profileInstance) {
_logger.info("RegisteredProfile : {}", profileInstance.getObjectPath());
addPath(keyMap, operation.getResult(), profileInstance.getObjectPath());
} else {
throw new SMIPluginException("Provider Version not supported,hence skipping scanning", SMIPluginException.ERRORCODE_PROVIDER_NOT_SUPPORTED);
}
}
use of com.emc.storageos.plugins.metering.smis.SMIPluginException in project coprhd-controller by CoprHD.
the class FEPortStatsProcessor method processResult.
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws SMIPluginException {
try {
CIMArgument<?>[] outputArguments = (CIMArgument<?>[]) resultObj;
DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
List<Stat> metricsObjList = (List<Stat>) keyMap.get(Constants._Stats);
List<String> metricSequence = (List<String>) keyMap.get(Constants.STORAGEOS_FEPORT_MANIFEST);
String[] feportsMetricValues = ((String[]) outputArguments[0].getValue())[0].split("\n");
List<StoragePort> systemPorts = ControllerUtils.getSystemPortsOfSystem(dbClient, profile.getSystemId());
_logger.debug("FEPort metricNames Sequence {}", metricSequence);
// process the results.
if (null != metricSequence && !metricSequence.isEmpty()) {
// Step2: For each feport metric record
for (String fePortMetricValue : feportsMetricValues) {
if (fePortMetricValue.isEmpty()) {
_logger.debug("Empty FEPort stats returned as part of Statistics Response");
continue;
}
String[] metrics = fePortMetricValue.split(Constants.SEMI_COLON);
// Step 3: For each port in db for a given system.
for (StoragePort port : systemPorts) {
// Step 4: if port in db is null just continue.
if (null == port) {
continue;
} else if (!port.getInactive() && metrics[0].endsWith(port.getPortName())) {
// Step 5: Check whether provider returned port
// exists in db or not. if port exists in db,
// then create a PortStat object for it.
_logger.debug("found FEPort in db for {}", port.getPortName());
createPortStatMetric(metricSequence, port, keyMap, metricsObjList, metrics);
}
}
}
//
// compute port metric to trigger if any port allocation qualification changed. If there is
// changes, run vpool matcher
//
portMetricsProcessor.triggerVpoolMatcherIfPortAllocationQualificationChanged(profile.getSystemId(), systemPorts);
//
// compute storage system's average of port metrics. Then, persist it into storage system object.
//
portMetricsProcessor.computeStorageSystemAvgPortMetrics(profile.getSystemId());
// Compute port group's port metrics for vmax only
portMetricsProcessor.computePortGroupMetrics(profile.getSystemId());
} else {
_logger.error("failed processing FEPOrt Metric values as metric sequence is null.");
}
} catch (Exception e) {
_logger.error("Failed while extracting stats for FEPorts: ", e);
}
resultObj = null;
}
use of com.emc.storageos.plugins.metering.smis.SMIPluginException in project coprhd-controller by CoprHD.
the class XIVCommunicationInterface method scan.
/**
* {@inheritDoc}
*/
@Override
public void scan(AccessProfile accessProfile) throws BaseCollectionException {
// Call scan method of SMICommunication interface to validate SMIS connectivity
super.scan(accessProfile);
URI providerURI = null;
StorageProvider providerObj = null;
String detailedStatusMessage = "Unknown Status";
try {
providerURI = accessProfile.getSystemId();
providerObj = _dbClient.queryObject(StorageProvider.class, providerURI);
// Validate Secondary URL for its availability
validateManagementURL(providerObj.getSecondaryURL(), providerObj.getSecondaryUsername(), providerObj.getSecondaryPassword());
// scan succeeds
detailedStatusMessage = String.format("Scan job completed successfully for REST API: %s", providerObj.getSecondaryURL());
} catch (Exception e) {
detailedStatusMessage = String.format("Scan job failed for REST API: %s because %s", providerObj.getSecondaryURL(), e.getMessage());
throw new SMIPluginException(detailedStatusMessage);
} finally {
if (providerObj != null) {
try {
// set detailed message
providerObj.setLastScanStatusMessage(detailedStatusMessage);
_dbClient.updateObject(providerObj);
} catch (DatabaseException ex) {
_logger.error("Error while persisting object to DB", ex);
}
}
}
}
use of com.emc.storageos.plugins.metering.smis.SMIPluginException in project coprhd-controller by CoprHD.
the class SMICommunicationInterface method discoverArrayAffinity.
/**
* {@inheritDoc}
*/
@Override
public void discoverArrayAffinity(AccessProfile accessProfile) {
_logger.info("Calling discoverArrayAffinity");
URI storageSystemURI = accessProfile.getSystemId();
String detailedStatusMessage = "Array Affinity Discovery completed successfully for Storage System: %s";
long startTime = System.currentTimeMillis();
try {
_logger.info("Access Profile Details :" + accessProfile.toString());
_keyMap = new ConcurrentHashMap<String, Object>();
_wbemClient = getCIMClient(accessProfile);
_logger.info("CIMClient initialized successfully");
_keyMap.put(Constants._cimClient, _wbemClient);
_keyMap.put(Constants.dbClient, _dbClient);
_keyMap.put(Constants.COORDINATOR_CLIENT, _coordinator);
_keyMap.put(Constants.PROPS, accessProfile.getProps());
_keyMap.put(Constants._InteropNamespace, accessProfile.getInteropNamespace());
_keyMap.put(Constants.ACCESSPROFILE, accessProfile);
_keyMap.put(Constants.SYSTEMID, accessProfile.getSystemId());
_keyMap.put(Constants._serialID, accessProfile.getserialID());
_keyMap.put(Constants.MASKING_VIEWS, new LinkedList<CIMObjectPath>());
StorageSystem storageSystem = queryStorageSystem(accessProfile);
String providerVersion = getProviderVersionString(storageSystem);
if (null != providerVersion) {
_keyMap.put(Constants.VERSION, providerVersion);
_keyMap.put(Constants.IS_NEW_SMIS_PROVIDER, isSMIS8XProvider(providerVersion));
}
executor.setKeyMap(_keyMap);
executor.execute((Namespace) namespaces.getNsList().get(DISCOVER));
} catch (Exception e) {
detailedStatusMessage = "Array Affinity Discovery failed for Storage System: %s because " + e.getMessage();
_logger.error(String.format(detailedStatusMessage, storageSystemURI.toString()), e);
throw new SMIPluginException(String.format(detailedStatusMessage, storageSystemURI.toString()));
} finally {
try {
String systemIdsStr = accessProfile.getProps().get(Constants.SYSTEM_IDS);
String[] systemIds = systemIdsStr.split(Constants.ID_DELIMITER);
List<StorageSystem> systemsToUpdate = new ArrayList<StorageSystem>();
for (String systemId : systemIds) {
StorageSystem system = _dbClient.queryObject(StorageSystem.class, URI.create(systemId));
// set detailed message
system.setLastArrayAffinityStatusMessage(String.format(detailedStatusMessage, systemId));
systemsToUpdate.add(system);
}
_dbClient.updateObject(systemsToUpdate);
} catch (DatabaseException ex) {
_logger.error("Error while persisting object to DB", ex);
}
releaseResources();
long totalTime = System.currentTimeMillis() - startTime;
_logger.info(String.format("Array Affinity discovery of Storage System %s took %f seconds", storageSystemURI.toString(), (double) totalTime / (double) 1000));
}
}
use of com.emc.storageos.plugins.metering.smis.SMIPluginException in project coprhd-controller by CoprHD.
the class SMICommunicationInterface method discover.
/**
* {@inheritDoc}
*/
@Override
public void discover(AccessProfile accessProfile) throws BaseCollectionException {
URI storageSystemURI = null;
StorageSystem storageSystem = null;
String detailedStatusMessage = "Unknown Status";
long startTime = System.currentTimeMillis();
try {
_logger.info("Access Profile Details :" + accessProfile.toString());
storageSystemURI = accessProfile.getSystemId();
storageSystem = queryStorageSystem(accessProfile);
_keyMap = new ConcurrentHashMap<String, Object>();
_wbemClient = getCIMClient(accessProfile);
_logger.info("CIMClient initialized successfully");
_keyMap.put(Constants._cimClient, _wbemClient);
_keyMap.put(Constants.dbClient, _dbClient);
_keyMap.put(Constants.COORDINATOR_CLIENT, _coordinator);
if (_networkDeviceController != null) {
_keyMap.put(Constants.networkDeviceController, _networkDeviceController);
}
_keyMap.put(Constants.PROPS, accessProfile.getProps());
_keyMap.put(Constants._InteropNamespace, accessProfile.getInteropNamespace());
_keyMap.put(Constants.ACCESSPROFILE, accessProfile);
_keyMap.put(Constants.SYSTEMID, accessProfile.getSystemId());
_keyMap.put(Constants._serialID, accessProfile.getserialID());
_keyMap.put(Constants.STORAGEPOOLS, new LinkedList<CIMObjectPath>());
_keyMap.put(Constants.PROTOCOLS, new HashSet<String>());
_keyMap.put(Constants.STORAGEETHERNETPORTS, new LinkedList<CIMObjectPath>());
_keyMap.put(Constants.IPENDPOINTS, new LinkedList<CIMObjectPath>());
_keyMap.put(Constants.STORAGEVOLUMES, new LinkedList<CIMObjectPath>());
String providerVersion = getProviderVersionString(storageSystem);
if (null != providerVersion) {
_keyMap.put(Constants.VERSION, providerVersion);
_keyMap.put(Constants.IS_NEW_SMIS_PROVIDER, isSMIS8XProvider(providerVersion));
}
Map<URI, StoragePool> poolsToMatchWithVpool = new HashMap<URI, StoragePool>();
_keyMap.put(Constants.MODIFIED_STORAGEPOOLS, poolsToMatchWithVpool);
// need this nested structure to be able to minimize the changes on existing code.
List<List<StoragePort>> portsToRunNetworkConnectivity = new ArrayList<List<StoragePort>>();
_keyMap.put(Constants.STORAGE_PORTS, portsToRunNetworkConnectivity);
List<StoragePort> discoveredPorts = new ArrayList<StoragePort>();
_keyMap.put(Constants.DISCOVERED_PORTS, discoveredPorts);
_keyMap.put(Constants.SLO_NAMES, new HashSet<String>());
if (Type.ibmxiv.name().equals(accessProfile.getSystemType())) {
initIBMDiscoveryKeyMap(accessProfile);
} else {
initEMCDiscoveryKeyMap(accessProfile);
if (Type.vmax.name().equals(accessProfile.getSystemType())) {
// discover port group
_keyMap.put(Constants.PORTGROUP, CimObjectPathCreator.createInstance(Constants.SE_TARGETMASKINGGROUP, accessProfile.getInteropNamespace()));
}
}
executor.setKeyMap(_keyMap);
executor.execute((Namespace) namespaces.getNsList().get(DISCOVER));
} catch (Exception e) {
detailedStatusMessage = String.format("Discovery failed for Storage System: %s because %s", storageSystemURI.toString(), e.getMessage());
_logger.error(detailedStatusMessage, e);
throw new SMIPluginException(detailedStatusMessage);
} finally {
if (storageSystem != null) {
try {
// set detailed message
storageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
_dbClient.persistObject(storageSystem);
} catch (DatabaseException ex) {
_logger.error("Error while persisting object to DB", ex);
}
}
releaseResources();
long totalTime = System.currentTimeMillis() - startTime;
_logger.info(String.format("Discovery of Storage System %s took %f seconds", storageSystemURI.toString(), (double) totalTime / (double) 1000));
}
}
Aggregations