use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class XIVStoragePortProcessor method processResult.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
_profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
Set<String> protocols = (Set<String>) keyMap.get(Constants.PROTOCOLS);
_newPortList = new ArrayList<StoragePort>();
_updatePortList = new ArrayList<StoragePort>();
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
Map<URI, StoragePool> poolsToMatchWithVpool = (Map<URI, StoragePool>) keyMap.get(Constants.MODIFIED_STORAGEPOOLS);
StorageSystem device = _dbClient.queryObject(StorageSystem.class, _profile.getSystemId());
while (it.hasNext()) {
CIMInstance portInstance = null;
StoragePort port = null;
try {
portInstance = it.next();
String protocol = getCIMPropertyValue(portInstance, LINKTECHNOLOGY);
String className = portInstance.getClassName();
// FC Port - 4
if ("4".equals(protocol)) {
port = checkStoragePortExistsInDB(portInstance, device, _dbClient);
checkProtocolAlreadyExists(protocols, FC);
createStoragePort(port, portInstance, _profile, true, FC, device);
} else if (IPPORT_CLASS_NAME.equals(className)) {
port = createStoragePort(null, portInstance, _profile, false, IP, device);
checkProtocolAlreadyExists(protocols, ISCSI);
keyMap.put(portInstance.getObjectPath().toString(), port);
addPath(keyMap, operation.getResult(), portInstance.getObjectPath());
} else {
_logger.debug("Unsupported Port : {}", getCIMPropertyValue(portInstance, DEVICEID));
}
} catch (Exception e) {
_logger.warn("Port Discovery failed for {}", getCIMPropertyValue(portInstance, DEVICEID), e);
}
}
_dbClient.createObject(_newPortList);
_dbClient.persistObject(_updatePortList);
// ports used later to run Transport Zone connectivity
List<List<StoragePort>> portsUsedToRunTZoneConnectivity = (List<List<StoragePort>>) keyMap.get(Constants.STORAGE_PORTS);
portsUsedToRunTZoneConnectivity.add(_newPortList);
portsUsedToRunTZoneConnectivity.add(_updatePortList);
List<StoragePool> modifiedPools = StoragePoolAssociationHelper.getStoragePoolsFromPorts(_dbClient, _newPortList, _updatePortList);
for (StoragePool pool : modifiedPools) {
// pool matcher will be invoked on this pool
if (!poolsToMatchWithVpool.containsKey(pool.getId())) {
poolsToMatchWithVpool.put(pool.getId(), pool);
}
}
_logger.debug("# Pools used in invoking PoolMatcher during StoragePortProcessor {}", Joiner.on("\t").join(poolsToMatchWithVpool.keySet()));
// discovered ports used later to check for not visible ports
List<StoragePort> discoveredPorts = (List<StoragePort>) keyMap.get(Constants.DISCOVERED_PORTS);
discoveredPorts.addAll(_newPortList);
discoveredPorts.addAll(_updatePortList);
// if the port's end point is in a transport zone, associate the the
// port to the
// transport zone. Also update the storage pools and varray
// association if needed.
StoragePortAssociationHelper.updatePortAssociations(_newPortList, _dbClient);
StoragePortAssociationHelper.updatePortAssociations(_updatePortList, _dbClient);
} catch (Exception e) {
_logger.error("Port Discovery failed -->{}", getMessage(e));
} finally {
_newPortList = null;
_updatePortList = null;
}
}
use of com.emc.storageos.plugins.BaseCollectionException 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 com.emc.storageos.plugins.BaseCollectionException 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 com.emc.storageos.plugins.BaseCollectionException 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 com.emc.storageos.plugins.BaseCollectionException 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);
}
}
}
}
Aggregations