use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.
the class FrontEndPortStatsProcessor method processResult.
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
Iterator<CIMInstance> storagePortStatsResponseItr = (Iterator<CIMInstance>) resultObj;
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
URI systemId = profile.getSystemId();
DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
logger.info("Processing FrontEnd Ports response");
try {
List<Stat> metricsObjList = (List<Stat>) keyMap.get(Constants._Stats);
while (storagePortStatsResponseItr.hasNext()) {
CIMInstance storagePortStatInstance = (CIMInstance) storagePortStatsResponseItr.next();
Stat fePortStat = new Stat();
fePortStat.setServiceType(Constants._Block);
fePortStat.setTimeCollected((Long) keyMap.get(Constants._TimeCollected));
Long providerCollectionTime = convertCIMStatisticTime(getCIMPropertyValue(storagePortStatInstance, STATISTICTIME));
if (0 != providerCollectionTime) {
fePortStat.setTimeInMillis(providerCollectionTime);
} else {
fePortStat.setTimeInMillis((Long) keyMap.get(Constants._TimeCollected));
}
fePortStat.setTotalIOs(ControllerUtils.getModLongValue(getCIMPropertyValue(storagePortStatInstance, TOTALIOS)));
fePortStat.setKbytesTransferred(ControllerUtils.getModLongValue(getCIMPropertyValue(storagePortStatInstance, KBYTESTRANSFERRED)));
setPortRelatedInfo(storagePortStatInstance, systemId, dbClient, fePortStat);
metricsObjList.add(fePortStat);
}
} catch (Exception ex) {
logger.error("Failed while extracting Stats for Front end ports: ", ex);
} finally {
resultObj = null;
}
logger.info("Processing FrontEnd Ports response completed");
}
use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.
the class DataCollectionJobConsumer method invokeJob.
public void invokeJob(final DataCollectionJob job) throws Exception {
if (job instanceof DataCollectionScanJob) {
throw new DeviceControllerException("Invoked wrong job type : " + job.getType());
}
DataCollectionTaskCompleter completer = job.getCompleter();
// set the next run time based on the time this discovery job is started (not the time it's queued)
completer.setNextRunTime(_dbClient, System.currentTimeMillis() + JobIntervals.get(job.getType()).getInterval() * 1000);
completer.updateObjectState(_dbClient, DiscoveredDataObject.DataCollectionJobStatus.IN_PROGRESS);
// get the node that this discovery is being run on so it is displayed in the UI
String jobType = job.getType();
String nodeId = _coordinator.getInetAddessLookupMap().getNodeId();
job.updateTask(_dbClient, "Started " + jobType + " on node " + nodeId);
/**
* TODO ISILON or VNXFILE
* AccessProfile needs to get created, for each device Type.
* Hence for isilon or vnxFile discovery, add logic in getAccessProfile
* to set the required parameters for Discovery.
*/
AccessProfile profile = _util.getAccessProfile(completer.getType(), completer.getId(), jobType, job.getNamespace());
profile.setProps(new HashMap<String, String>(_configInfo));
if (job instanceof DataCollectionArrayAffinityJob) {
List<URI> hostIds = ((DataCollectionArrayAffinityJob) job).getHostIds();
if (hostIds != null && !hostIds.isEmpty()) {
profile.getProps().put(Constants.HOST_IDS, StringUtils.join(hostIds, Constants.ID_DELIMITER));
}
List<URI> systemIds = ((DataCollectionArrayAffinityJob) job).getSystemIds();
if (systemIds != null && !systemIds.isEmpty()) {
profile.getProps().put(Constants.SYSTEM_IDS, StringUtils.join(systemIds, Constants.ID_DELIMITER));
Iterator<StorageSystem> storageSystems = _dbClient.queryIterativeObjects(StorageSystem.class, systemIds);
List<String> systemSerialIds = new ArrayList<String>();
while (storageSystems.hasNext()) {
StorageSystem systemObj = storageSystems.next();
systemSerialIds.add(systemObj.getSerialNumber());
}
if (!systemSerialIds.isEmpty()) {
profile.getProps().put(Constants.SYSTEM_SERIAL_IDS, StringUtils.join(systemSerialIds, Constants.ID_DELIMITER));
}
}
}
profile.setCimConnectionFactory(_connectionFactory);
profile.setCurrentSampleTime(System.currentTimeMillis());
DataCollectionJobInvoker invoker = new DataCollectionJobInvoker(profile, _configInfo, _dbClient, _coordinator, _networkDeviceController, _locker, job.getNamespace(), completer);
invoker.process(applicationContext);
job.ready(_dbClient);
}
use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.
the class DataCollectionJobConsumer method performScan.
public void performScan(URI provider, ScanTaskCompleter scanCompleter, Map<String, StorageSystemViewObject> storageCache) throws DatabaseException, BaseCollectionException, DeviceControllerException {
AccessProfile profile = _util.getAccessProfile(StorageProvider.class, provider, ControllerServiceImpl.SCANNER, null);
profile.setCache(storageCache);
profile.setCimConnectionFactory(_connectionFactory);
profile.setProps(_configInfo);
DataCollectionJobInvoker invoker = new DataCollectionJobInvoker(profile, _configInfo, _dbClient, _coordinator, null, _locker, null, scanCompleter);
invoker.process(applicationContext);
}
use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.
the class FirmwareProcessor method processResult.
/**
* {@inheritDoc}
*/
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
String serialNumber = null;
@SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
coordinator = (CoordinatorClient) keyMap.get(Constants.COORDINATOR_CLIENT);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
String delimiter = Constants.PATH_DELIMITER_REGEX;
if (Type.ibmxiv.name().equals(profile.getSystemType())) {
delimiter = Pattern.quote(Constants.COLON);
}
if (it.hasNext()) {
// e.g., IBM XIV InstanceID, IBMTSDS:IBM.2810-7825363
CIMInstance firmwareInstance = it.next();
serialNumber = firmwareInstance.getPropertyValue(INSTANCEID).toString().split(delimiter)[1];
String nativeGuid = NativeGUIDGenerator.generateNativeGuid(profile.getSystemType(), serialNumber);
List<StorageSystem> systems = CustomQueryUtility.getActiveStorageSystemByNativeGuid(_dbClient, nativeGuid);
if (!systems.isEmpty()) {
StorageSystem system = systems.get(0);
checkFirmwareVersion(firmwareInstance, system);
}
} else {
String errMsg = String.format("No information obtained from Provider %s for Firmware version", profile.getIpAddress());
throw new SMIPluginException(errMsg, SMIPluginException.ERRORCODE_OPERATIONFAILED);
}
} catch (SMIPluginException e) {
throw e;
} catch (Exception e) {
String errMsg = String.format("An error occurred while verifying Firmware version: %s", e.getMessage());
throw new SMIPluginException(SMIPluginException.ERRORCODE_OPERATIONFAILED, e, errMsg);
}
}
use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.
the class PoolCapabilitiesProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
@SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
while (it.hasNext()) {
CIMInstance capabilitiesInstance = null;
try {
capabilitiesInstance = it.next();
String instanceID = capabilitiesInstance.getPropertyValue(Constants.INSTANCEID).toString();
if (DiscoveredDataObject.Type.vnxblock.toString().equalsIgnoreCase(device.getSystemType())) {
insertExpectedPoolSettingsPerTier(capabilitiesInstance.getObjectPath(), keyMap);
addPath(keyMap, Constants.VNXPOOLCAPABILITIES, capabilitiesInstance.getObjectPath());
}
addPath(keyMap, operation.getResult(), capabilitiesInstance.getObjectPath());
} catch (Exception e) {
_logger.warn("Pool Capabilities Discovery failed for {}-->{}", capabilitiesInstance.getObjectPath(), getMessage(e));
}
}
} catch (Exception e) {
_logger.error("Pool Capabilities Discovery failed -->{}", getMessage(e));
}
}
Aggregations