use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class XIVSupportedAsynchronousActionsProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
_log.info("processResult");
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
@SuppressWarnings("unchecked") Iterator<CIMInstance> iterator = (Iterator<CIMInstance>) resultObj;
while (iterator.hasNext()) {
CIMInstance instance = iterator.next();
UnsignedInteger16[] supportedAsyncActions = (UnsignedInteger16[]) instance.getPropertyValue(Constants.SUPPORTED_ASYNCHRONOUS_ACTIONS);
StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
StringSet supportedAsyncActionsSet = new StringSet();
if (supportedAsyncActions != null) {
for (UnsignedInteger16 actionValue : supportedAsyncActions) {
switch(actionValue.intValue()) {
case Constants.CREATE_ELEMENT_REPLICA_ASYNC_ACTION:
supportedAsyncActionsSet.add(StorageSystem.AsyncActions.CreateElementReplica.name());
break;
case Constants.CREATE_GROUP_REPLICA_ASYNC_ACTION:
supportedAsyncActionsSet.add(StorageSystem.AsyncActions.CreateGroupReplica.name());
break;
default:
}
}
}
device.setSupportedAsynchronousActions(supportedAsyncActionsSet);
StringSet replicationTypes = new StringSet();
replicationTypes.add(SupportedReplicationTypes.LOCAL.name());
device.setSupportedReplicationTypes(replicationTypes);
_dbClient.persistObject(device);
}
} catch (Exception e) {
_log.error("Supported asynchronous action processing failed: ", e);
}
}
use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class XIVTCPProtocolEndPointProcessor 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);
while (it.hasNext()) {
CIMInstance tcpPointInstance = null;
StoragePort port = null;
try {
tcpPointInstance = it.next();
String portInstanceID = getObjectPathfromCIMArgument(args).toString();
port = _dbClient.queryObject(StoragePort.class, (URI) keyMap.get(portInstanceID));
updateTCPEndPointDetails(port, tcpPointInstance);
} catch (Exception e) {
_logger.warn("Port TCP End Point Discovery failed for {}-->{}", "", getMessage(e));
}
}
} catch (Exception e) {
_logger.error("Port TCP End Point Discovery failed -->{}", getMessage(e));
}
}
use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class BlockStatisticsCapabilitiesProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
final Iterator<?> it = (Iterator<?>) resultObj;
// Only 1 entry per each Array always
while (it.hasNext()) {
final CIMInstance queryInstance = (CIMInstance) it.next();
CIMProperty prop = queryInstance.getProperty(Constants.CLOCK_TICK_INTERVAL);
keyMap.put(Constants.CLOCK_TICK_INTERVAL, prop.getValue().toString());
}
} catch (Exception e) {
_logger.error("Failed while processing QueryStatistics :", e);
}
resultObj = null;
}
use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class CapacityPoolProcessor method processVolumeCapacity.
/**
* Process volume capacity, iterates over the given chunk and process
* each volume capacity.
*
* @param volumeInstances {@link CloseableIterator} instance
* @param keyMap {@link Map} instance
*/
private void processVolumeCapacity(CloseableIterator<CIMInstance> volumeInstances, Map<String, Object> keyMap) {
while (volumeInstances.hasNext()) {
try {
final CIMInstance volumeInstance = (CIMInstance) volumeInstances.next();
String key = null;
String spaceConsumed = null;
if (keyMap.containsKey(Constants.IS_NEW_SMIS_PROVIDER) && Boolean.valueOf(keyMap.get(Constants.IS_NEW_SMIS_PROVIDER).toString())) {
key = createKeyfor8x(volumeInstance);
spaceConsumed = volumeInstance.getProperty(_emcspaceConsumed).getValue().toString();
} else {
key = createKeyfromProps(volumeInstance);
spaceConsumed = volumeInstance.getProperty(_spaceConsumed).getValue().toString();
}
Object value = getMetrics(keyMap, key);
if (null == value) {
keyMap.put(key, Long.parseLong(spaceConsumed));
} else if (value instanceof Stat) {
Stat metrics = (Stat) value;
metrics.setProvisionedCapacity(returnProvisionedCapacity(volumeInstance, keyMap));
metrics.setAllocatedCapacity(Long.parseLong(spaceConsumed));
}
} catch (Exception ex) {
// This check will make sure to skip unnecessary logs
if (!(ex instanceof BaseCollectionException)) {
_logger.error("Provisioned Capacity failure : ", ex);
}
}
}
}
use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class MetricSequenceProcessor method processResult.
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
while (it.hasNext()) {
CIMInstance blockManifestInstance = null;
try {
blockManifestInstance = it.next();
String elementType = getCIMPropertyValue(blockManifestInstance, Constants.ELEMENTTYPE);
String elementName = getCIMPropertyValue(blockManifestInstance, Constants.ELEMENTNAME);
String[] csvSeq = (String[]) blockManifestInstance.getPropertyValue(Constants.CSV_SEQUENCE);
List<String> csvSequenceList = new LinkedList<String>(Arrays.asList(csvSeq));
_logger.debug("csvSequenceList: {}", csvSequenceList);
if (elementType.equals(Constants.VOLUME_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_VOLUME_MANIFEST)) {
keyMap.put(Constants.STORAGEOS_VOLUME_MANIFEST, csvSequenceList);
} else if (elementType.equals(Constants.FEPORT_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_FEPORT_MANIFEST)) {
keyMap.put(Constants.STORAGEOS_FEPORT_MANIFEST, csvSequenceList);
} else if (elementType.equals(Constants.FEADAPT_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_FEADAPT_MANIFEST)) {
keyMap.put(Constants.STORAGEOS_FEADAPT_MANIFEST, csvSequenceList);
} else if (elementType.equals(Constants.SYSTEM_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_SYSTEM_MANIFEST)) {
keyMap.put(Constants.STORAGEOS_SYSTEM_MANIFEST, csvSequenceList);
}
} catch (Exception e) {
_logger.warn("MetricSequence call failed for {}", getCIMPropertyValue(blockManifestInstance, Constants.INSTANCEID), e);
}
}
} catch (Exception e) {
_logger.error("Processing MetricSequence call failed", e);
}
}
Aggregations