use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class SGsWithFastVolumesProcessor method processResult.
/**
* This processor gets invoked only for VMAX unManaged volume discoveries.
* Volumes belonging to SG are processed , and using the mapping information Storage Groups-->Fast Policy,
* we identify the volume's policy.
*/
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
CloseableIterator<CIMObjectPath> volumeInstances = null;
try {
@SuppressWarnings("unchecked") Map<String, String> policyToStorageGroupMapping = (Map<String, String>) keyMap.get(Constants.POLICY_STORAGE_GROUP_MAPPING);
CIMObjectPath storageGroupPath = getObjectPathfromCIMArgument(_args);
String groupId = storageGroupPath.getKey(Constants.INSTANCEID).getValue().toString();
String policyName = policyToStorageGroupMapping.get(groupId);
_logger.info("Group {} policy Name {}", groupId, policyName);
if (null == policyName) {
return;
}
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
_unManagedVolumesUpdate = new ArrayList<UnManagedVolume>();
@SuppressWarnings("unchecked") EnumerateResponse<CIMObjectPath> volumeInstanceChunks = (EnumerateResponse<CIMObjectPath>) resultObj;
volumeInstances = volumeInstanceChunks.getResponses();
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
processVolumes(volumeInstances, policyName, keyMap, operation);
while (!volumeInstanceChunks.isEnd()) {
_logger.debug("Processing Next Volume Chunk of size {}", BATCH_SIZE);
volumeInstanceChunks = client.getInstancePaths(storageGroupPath, volumeInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
processVolumes(volumeInstanceChunks.getResponses(), policyName, keyMap, operation);
}
if (!_unManagedVolumesUpdate.isEmpty()) {
_partitionManager.updateInBatches(_unManagedVolumesUpdate, getPartitionSize(keyMap), _dbClient, "VOLUME");
_unManagedVolumesUpdate.clear();
}
} catch (Exception e) {
_logger.error("Discovering Tier Policies for vmax volumes failed", e);
} finally {
if (volumeInstances != null) {
volumeInstances.close();
}
}
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class StorageGroupProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
@SuppressWarnings("unchecked") final Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
Map<String, String> volumesWithSLO = null;
dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
URI systemId = profile.getSystemId();
List<CIMObjectPath> processedSGs = new ArrayList<>();
if (!keyMap.containsKey(Constants.VOLUMES_WITH_SLOS)) {
volumesWithSLO = new HashMap<>();
keyMap.put(Constants.VOLUMES_WITH_SLOS, volumesWithSLO);
} else {
volumesWithSLO = (Map<String, String>) keyMap.get(Constants.VOLUMES_WITH_SLOS);
}
try {
StorageSystem device = dbClient.queryObject(StorageSystem.class, systemId);
// Process these only for VMAX3 Systems.
if (device.checkIfVmax3()) {
if (keyMap.containsKey(Constants.STORAGE_GROUPS_PROCESSED)) {
processedSGs = (List<CIMObjectPath>) keyMap.get(Constants.STORAGE_GROUPS_PROCESSED);
}
while (it.hasNext()) {
CIMObjectPath path = it.next();
if (null != processedSGs && processedSGs.contains(path)) {
logger.info("Skipping the already processed SG. {}", path);
continue;
}
findVolumesSLOFromSGInstance(client, path, volumesWithSLO);
}
}
} catch (Exception e) {
logger.error("Extracting storageGroup details failed.", e);
} finally {
// clean all the processedSGs here.
processedSGs.clear();
}
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class StoragePoolProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
@SuppressWarnings("unchecked") final Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
while (it.hasNext()) {
CIMObjectPath poolPath = it.next();
String poolNativeGuid = NativeGUIDGenerator.generateNativeGuidForPool(poolPath);
StoragePool pool = checkStoragePoolExistsInDB(poolNativeGuid, _dbClient);
if (pool != null && validPool(poolPath)) {
addPath(keyMap, operation.getResult(), poolPath);
// add VMAX2 Thin pools to get BoundVolumes later
if (poolPath.toString().contains(StoragePool.PoolClassNames.Symm_VirtualProvisioningPool.toString())) {
addPath(keyMap, Constants.VMAX2_THIN_POOLS, poolPath);
}
String poolClass = poolPath.getObjectName();
if (poolClass.startsWith(SYMM_CLASS_PREFIX) && !poolClass.equals(StoragePool.PoolClassNames.Symm_SRPStoragePool.name())) {
addPath(keyMap, Constants.VMAX2POOLS, poolPath);
}
}
}
} catch (Exception e) {
_logger.error("Processing Storage Pool failed", e);
}
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class StorageSynchronizedProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final Iterator<?> it = (Iterator<?>) resultObj;
@SuppressWarnings("unchecked") Map<String, RemoteMirrorObject> volumeToRAGroupMap = (Map<String, RemoteMirrorObject>) keyMap.get(Constants.UN_VOLUME_RAGROUP_MAP);
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
while (it.hasNext()) {
try {
final CIMInstance instance = (CIMInstance) it.next();
CIMObjectPath volumePath = instance.getObjectPath();
CIMObjectPath sourcePath = (CIMObjectPath) volumePath.getKey(Constants._SystemElement).getValue();
CIMObjectPath destPath = (CIMObjectPath) volumePath.getKey(Constants._SyncedElement).getValue();
String mode = instance.getPropertyValue(SmisConstants.CP_MODE).toString();
String copyMode = null;
if (mode != null) {
copyMode = SupportedCopyModes.getCopyMode(mode);
}
String sourceNativeGuid = createKeyfromPath(sourcePath);
sourceNativeGuid = sourceNativeGuid.replace("VOLUME", "UNMANAGEDVOLUME");
_log.debug("Source Native Guid {}", sourceNativeGuid);
String targetNativeGuid = createKeyfromPath(destPath);
targetNativeGuid = targetNativeGuid.replace("VOLUME", "UNMANAGEDVOLUME");
_log.debug("Target Native Guid {}", targetNativeGuid);
// if child
if (volumeToRAGroupMap.containsKey(targetNativeGuid)) {
// set Parent
// copyMode and raGroup Uri are already part of RemoteMirrorObject
_log.debug("Found Target Native Guid {}", targetNativeGuid);
RemoteMirrorObject rmObj = volumeToRAGroupMap.get(targetNativeGuid);
_log.debug("Found Target Remote Object {}", rmObj);
rmObj.setSourceVolumeNativeGuid(sourceNativeGuid);
rmObj.setType(RemoteMirrorObject.Types.TARGET.toString());
if (copyMode != null && !SupportedCopyModes.UNKNOWN.name().equals(copyMode) && !copyMode.equalsIgnoreCase(rmObj.getCopyMode()) && updateSupportedCopyMode(rmObj.getCopyMode())) {
rmObj.setCopyMode(copyMode);
updateCopyModeInRAGroupObjectIfRequired(copyMode, rmObj);
}
}
if (volumeToRAGroupMap.containsKey(sourceNativeGuid)) {
_log.debug("Found Source Native Guid {}", sourceNativeGuid);
RemoteMirrorObject rmObj = volumeToRAGroupMap.get(sourceNativeGuid);
_log.debug("Found Source Remote Object {}", rmObj);
if (null == rmObj.getTargetVolumenativeGuids()) {
rmObj.setTargetVolumenativeGuids(new StringSet());
}
if (!findVolumesArefromSameArray(sourceNativeGuid, targetNativeGuid)) {
rmObj.getTargetVolumenativeGuids().add(targetNativeGuid);
// Set this only for the volumes have remote replication
rmObj.setType(RemoteMirrorObject.Types.SOURCE.toString());
_log.debug("Updated Target Volumes", rmObj);
}
}
} catch (Exception e) {
_log.error("Finding out Parent of a target Volume failed", e);
}
}
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class StorageVolumeBoundPoolProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
CloseableIterator<CIMInstance> allocatedFromStoragePoolInstances = null;
EnumerateResponse<CIMInstance> allocatedFromStoragePoolInstanceChunks = null;
@SuppressWarnings("unchecked") Map<String, Set<String>> vmax2ThinPoolToBoundVolumesMap = (Map<String, Set<String>>) keyMap.get(Constants.VMAX2_THIN_POOL_TO_BOUND_VOLUMES);
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
CIMObjectPath storagePoolPath = null;
try {
storagePoolPath = getObjectPathfromCIMArgument(_args);
_logger.debug("VMAX2 Thin Pool: {}", storagePoolPath.toString());
String poolNativeGuid = NativeGUIDGenerator.generateNativeGuidForPool(storagePoolPath);
StoragePool pool = checkStoragePoolExistsInDB(poolNativeGuid, _dbClient);
if (pool == null) {
_logger.error("Skipping unmanaged volume discovery as the storage pool with path {} doesn't exist in ViPR", storagePoolPath.toString());
return;
}
Set<String> boundVolumes = new HashSet<String>();
allocatedFromStoragePoolInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
allocatedFromStoragePoolInstances = allocatedFromStoragePoolInstanceChunks.getResponses();
processVolumes(allocatedFromStoragePoolInstances, boundVolumes);
while (!allocatedFromStoragePoolInstanceChunks.isEnd()) {
_logger.info("Processing Next Volume Chunk of size {}", BATCH_SIZE);
allocatedFromStoragePoolInstanceChunks = client.getInstancesWithPath(storagePoolPath, allocatedFromStoragePoolInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
processVolumes(allocatedFromStoragePoolInstanceChunks.getResponses(), boundVolumes);
}
vmax2ThinPoolToBoundVolumesMap.put(storagePoolPath.toString(), boundVolumes);
_logger.debug("Bound volumes list {}", Joiner.on("\t").join(boundVolumes));
} catch (Exception e) {
_logger.error("Processing Bound Storage Volume Information failed :", e);
} finally {
if (null != allocatedFromStoragePoolInstances) {
allocatedFromStoragePoolInstances.close();
}
if (null != allocatedFromStoragePoolInstanceChunks) {
try {
client.closeEnumeration(storagePoolPath, allocatedFromStoragePoolInstanceChunks.getContext());
} catch (Exception e) {
_logger.debug("Exception occurred while closing enumeration", e);
}
}
}
}
Aggregations