use of javax.cim.CIMObjectPath 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 javax.cim.CIMObjectPath 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 javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class StorageVolumeBoundPoolProcessor method processVolumes.
private void processVolumes(CloseableIterator<CIMInstance> allocatedFromStoragePoolInstances, Set<String> volumesList) {
while (allocatedFromStoragePoolInstances.hasNext()) {
CIMInstance allocatedFromStoragePoolInstance = allocatedFromStoragePoolInstances.next();
String boundToThinStoragePool = allocatedFromStoragePoolInstance.getPropertyValue(SmisConstants.EMC_BOUND_TO_THIN_STORAGE_POOL).toString();
if (Boolean.valueOf(boundToThinStoragePool)) {
String volume = allocatedFromStoragePoolInstance.getPropertyValue(SmisConstants.CP_DEPENDENT).toString();
CIMObjectPath volumePath = new CIMObjectPath(volume);
String deviceId = volumePath.getKey(DEVICE_ID).getValue().toString();
volumesList.add(deviceId);
}
}
}
use of javax.cim.CIMObjectPath 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);
}
}
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class StorageVolumeInfoProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
CloseableIterator<CIMInstance> volumeInstances = null;
EnumerateResponse<CIMInstance> volumeInstanceChunks = null;
CIMObjectPath storagePoolPath = null;
WBEMClient client = null;
try {
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
client = SMICommunicationInterface.getCIMClient(keyMap);
_profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
Map<String, VolHostIOObject> exportedVolumes = (Map<String, VolHostIOObject>) keyMap.get(Constants.EXPORTED_VOLUMES);
Set<String> existingVolumesInCG = (Set<String>) keyMap.get(Constants.VOLUMES_PART_OF_CG);
@SuppressWarnings("unchecked") Map<String, RemoteMirrorObject> volumeToRAGroupMap = (Map<String, RemoteMirrorObject>) keyMap.get(Constants.UN_VOLUME_RAGROUP_MAP);
@SuppressWarnings("unchecked") Map<String, LocalReplicaObject> volumeToLocalReplicaMap = (Map<String, LocalReplicaObject>) keyMap.get(Constants.UN_VOLUME_LOCAL_REPLICA_MAP);
@SuppressWarnings("unchecked") Map<String, Map<String, String>> volumeToSyncAspectMap = (Map<String, Map<String, String>>) keyMap.get(Constants.SNAPSHOT_NAMES_SYNCHRONIZATION_ASPECT_MAP);
@SuppressWarnings("unchecked") Map<String, Set<String>> duplicateSyncAspectElementNameMap = (Map<String, Set<String>>) keyMap.get(Constants.DUPLICATE_SYNC_ASPECT_ELEMENT_NAME_MAP);
@SuppressWarnings("unchecked") Map<String, Set<String>> vmax2ThinPoolToBoundVolumesMap = (Map<String, Set<String>>) keyMap.get(Constants.VMAX2_THIN_POOL_TO_BOUND_VOLUMES);
Set<String> boundVolumes = null;
storagePoolPath = getObjectPathfromCIMArgument(_args);
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;
}
StorageSystem system = _dbClient.queryObject(StorageSystem.class, _profile.getSystemId());
_unManagedVolumesInsert = new ArrayList<UnManagedVolume>();
_unManagedVolumesUpdate = new ArrayList<UnManagedVolume>();
_unManagedExportMasksUpdate = new ArrayList<UnManagedExportMask>();
// get bound volumes list for VMAX2 Thin pools
boundVolumes = vmax2ThinPoolToBoundVolumesMap.get(storagePoolPath.toString());
Set<String> poolSupportedSLONames = (Set<String>) keyMap.get(poolNativeGuid);
_logger.debug("Pool Supporting SLO Names:{}", poolSupportedSLONames);
_metaVolumeViewPaths = (List<CIMObjectPath>) keyMap.get(Constants.META_VOLUMES_VIEWS);
if (_metaVolumeViewPaths == null) {
_metaVolumeViewPaths = new ArrayList<CIMObjectPath>();
keyMap.put(Constants.META_VOLUMES_VIEWS, _metaVolumeViewPaths);
}
// create empty place holder list for meta volume paths (cannot
// define this in xml)
_metaVolumePaths = (List<CIMObjectPath>) keyMap.get(Constants.META_VOLUMES);
if (_metaVolumePaths == null) {
_metaVolumePaths = new ArrayList<CIMObjectPath>();
keyMap.put(Constants.META_VOLUMES, _metaVolumePaths);
}
_volumeToSpaceConsumedMap = (Map<String, String>) keyMap.get(Constants.VOLUME_SPACE_CONSUMED_MAP);
// get VolumeInfo Object and inject Fast Policy Name.
volumeInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
volumeInstances = volumeInstanceChunks.getResponses();
Set<URI> srdfEnabledTargetVPools = SRDFUtils.fetchSRDFTargetVirtualPools(_dbClient);
processVolumes(volumeInstances, keyMap, operation, pool, system, exportedVolumes, existingVolumesInCG, volumeToRAGroupMap, volumeToLocalReplicaMap, volumeToSyncAspectMap, poolSupportedSLONames, boundVolumes, srdfEnabledTargetVPools, duplicateSyncAspectElementNameMap);
while (!volumeInstanceChunks.isEnd()) {
_logger.info("Processing Next Volume Chunk of size {}", BATCH_SIZE);
volumeInstanceChunks = client.getInstancesWithPath(storagePoolPath, volumeInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
processVolumes(volumeInstanceChunks.getResponses(), keyMap, operation, pool, system, exportedVolumes, existingVolumesInCG, volumeToRAGroupMap, volumeToLocalReplicaMap, volumeToSyncAspectMap, poolSupportedSLONames, boundVolumes, srdfEnabledTargetVPools, duplicateSyncAspectElementNameMap);
}
if (null != _unManagedVolumesUpdate && !_unManagedVolumesUpdate.isEmpty()) {
_partitionManager.updateAndReIndexInBatches(_unManagedVolumesUpdate, getPartitionSize(keyMap), _dbClient, UNMANAGED_VOLUME);
}
if (null != _unManagedVolumesInsert && !_unManagedVolumesInsert.isEmpty()) {
_partitionManager.insertInBatches(_unManagedVolumesInsert, getPartitionSize(keyMap), _dbClient, UNMANAGED_VOLUME);
}
if (null != _unManagedExportMasksUpdate && !_unManagedExportMasksUpdate.isEmpty()) {
_partitionManager.updateAndReIndexInBatches(_unManagedExportMasksUpdate, getPartitionSize(keyMap), _dbClient, UNMANAGED_EXPORT_MASK);
}
performStorageUnManagedVolumeBookKeeping(pool.getId());
} catch (Exception e) {
_logger.error("Processing Storage Volume Information failed :", e);
} finally {
_unManagedVolumesInsert = null;
_unManagedVolumesUpdate = null;
if (null != volumeInstances) {
volumeInstances.close();
}
if (null != volumeInstanceChunks) {
try {
client.closeEnumeration(storagePoolPath, volumeInstanceChunks.getContext());
} catch (Exception e) {
_logger.debug("Exception occurred while closing enumeration", e);
}
}
}
}
Aggregations