use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.
the class MetaVolumeMembersProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
CIMObjectPath[] metaMembersPaths = (CIMObjectPath[]) getFromOutputArgs((CIMArgument[]) resultObj, "OutElements");
if (metaMembersPaths == null || (metaMembersPaths.length == 0)) {
_logger.info(String.format("There are no meta members to process"));
} else {
_logger.debug(String.format("Processing meta members: %s", Arrays.toString(metaMembersPaths)));
// Get volume from db
_logger.debug(String.format("Args size: %s", _args.size()));
Object[] arguments = (Object[]) _args.get(0);
CIMArgument theElement = ((CIMArgument[]) arguments[2])[1];
_logger.info(String.format("TheElement: %s, type %s", theElement.getValue().toString(), theElement.getValue().getClass().toString()));
CIMObjectPath theElementPath = (CIMObjectPath) theElement.getValue();
UnManagedVolume preExistingVolume = null;
String isMetaVolume = "true";
String nativeGuid;
// Check if storage volume exists in db (the method is called from re-discovery context).
nativeGuid = getVolumeNativeGuid(theElementPath);
Volume storageVolume = checkStorageVolumeExistsInDB(nativeGuid, dbClient);
if (null == storageVolume || storageVolume.getInactive()) {
// Check if unmanaged volume exists in db (the method is called from unmanaged volumes discovery context).
nativeGuid = getUnManagedVolumeNativeGuidFromVolumePath(theElementPath);
_logger.debug("Volume nativeguid :" + nativeGuid);
preExistingVolume = checkUnManagedVolumeExistsInDB(nativeGuid, dbClient);
if (null == preExistingVolume) {
_logger.debug("Volume Info Object not found :" + nativeGuid);
return;
}
isMetaVolume = preExistingVolume.getVolumeCharacterstics().get(UnManagedVolume.SupportedVolumeCharacterstics.IS_METAVOLUME.toString());
} else {
_logger.debug("Volume managed by Bourne :" + storageVolume.getNativeGuid());
isMetaVolume = storageVolume.getIsComposite().toString();
}
if (isMetaVolume.equalsIgnoreCase("false")) {
_logger.error(String.format("MetaVolumeMembersProcessor called for regular volume: %s", nativeGuid));
return;
}
Integer membersCount = metaMembersPaths.length;
// get meta member size. use second member --- the first member will show size of meta volume itself.
CIMObjectPath metaMemberPath = metaMembersPaths[1];
CIMInstance cimVolume = client.getInstance(metaMemberPath, false, false, META_MEMBER_SIZE_INFO);
CIMProperty consumableBlocks = cimVolume.getProperty(SmisConstants.CP_CONSUMABLE_BLOCKS);
CIMProperty blockSize = cimVolume.getProperty(SmisConstants.CP_BLOCK_SIZE);
// calculate size = consumableBlocks * block size
Long size = Long.valueOf(consumableBlocks.getValue().toString()) * Long.valueOf(blockSize.getValue().toString());
// set meta member count and meta members size for meta volume (required for volume expansion)
if (null != preExistingVolume) {
StringSet metaMembersCount = new StringSet();
metaMembersCount.add(membersCount.toString());
preExistingVolume.putVolumeInfo(UnManagedVolume.SupportedVolumeInformation.META_MEMBER_COUNT.toString(), metaMembersCount);
StringSet metaMemberSize = new StringSet();
metaMemberSize.add(size.toString());
preExistingVolume.putVolumeInfo(UnManagedVolume.SupportedVolumeInformation.META_MEMBER_SIZE.toString(), metaMemberSize);
// persist unmanaged volume in db
dbClient.persistObject(preExistingVolume);
} else {
storageVolume.setMetaMemberCount(membersCount);
storageVolume.setMetaMemberSize(size);
storageVolume.setTotalMetaMemberCapacity(membersCount * size);
// persist volume in db
dbClient.persistObject(storageVolume);
}
_logger.info(String.format("Meta member info: meta member count --- %s, blocks --- %s, block size --- %s, size --- %s .", membersCount, consumableBlocks.getValue().toString(), blockSize.getValue().toString(), size));
}
} catch (Exception e) {
_logger.error("Processing meta volume information failed :", e);
}
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.
the class MetaVolumeTypeProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
CIMObjectPath metaVolumePath = getObjectPathfromCIMArgument(_args);
if (metaVolumePath == null) {
_logger.info(String.format("MetaVolumePath is null."));
} else {
_logger.info(String.format("Processing EMC_Meta for meta volume: %s", metaVolumePath));
UnManagedVolume preExistingVolume = null;
String isMetaVolume = "true";
String nativeGuid;
// Check if storage volume exists in db (the method is called from re-discovery context).
nativeGuid = getVolumeNativeGuid(metaVolumePath);
Volume storageVolume = checkStorageVolumeExistsInDB(nativeGuid, dbClient);
if (null == storageVolume || storageVolume.getInactive()) {
// Check if unmanaged volume exists in db (the method is called from unmanaged volumes discovery context).
nativeGuid = getUnManagedVolumeNativeGuidFromVolumePath(metaVolumePath);
_logger.debug("Meta volume nativeguid :" + nativeGuid);
preExistingVolume = checkUnManagedVolumeExistsInDB(nativeGuid, dbClient);
if (null == preExistingVolume) {
_logger.debug("Volume Info Object not found :" + nativeGuid);
return;
}
isMetaVolume = preExistingVolume.getVolumeCharacterstics().get(UnManagedVolume.SupportedVolumeCharacterstics.IS_METAVOLUME.toString());
} else {
_logger.debug("Volume managed by Bourne :" + storageVolume.getNativeGuid());
isMetaVolume = storageVolume.getIsComposite().toString();
}
if (isMetaVolume.equalsIgnoreCase("false")) {
_logger.error(String.format("MetaVolumeTypeProcessor called for regular volume: %s", nativeGuid));
return;
}
final Iterator<?> it = (Iterator<?>) resultObj;
if (it.hasNext()) {
final CIMObjectPath symmMetaPath = (CIMObjectPath) it.next();
_logger.debug(String.format("Processing EMC_Meta: %s", symmMetaPath));
CIMInstance cimMeta = client.getInstance(symmMetaPath, false, false, STRIPE_EXTENTS_NUMBER);
CIMProperty stripeLengthProperty = cimMeta.getProperty(SmisConstants.CP_EXTENT_STRIPE_LENGTH);
Long stripeLength = Long.valueOf(stripeLengthProperty.getValue().toString());
String metaVolumeType;
if (stripeLength < 1) {
_logger.error(String.format("Stripe length for EMC_Meta is less than 1: %s", stripeLength));
return;
} else if (stripeLength == 1) {
// this is concatenated meta volume
_logger.debug(String.format("Stripe length for EMC_Meta is : %s. Type is concatenated.", stripeLength));
metaVolumeType = Volume.CompositionType.CONCATENATED.toString();
} else {
// this is striped meta volume
_logger.debug(String.format("Stripe length for EMC_Meta is : %s. Type is striped.", stripeLength));
metaVolumeType = Volume.CompositionType.STRIPED.toString();
}
_logger.info(String.format("Meta volume: %s, type: %s", metaVolumePath, metaVolumeType));
if (null == preExistingVolume) {
// storage volume update
storageVolume.setCompositionType(metaVolumeType);
// persist volume in db
dbClient.persistObject(storageVolume);
} else {
// unmanaged volume update
StringSet metaVolumeTypeSet = new StringSet();
metaVolumeTypeSet.add(metaVolumeType);
preExistingVolume.putVolumeInfo(UnManagedVolume.SupportedVolumeInformation.META_VOLUME_TYPE.toString(), metaVolumeTypeSet);
// for this volume.
if (Volume.CompositionType.STRIPED.toString().equalsIgnoreCase(metaVolumeType)) {
URI storageSystemUri = preExistingVolume.getStorageSystemUri();
StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, storageSystemUri);
if (DiscoveredDataObject.Type.vmax.toString().equalsIgnoreCase(storageSystem.getSystemType())) {
_logger.info("Check matched vpool list for vmax striped meta volume and remove fastExpansion vpools.");
StringSet matchedVirtualPools = preExistingVolume.getSupportedVpoolUris();
if (matchedVirtualPools != null && !matchedVirtualPools.isEmpty()) {
_logger.debug("Matched Pools :" + Joiner.on("\t").join(matchedVirtualPools));
StringSet newMatchedPools = new StringSet();
boolean needToReplace = false;
for (String vPoolUriStr : matchedVirtualPools) {
URI vPoolUri = new URI(vPoolUriStr);
VirtualPool virtualPool = dbClient.queryObject(VirtualPool.class, vPoolUri);
// null check since supported vPool list in UnManagedVolume may contain inactive vPool
if (virtualPool != null && !virtualPool.getFastExpansion()) {
newMatchedPools.add(vPoolUriStr);
} else {
needToReplace = true;
}
}
if (needToReplace) {
matchedVirtualPools.replace(newMatchedPools);
_logger.info("Replaced VPools : {}", Joiner.on("\t").join(preExistingVolume.getSupportedVpoolUris()));
}
}
}
}
// persist volume in db
dbClient.updateAndReindexObject(preExistingVolume);
}
}
}
} catch (Exception e) {
_logger.error("Processing meta volume type information failed :", e);
}
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume 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.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume 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);
}
}
}
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.
the class StorageVolumeInfoProcessor method createUnManagedVolume.
/**
* create StorageVolume Info Object
*
* @param unManagedVolume
* @param volumeInstance
* @param unManagedVolumeNativeGuid
* @param pool
* @param system
* @param volumeNativeGuid
* @param exportedVolumes
* @param existingVolumesInCG
* @param volumeToRAGroupMap
* @param volumeToLocalReplicaMap
* @param volumeToSyncAspectMap
* @param poolSupportedSLONames
* @param keyMap
* @param srdfEnabledTargetVPools
* @param duplicateSyncAspectElementNameMap
* @return
*/
private UnManagedVolume createUnManagedVolume(UnManagedVolume unManagedVolume, CIMInstance volumeInstance, String unManagedVolumeNativeGuid, StoragePool pool, StorageSystem system, String volumeNativeGuid, Map<String, VolHostIOObject> exportedVolumes, Set<String> existingVolumesInCG, Map<String, RemoteMirrorObject> volumeToRAGroupMap, Map<String, LocalReplicaObject> volumeToLocalReplicaMap, Map<String, Map<String, String>> volumeToSyncAspectMap, Set<String> poolSupportedSLONames, Map<String, Object> keyMap, Set<URI> srdfEnabledTargetVPools, Map<String, Set<String>> duplicateSyncAspectElementNameMap) {
_logger.info("Create UnManagedVolume {}", unManagedVolumeNativeGuid);
try {
String volumeType = Types.REGULAR.toString();
StringSetMap unManagedVolumeInformation = null;
Map<String, String> unManagedVolumeCharacteristics = null;
boolean created = false;
if (null == unManagedVolume) {
unManagedVolume = new UnManagedVolume();
unManagedVolume.setId(URIUtil.createId(UnManagedVolume.class));
unManagedVolume.setNativeGuid(unManagedVolumeNativeGuid);
unManagedVolume.setStorageSystemUri(system.getId());
created = true;
unManagedVolumeInformation = new StringSetMap();
unManagedVolumeCharacteristics = new HashMap<String, String>();
}
// so that the tiering info is updated correctly later
if (!created) {
unManagedVolumeInformation = unManagedVolume.getVolumeInformation();
unManagedVolumeCharacteristics = unManagedVolume.getVolumeCharacterstics();
if (unManagedVolumeInformation.get(SupportedVolumeInformation.AUTO_TIERING_POLICIES.toString()) != null) {
unManagedVolumeInformation.get(SupportedVolumeInformation.AUTO_TIERING_POLICIES.toString()).clear();
}
unManagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(), "false");
resetLocalReplicaInfo(unManagedVolume);
resetRemoteSourceVolumeInfo(unManagedVolume);
resetRemoteTargetVolumeInfo(unManagedVolume);
}
if (null != system) {
StringSet systemTypes = new StringSet();
systemTypes.add(system.getSystemType());
unManagedVolumeInformation.put(SupportedVolumeInformation.SYSTEM_TYPE.toString(), systemTypes);
}
if (exportedVolumes != null && exportedVolumes.containsKey(volumeNativeGuid)) {
VolHostIOObject obj = exportedVolumes.get(volumeNativeGuid);
if (null != obj) {
StringSet bwValues = new StringSet();
bwValues.add(obj.getHostIoBw());
if (unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString()) == null) {
unManagedVolumeInformation.put(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString(), bwValues);
} else {
unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString()).replace(bwValues);
}
StringSet iopsVal = new StringSet();
iopsVal.add(obj.getHostIops());
if (unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString()) == null) {
unManagedVolumeInformation.put(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString(), iopsVal);
} else {
unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString()).replace(iopsVal);
}
}
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_VOLUME_EXPORTED.toString(), TRUE);
} else {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_VOLUME_EXPORTED.toString(), FALSE);
StringSet bwValues = new StringSet();
bwValues.add("0");
if (unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString()) == null) {
unManagedVolumeInformation.put(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString(), bwValues);
} else {
unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString()).replace(bwValues);
}
StringSet iopsVal = new StringSet();
iopsVal.add("0");
if (unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString()) == null) {
unManagedVolumeInformation.put(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString(), iopsVal);
} else {
unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString()).replace(iopsVal);
}
}
// Set Export Mask HLUs
@SuppressWarnings("unchecked") Map<String, StringSet> volumeToExportMasksHLUMap = (Map<String, StringSet>) keyMap.get(Constants.UN_VOLUME_EXPORT_MASK_HLUS_MAP);
if (volumeToExportMasksHLUMap != null && volumeToExportMasksHLUMap.containsKey(unManagedVolumeNativeGuid)) {
unManagedVolumeInformation.put(SupportedVolumeInformation.HLU_TO_EXPORT_MASK_NAME_MAP.toString(), // replace() does not work
volumeToExportMasksHLUMap.get(unManagedVolumeNativeGuid));
}
// Set SLOName only for VMAX3 exported volumes
if (system.checkIfVmax3()) {
// set for a volume, update the tiering_enabled to false.
if (poolSupportedSLONames == null || poolSupportedSLONames.isEmpty() || !keyMap.containsKey(Constants.VOLUMES_WITH_SLOS)) {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(), Boolean.FALSE.toString());
} else {
Map<String, String> volumesWithSLO = (Map<String, String>) keyMap.get(Constants.VOLUMES_WITH_SLOS);
if (volumesWithSLO.containsKey(volumeNativeGuid)) {
String sloName = volumesWithSLO.get(volumeNativeGuid);
_logger.debug("formattedSLOName: {}", sloName);
updateSLOPolicies(poolSupportedSLONames, unManagedVolumeInformation, unManagedVolumeCharacteristics, sloName);
} else {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(), Boolean.FALSE.toString());
}
}
}
if (existingVolumesInCG != null && existingVolumesInCG.contains(volumeNativeGuid)) {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_VOLUME_ADDED_TO_CONSISTENCYGROUP.toString(), TRUE);
} else {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_VOLUME_ADDED_TO_CONSISTENCYGROUP.toString(), FALSE);
}
// Set the attributes for new smis version.
Object raidLevelObj;
String isNotIngestableReason;
String isBound;
String isThinlyProvisioned;
String isMetaVolume;
String allocCapacity;
if (keyMap.containsKey(Constants.IS_NEW_SMIS_PROVIDER) && Boolean.valueOf(keyMap.get(Constants.IS_NEW_SMIS_PROVIDER).toString())) {
unManagedVolume.setLabel(getCIMPropertyValue(volumeInstance, "ElementName"));
raidLevelObj = volumeInstance.getPropertyValue(SupportedVolumeInformation.RAID_LEVEL.getAlternateKey());
isBound = getCIMPropertyValue(volumeInstance, SupportedVolumeCharacterstics.IS_BOUND.getAlterCharacterstic());
isNotIngestableReason = isVolumeIngestable(volumeInstance, isBound, USAGE, unManagedVolumeNativeGuid, duplicateSyncAspectElementNameMap);
isThinlyProvisioned = getCIMPropertyValue(volumeInstance, THINLY_PROVISIONED);
isMetaVolume = getCIMPropertyValue(volumeInstance, SupportedVolumeCharacterstics.IS_METAVOLUME.getAlterCharacterstic());
allocCapacity = getAllocatedCapacity(volumeInstance, _volumeToSpaceConsumedMap, system.checkIfVmax3());
} else {
unManagedVolume.setLabel(getCIMPropertyValue(volumeInstance, SVELEMENT_NAME));
isBound = getCIMPropertyValue(volumeInstance, SupportedVolumeCharacterstics.IS_BOUND.getCharacterstic());
raidLevelObj = volumeInstance.getPropertyValue(SupportedVolumeInformation.RAID_LEVEL.getInfoKey());
isNotIngestableReason = isVolumeIngestable(volumeInstance, isBound, SVUSAGE, unManagedVolumeNativeGuid, duplicateSyncAspectElementNameMap);
isThinlyProvisioned = getCIMPropertyValue(volumeInstance, EMC_THINLY_PROVISIONED);
isMetaVolume = getCIMPropertyValue(volumeInstance, SupportedVolumeCharacterstics.IS_METAVOLUME.getCharacterstic());
allocCapacity = getCIMPropertyValue(volumeInstance, EMC_ALLOCATED_CAPACITY);
}
if (null != raidLevelObj) {
StringSet raidLevels = new StringSet();
raidLevels.add(raidLevelObj.toString());
unManagedVolumeInformation.put(SupportedVolumeInformation.RAID_LEVEL.toString(), raidLevels);
}
if (null != isBound) {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_BOUND.toString(), isBound);
}
if (null != isThinlyProvisioned) {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_THINLY_PROVISIONED.toString(), isThinlyProvisioned);
}
if (null != isMetaVolume) {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_METAVOLUME.toString(), isMetaVolume);
}
// Volumes which are set EMCIsBound as false cannot be ingested
if (isNotIngestableReason == null) {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_INGESTABLE.toString(), TRUE);
} else {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_INGESTABLE.toString(), FALSE);
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_NOT_INGESTABLE_REASON.toString(), isNotIngestableReason);
}
if (volumeToRAGroupMap.containsKey(unManagedVolume.getNativeGuid())) {
RemoteMirrorObject rmObj = volumeToRAGroupMap.get(unManagedVolume.getNativeGuid());
_logger.info("Found RA Object {}", rmObj.toString());
if (RemoteMirrorObject.Types.SOURCE.toString().equalsIgnoreCase(rmObj.getType())) {
_logger.info("Found Source, updating targets {}", rmObj.getTargetVolumenativeGuids());
// setting target Volumes
if (unManagedVolumeInformation.get(SupportedVolumeInformation.REMOTE_MIRRORS.toString()) == null) {
unManagedVolumeInformation.put(SupportedVolumeInformation.REMOTE_MIRRORS.toString(), rmObj.getTargetVolumenativeGuids());
} else {
if (null == rmObj.getTargetVolumenativeGuids() || rmObj.getTargetVolumenativeGuids().isEmpty()) {
unManagedVolumeInformation.get(SupportedVolumeInformation.REMOTE_MIRRORS.toString()).clear();
} else {
unManagedVolumeInformation.get(SupportedVolumeInformation.REMOTE_MIRRORS.toString()).replace(rmObj.getTargetVolumenativeGuids());
}
}
volumeType = Types.SOURCE.toString();
} else if (RemoteMirrorObject.Types.TARGET.toString().equalsIgnoreCase(rmObj.getType())) {
_logger.info("Found Target {}, updating copyMode {}, RA Group", unManagedVolume.getNativeGuid(), rmObj.getCopyMode());
// setting srdfParent
StringSet parentVolume = new StringSet();
parentVolume.add(rmObj.getSourceVolumeNativeGuid());
unManagedVolumeInformation.put(SupportedVolumeInformation.REMOTE_MIRROR_SOURCE_VOLUME.toString(), parentVolume);
// setting RAGroup
StringSet raGroup = new StringSet();
// set Source array's RA group URI in Target volume
if (rmObj.getTargetRaGroupUri() != null) {
raGroup.add(rmObj.getTargetRaGroupUri().toString());
} else {
_logger.warn("Source Array's RA Group is not populated. Check if Source array is discovered." + " Target: {}", unManagedVolume.getNativeGuid());
}
volumeType = Types.TARGET.toString();
unManagedVolumeInformation.put(SupportedVolumeInformation.REMOTE_MIRROR_RDF_GROUP.toString(), raGroup);
}
// setting Copy Modes
StringSet copyModes = new StringSet();
copyModes.add(rmObj.getCopyMode());
if (unManagedVolumeInformation.get(SupportedVolumeInformation.REMOTE_COPY_MODE.toString()) == null) {
unManagedVolumeInformation.put(SupportedVolumeInformation.REMOTE_COPY_MODE.toString(), copyModes);
} else {
unManagedVolumeInformation.get(SupportedVolumeInformation.REMOTE_COPY_MODE.toString()).replace(copyModes);
}
// setting Volume Type
StringSet remoteVolumeType = new StringSet();
remoteVolumeType.add(rmObj.getType());
unManagedVolumeInformation.put(SupportedVolumeInformation.REMOTE_VOLUME_TYPE.toString(), remoteVolumeType);
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.REMOTE_MIRRORING.toString(), TRUE);
} else {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.REMOTE_MIRRORING.toString(), FALSE);
}
// handle clones, local mirrors and snapshots
boolean isLocalReplica = false;
if (volumeToLocalReplicaMap.containsKey(unManagedVolume.getNativeGuid())) {
_logger.info("Found in localReplicaMap {}", unManagedVolume.getNativeGuid());
LocalReplicaObject lrObj = volumeToLocalReplicaMap.get(unManagedVolume.getNativeGuid());
isLocalReplica = lrObj.isReplica();
// setting targets
StringSet fullCopies = lrObj.getFullCopies();
if (fullCopies != null && !fullCopies.isEmpty()) {
unManagedVolumeInformation.put(SupportedVolumeInformation.FULL_COPIES.name(), fullCopies);
}
StringSet mirrors = lrObj.getMirrors();
if (mirrors != null && !mirrors.isEmpty()) {
unManagedVolumeInformation.put(SupportedVolumeInformation.MIRRORS.name(), mirrors);
}
StringSet snapshots = lrObj.getSnapshots();
if (snapshots != null && !snapshots.isEmpty()) {
unManagedVolumeInformation.put(SupportedVolumeInformation.SNAPSHOTS.name(), snapshots);
}
if (lrObj.hasReplica()) {
// set the HAS_REPLICAS property
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.HAS_REPLICAS.name(), TRUE);
}
if (LocalReplicaObject.Types.FullCopy.equals(lrObj.getType())) {
_logger.info("Found Clone {}", unManagedVolume.getNativeGuid());
// setting clone specific info
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_FULL_COPY.name(), TRUE);
StringSet sourceVolume = new StringSet();
sourceVolume.add(lrObj.getSourceNativeGuid());
unManagedVolumeInformation.put(SupportedVolumeInformation.LOCAL_REPLICA_SOURCE_VOLUME.name(), sourceVolume);
StringSet isSyncActive = new StringSet();
isSyncActive.add(new Boolean(lrObj.isSyncActive()).toString());
unManagedVolumeInformation.put(SupportedVolumeInformation.IS_SYNC_ACTIVE.name(), isSyncActive);
StringSet replicaState = new StringSet();
replicaState.add(lrObj.getReplicaState());
unManagedVolumeInformation.put(SupportedVolumeInformation.REPLICA_STATE.name(), replicaState);
} else if (LocalReplicaObject.Types.BlockMirror.equals(lrObj.getType())) {
_logger.info("Found Local Mirror {}", unManagedVolume.getNativeGuid());
// setting local mirror specific info
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_LOCAL_MIRROR.name(), TRUE);
StringSet sourceVolume = new StringSet();
sourceVolume.add(lrObj.getSourceNativeGuid());
unManagedVolumeInformation.put(SupportedVolumeInformation.LOCAL_REPLICA_SOURCE_VOLUME.name(), sourceVolume);
StringSet syncState = new StringSet();
syncState.add(lrObj.getSyncState());
unManagedVolumeInformation.put(SupportedVolumeInformation.SYNC_STATE.name(), syncState);
StringSet syncType = new StringSet();
syncType.add(lrObj.getSyncType());
unManagedVolumeInformation.put(SupportedVolumeInformation.SYNC_TYPE.name(), syncType);
String syncedInst = lrObj.getSynchronizedInstance();
if (syncedInst != null) {
StringSet synchronizedInstance = new StringSet();
synchronizedInstance.add(syncedInst);
unManagedVolumeInformation.put(SupportedVolumeInformation.SYNCHRONIZED_INSTANCE.name(), synchronizedInstance);
}
} else if (LocalReplicaObject.Types.BlockSnapshot.equals(lrObj.getType())) {
_logger.info("Found Snapshot {}", unManagedVolume.getNativeGuid());
// setting snapshot specific info
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_SNAP_SHOT.name(), TRUE);
StringSet sourceVolume = new StringSet();
sourceVolume.add(lrObj.getSourceNativeGuid());
unManagedVolumeInformation.put(SupportedVolumeInformation.LOCAL_REPLICA_SOURCE_VOLUME.name(), sourceVolume);
StringSet isSyncActive = new StringSet();
isSyncActive.add(new Boolean(lrObj.isSyncActive()).toString());
unManagedVolumeInformation.put(SupportedVolumeInformation.IS_SYNC_ACTIVE.name(), isSyncActive);
StringSet needsCopyToTarget = new StringSet();
needsCopyToTarget.add(new Boolean(lrObj.isNeedsCopyToTarget()).toString());
unManagedVolumeInformation.put(SupportedVolumeInformation.NEEDS_COPY_TO_TARGET.name(), needsCopyToTarget);
StringSet technologyType = new StringSet();
technologyType.add(lrObj.getTechnologyType());
unManagedVolumeInformation.put(SupportedVolumeInformation.TECHNOLOGY_TYPE.name(), technologyType);
String settingsInst = lrObj.getSettingsInstance();
if (settingsInst != null) {
StringSet settingsInstance = new StringSet();
settingsInstance.add(settingsInst);
unManagedVolumeInformation.put(SupportedVolumeInformation.SETTINGS_INSTANCE.name(), settingsInstance);
}
}
}
// Array snapshot sessions for which the volume is the source.
if (volumeToSyncAspectMap.containsKey(unManagedVolume.getNativeGuid())) {
_logger.info("Found in SyncAspectMap {}", unManagedVolume.getNativeGuid());
StringSet syncAspectInfoForForVolume = new StringSet();
Map<String, String> syncAspectMap = volumeToSyncAspectMap.get(unManagedVolume.getNativeGuid());
for (String syncAspectKey : syncAspectMap.keySet()) {
String syncAspectName = syncAspectKey.split(Constants.COLON)[1];
String syncAspectObjPath = syncAspectMap.get(syncAspectKey);
String syncAspectInfo = syncAspectName + Constants.COLON + syncAspectObjPath;
syncAspectInfoForForVolume.add(syncAspectInfo);
}
unManagedVolumeInformation.put(SupportedVolumeInformation.SNAPSHOT_SESSIONS.name(), syncAspectInfoForForVolume);
}
// set volume's isSyncActive
if (!isLocalReplica) {
StringSet isSyncActive = new StringSet();
isSyncActive.add(TRUE);
unManagedVolumeInformation.put(SupportedVolumeInformation.IS_SYNC_ACTIVE.name(), isSyncActive);
}
if (null != pool) {
unManagedVolume.setStoragePoolUri(pool.getId());
StringSet pools = new StringSet();
pools.add(pool.getId().toString());
unManagedVolumeInformation.put(SupportedVolumeInformation.STORAGE_POOL.toString(), pools);
StringSet driveTypes = pool.getSupportedDriveTypes();
if (null != driveTypes) {
unManagedVolumeInformation.put(SupportedVolumeInformation.DISK_TECHNOLOGY.toString(), driveTypes);
}
StringSet matchedVPools = DiscoveryUtils.getMatchedVirtualPoolsForPool(_dbClient, pool.getId(), unManagedVolumeCharacteristics.get(SupportedVolumeCharacterstics.IS_THINLY_PROVISIONED.toString()), srdfEnabledTargetVPools, null, volumeType, unManagedVolume);
_logger.debug("Matched Pools : {}", Joiner.on("\t").join(matchedVPools));
if (null == matchedVPools || matchedVPools.isEmpty()) {
// clear all existing supported vpools.
unManagedVolume.getSupportedVpoolUris().clear();
} else {
// replace with new StringSet
unManagedVolume.getSupportedVpoolUris().replace(matchedVPools);
_logger.info("Replaced Pools :" + Joiner.on("\t").join(unManagedVolume.getSupportedVpoolUris()));
}
}
// set allocated capacity
if (allocCapacity != null) {
StringSet allocCapacitySet = new StringSet();
allocCapacitySet.add(allocCapacity);
unManagedVolumeInformation.put(SupportedVolumeInformation.ALLOCATED_CAPACITY.toString(), allocCapacitySet);
}
StringSet provCapacity = new StringSet();
provCapacity.add(String.valueOf(returnProvisionedCapacity(volumeInstance, keyMap)));
unManagedVolumeInformation.put(SupportedVolumeInformation.PROVISIONED_CAPACITY.toString(), provCapacity);
injectVolumeInformation(unManagedVolume, volumeInstance, unManagedVolumeInformation);
injectVolumeCharacterstics(unManagedVolume, volumeInstance, unManagedVolumeCharacteristics);
unManagedVolume.getUnmanagedExportMasks().clear();
unManagedVolume.getInitiatorUris().clear();
unManagedVolume.getInitiatorNetworkIds().clear();
Object wwn = getCIMPropertyValue(volumeInstance, SmisConstants.CP_WWN_NAME_ALT);
if (null == wwn) {
wwn = getCIMPropertyValue(volumeInstance, SmisConstants.CP_WWN_NAME);
}
unManagedVolume.setWwn(String.valueOf(wwn));
if (created) {
_unManagedVolumesInsert.add(unManagedVolume);
} else {
_unManagedVolumesUpdate.add(unManagedVolume);
}
} catch (Exception e) {
_logger.error("Exception: ", e);
}
return unManagedVolume;
}
Aggregations