use of com.emc.storageos.db.client.model.StringSetMap in project coprhd-controller by CoprHD.
the class DataObjectChangeAnalyzerTest method analyzerTest.
@Test
public void analyzerTest() {
VirtualPool cosa = new VirtualPool();
VirtualPool cosb = new VirtualPool();
cosa.setDriveType("drive-a");
cosb.setDriveType("drive-b");
cosa.setNumPaths(1);
cosb.setNumPaths(2);
Map<String, Change> changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, new String[] {}, new String[] {}, new String[] {});
printChanges(changes);
assertEquals("drive-a", changes.get("driveType")._left);
assertEquals("drive-b", changes.get("driveType")._right);
assertEquals(new Integer(1), changes.get("numPaths")._left);
assertEquals(new Integer(2), changes.get("numPaths")._right);
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, new String[] { "driveType" }, null, null);
printChanges(changes);
assertEquals("drive-a", changes.get("driveType")._left);
assertEquals("drive-b", changes.get("driveType")._right);
assertNull(changes.get("numPaths"));
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, new String[] { "driveType", "numPaths" }, null, null);
printChanges(changes);
assertEquals("drive-a", changes.get("driveType")._left);
assertEquals("drive-b", changes.get("driveType")._right);
assertEquals(new Integer(1), changes.get("numPaths")._left);
assertEquals(new Integer(2), changes.get("numPaths")._right);
cosb.setNumPaths(1);
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, null, new String[] { "driveType" }, null);
assertTrue(changes.isEmpty());
printChanges(changes);
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, new String[] { "numPaths" }, null, null);
assertTrue(changes.isEmpty());
printChanges(changes);
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, new String[] { "driveType" }, null, null);
assertNotNull(changes.get("driveType"));
printChanges(changes);
Set<String> nha = new HashSet<String>();
nha.add("nha");
cosa.addVirtualArrays(nha);
StringSetMap ssMapa = new StringSetMap();
ssMapa.put(VirtualPoolCapabilityValuesWrapper.SYSTEM_TYPE, "systemType");
cosa.addArrayInfoDetails(ssMapa);
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, new String[] {}, new String[] { "driveType" }, null);
assertEquals("nha", changes.get("virtualArrays.nha")._left);
assertNull(changes.get("virtualArrays.nha")._right);
printChanges(changes);
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, new String[] { "virtualArrays" }, null, null);
assertNull(changes.get("driveType"));
assertEquals("nha", changes.get("virtualArrays.nha")._left);
assertNull(changes.get("virtualArrays.nha")._right);
printChanges(changes);
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, new String[] { "virtualArrays", "driveType" }, null, null);
assertEquals("drive-a", changes.get("driveType")._left);
assertEquals("drive-b", changes.get("driveType")._right);
assertEquals("nha", changes.get("virtualArrays.nha")._left);
assertNull(changes.get("virtualArrays.nha")._right);
printChanges(changes);
cosb.addVirtualArrays(nha);
StringSetMap ssMapb = new StringSetMap();
ssMapb.put(VirtualPoolCapabilityValuesWrapper.SYSTEM_TYPE, "systemType");
cosb.addArrayInfoDetails(ssMapb);
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, null, new String[] { "driveType" }, null);
assertTrue(changes.isEmpty());
printChanges(changes);
cosa.setArrayInfo(null);
Set<String> nhb = new HashSet<String>();
nhb.add("nhb");
cosb.addVirtualArrays(nhb);
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, null, new String[] { "driveType" }, null);
assertEquals("nhb", changes.get("virtualArrays.nhb")._right);
assertEquals("[systemType]", changes.get("arrayInfo.system_type")._right.toString());
printChanges(changes);
nha.add("nhb");
cosa.addVirtualArrays(nha);
cosb.setArrayInfo(null);
changes = DataObjectChangeAnalyzer.analyzeChanges(cosa, cosb, null, new String[] { "driveType" }, null);
assertTrue(changes.isEmpty());
printChanges(changes);
}
use of com.emc.storageos.db.client.model.StringSetMap in project coprhd-controller by CoprHD.
the class BlockIngestOrchestrator method markUnManagedVolumeInactive.
/**
* Algorithm:
*
* 1. Get the parent of the Current UMV
* 2. If parent is null AND current UMV doesn't have any replicas, its actually a UMV with no replicas.
* 3. Else run while loop to find out the ROOT of the current's Parent.
* 4. At the end of this while loop, we get the ROOT UMV, ROOT Block Object.
* 5. Invoke RunReplicasIngestedCheck
* a. Get the replicas of the ROOT UMV
* b. Find if all replicas Ingested
* c. If Yes, then update parent Replica Map [Parent --> Child]
* 1. For each Replica unmanaged volume, RUN STEP 5.
* d. Else Clear Parent Replica and come out.
* 6. If parent Replica map is not empty (parent-child ingested successfully)
* a. Set Parent Child relations
* b. Hold the data in Memory and don't persist to DB.
*
* @param unmanagedVolume current Processed UnManaged Volume
* @param blockObject current Processed Block Object
* @param unManagedVolumes
* @param createdObjects Already processed Block Objects in Memory
* @param taskStatusMap
* @param vplexIngestionMethod the VPLEX backend ingestion method
* @return
*/
@SuppressWarnings("deprecation")
protected boolean markUnManagedVolumeInactive(IngestionRequestContext requestContext, BlockObject currentBlockObject) {
UnManagedVolume currentUnmanagedVolume = requestContext.getCurrentUnmanagedVolume();
_logger.info("Running unmanagedvolume {} replica ingestion status", currentUnmanagedVolume.getNativeGuid());
boolean markUnManagedVolumeInactive = false;
// if the vplex ingestion method is vvol-only, we don't need to check replicas
if (VolumeIngestionUtil.isVplexVolume(currentUnmanagedVolume) && VplexBackendIngestionContext.INGESTION_METHOD_VVOL_ONLY.equals(requestContext.getVplexIngestionMethod())) {
_logger.info("This is a VPLEX virtual volume and the ingestion method is " + "virtual volume only. Skipping replica ingestion algorithm.");
return true;
}
StringSetMap unManagedVolumeInformation = currentUnmanagedVolume.getVolumeInformation();
List<String> parentVolumeNativeGUIDs = getParentVolumeNativeGUIDByRepType(unManagedVolumeInformation);
// TODO - may be move this to a single utility method
if (parentVolumeNativeGUIDs.isEmpty() && !VolumeIngestionUtil.checkUnManagedVolumeHasReplicas(currentUnmanagedVolume)) {
_logger.info("Simple unmanagedvolume without any replicas. Skipping replica ingestion algorithm.");
return true;
}
_logger.info("Running algorithm to find the root source volume for {}", currentUnmanagedVolume.getNativeGuid());
// Get the topmost parent object
if (!parentVolumeNativeGUIDs.isEmpty()) {
markUnManagedVolumeInactive = true;
for (String parentVolumeNativeGUID : parentVolumeNativeGUIDs) {
boolean allGood = false;
Map<BlockObject, List<BlockObject>> parentReplicaMap = new HashMap<BlockObject, List<BlockObject>>();
StringSet processedUnManagedGUIDS = new StringSet();
UnManagedVolume rootUnManagedVolume = currentUnmanagedVolume;
BlockObject rootBlockObject = currentBlockObject;
while (parentVolumeNativeGUID != null) {
_logger.info("Finding unmanagedvolume {} in vipr db", parentVolumeNativeGUID);
List<URI> parentUnmanagedUris = _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeInfoNativeIdConstraint(parentVolumeNativeGUID));
if (!parentUnmanagedUris.isEmpty()) {
_logger.info("Found unmanagedvolume {} in vipr db", parentVolumeNativeGUID);
rootUnManagedVolume = _dbClient.queryObject(UnManagedVolume.class, parentUnmanagedUris.get(0));
unManagedVolumeInformation = rootUnManagedVolume.getVolumeInformation();
String blockObjectNativeGUID = rootUnManagedVolume.getNativeGuid().replace(VolumeIngestionUtil.UNMANAGEDVOLUME, VolumeIngestionUtil.VOLUME);
rootBlockObject = requestContext.getRootIngestionRequestContext().findCreatedBlockObject(blockObjectNativeGUID);
// If the root object is not found in locally createdObjects, check in DB.
if (rootBlockObject == null) {
rootBlockObject = VolumeIngestionUtil.getBlockObject(blockObjectNativeGUID, _dbClient);
}
// Get the parent unmanagedvolume for the current unmanagedvolume.
List<String> parents = getParentVolumeNativeGUIDByRepType(unManagedVolumeInformation);
if (parents.isEmpty()) {
parentVolumeNativeGUID = null;
_logger.info("No parent for current unmanagedvolume {}", rootUnManagedVolume.getNativeGuid());
} else {
parentVolumeNativeGUID = parents.get(0);
_logger.info("Found the parent {} for current unmanagedvolume {}", parentVolumeNativeGUID, rootUnManagedVolume.getNativeGuid());
}
// UnManaged Volumes, but the VPLEX device has not.
if ((null == parentVolumeNativeGUID) && VolumeIngestionUtil.isVplexBackendVolume(rootUnManagedVolume)) {
throw IngestionException.exceptions.vplexBackendVolumeHasNoParent(rootUnManagedVolume.getLabel());
}
} else {
_logger.info("unmanagedvolume not found looking for ingested volume {} in vipr db", parentVolumeNativeGUID);
// parent might be already ingested
// Native guid might correspond to ViPR object, find if there is still a unmanaged volume corresponding to the
// parent
parentUnmanagedUris = _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeInfoNativeIdConstraint(parentVolumeNativeGUID.replace(VolumeIngestionUtil.VOLUME, VolumeIngestionUtil.UNMANAGEDVOLUME)));
if (!parentUnmanagedUris.isEmpty()) {
_logger.info("Found ingested volume {} in vipr db", parentVolumeNativeGUID);
rootUnManagedVolume = _dbClient.queryObject(UnManagedVolume.class, parentUnmanagedUris.get(0));
unManagedVolumeInformation = rootUnManagedVolume.getVolumeInformation();
rootBlockObject = VolumeIngestionUtil.getBlockObject(parentVolumeNativeGUID, _dbClient);
List<String> parents = getParentVolumeNativeGUIDByRepType(unManagedVolumeInformation);
if (parents.isEmpty()) {
parentVolumeNativeGUID = null;
} else {
parentVolumeNativeGUID = parents.get(0);
}
_logger.info("Found the parent {} for current unmanagedvolume {}", parentVolumeNativeGUID, rootUnManagedVolume.getNativeGuid());
// UnManaged Volumes, but the VPLEX device has not.
if ((null == parentVolumeNativeGUID) && VolumeIngestionUtil.isVplexBackendVolume(rootUnManagedVolume)) {
throw IngestionException.exceptions.vplexBackendVolumeHasNoParent(rootUnManagedVolume.getLabel());
}
} else {
_logger.info("Found a replica {} whose parent is already ingested with PUBLIC_ACCESS=true", parentVolumeNativeGUID);
// Find the ViPR object and put the block object and the parent in the map and break
List<BlockObject> replicas = new ArrayList<BlockObject>();
replicas.add(rootBlockObject);
parentReplicaMap.put(VolumeIngestionUtil.getBlockObject(parentVolumeNativeGUID.replace(VolumeIngestionUtil.UNMANAGEDVOLUME, VolumeIngestionUtil.VOLUME), _dbClient), replicas);
break;
}
}
}
if (null != rootBlockObject) {
_logger.info("Found root source volume {}", rootBlockObject.getNativeGuid());
}
if (null != rootUnManagedVolume) {
_logger.info("Found root unmanagedvolume {}", rootUnManagedVolume.getNativeGuid());
}
_logger.info("Running algorithm to check all replicas ingested for parent");
runReplicasIngestedCheck(rootUnManagedVolume, rootBlockObject, currentUnmanagedVolume, currentBlockObject, processedUnManagedGUIDS, parentReplicaMap, requestContext);
_logger.info("Ended algorithm to check all replicas ingested for parent");
List<UnManagedVolume> processedUnManagedVolumes = _dbClient.queryObject(UnManagedVolume.class, VolumeIngestionUtil.getUnManagedVolumeUris(processedUnManagedGUIDS, _dbClient));
if (!parentReplicaMap.isEmpty()) {
setupParentReplicaRelationships(currentUnmanagedVolume, parentReplicaMap, requestContext, processedUnManagedVolumes);
allGood = true;
}
if (!allGood) {
markUnManagedVolumeInactive = false;
}
}
} else {
Map<BlockObject, List<BlockObject>> parentReplicaMap = new HashMap<BlockObject, List<BlockObject>>();
StringSet processedUnManagedGUIDS = new StringSet();
UnManagedVolume rootUnManagedVolume = currentUnmanagedVolume;
BlockObject rootBlockObject = currentBlockObject;
if (null != rootBlockObject) {
_logger.info("Found root source volume {}", rootBlockObject.getNativeGuid());
}
if (null != rootUnManagedVolume) {
_logger.info("Found root unmanagedvolume {}", rootUnManagedVolume.getNativeGuid());
}
_logger.info("Running algorithm to check all replicas ingested for parent");
runReplicasIngestedCheck(rootUnManagedVolume, rootBlockObject, currentUnmanagedVolume, currentBlockObject, processedUnManagedGUIDS, parentReplicaMap, requestContext);
_logger.info("Ended algorithm to check all replicas ingested for parent");
List<UnManagedVolume> processedUnManagedVolumes = _dbClient.queryObject(UnManagedVolume.class, VolumeIngestionUtil.getUnManagedVolumeUris(processedUnManagedGUIDS, _dbClient));
if (!parentReplicaMap.isEmpty()) {
setupParentReplicaRelationships(currentUnmanagedVolume, parentReplicaMap, requestContext, processedUnManagedVolumes);
return true;
}
}
return markUnManagedVolumeInactive;
}
use of com.emc.storageos.db.client.model.StringSetMap in project coprhd-controller by CoprHD.
the class BlockIngestOrchestrator method runReplicasIngestedCheck.
/**
* Invoke RunReplicasIngestedCheck
* a. Get the replicas of the ROOT UMV
* b. Find if all replicas Ingested
* c. If Yes, then update parent Replica Map [Parent --> Child]
* d. For each Replica unmanaged volume, RUN STEP 5.
* e. Else Clear Parent Replica and come out.
*
* @param unmanagedVolume
* @param blockObject
* @param processingUnManagedVolume
* @param processingBlockObject
* @param unManagedVolumeGUIDs
* @param parentReplicaMap
* @param requestContext
*/
protected void runReplicasIngestedCheck(UnManagedVolume rootUnmanagedVolume, BlockObject rootBlockObject, UnManagedVolume currentUnManagedVolume, BlockObject currentBlockObject, StringSet unManagedVolumeGUIDs, Map<BlockObject, List<BlockObject>> parentReplicaMap, IngestionRequestContext requestContext) {
if (rootBlockObject == null) {
_logger.warn("parent object {} not ingested yet.", rootUnmanagedVolume.getNativeGuid());
parentReplicaMap.clear();
StringBuffer taskStatus = requestContext.getTaskStatusMap().get(currentUnManagedVolume.getNativeGuid());
if (taskStatus == null) {
taskStatus = new StringBuffer();
requestContext.getTaskStatusMap().put(currentUnManagedVolume.getNativeGuid(), taskStatus);
}
taskStatus.append(String.format("Parent object %s not ingested yet for unmanaged volume %s.", rootUnmanagedVolume.getLabel(), currentUnManagedVolume.getLabel()));
return;
}
boolean traverseTree = true;
String unManagedVolumeNativeGUID = rootUnmanagedVolume.getNativeGuid();
StringSetMap unManagedVolumeInformation = rootUnmanagedVolume.getVolumeInformation();
StringSet unmanagedReplicaGUIDs = new StringSet();
StringSet expectedIngestedReplicas = new StringSet();
List<BlockObject> foundIngestedReplicas = new ArrayList<BlockObject>();
StringSet foundIngestedReplicaNativeGuids = new StringSet();
StringSet mirrors = PropertySetterUtil.extractValuesFromStringSet(SupportedVolumeInformation.MIRRORS.toString(), unManagedVolumeInformation);
if (mirrors != null && !mirrors.isEmpty()) {
unmanagedReplicaGUIDs.addAll(mirrors);
StringSet mirrorGUIDs = VolumeIngestionUtil.getListofVolumeIds(mirrors);
expectedIngestedReplicas.addAll(mirrorGUIDs);
foundIngestedReplicas.addAll(VolumeIngestionUtil.getMirrorObjects(mirrorGUIDs, requestContext, _dbClient));
}
StringSet clones = PropertySetterUtil.extractValuesFromStringSet(SupportedVolumeInformation.FULL_COPIES.toString(), unManagedVolumeInformation);
if (clones != null && !clones.isEmpty()) {
unmanagedReplicaGUIDs.addAll(clones);
StringSet cloneGUIDs = VolumeIngestionUtil.getListofVolumeIds(clones);
expectedIngestedReplicas.addAll(cloneGUIDs);
foundIngestedReplicas.addAll(VolumeIngestionUtil.getVolumeObjects(cloneGUIDs, requestContext, _dbClient));
}
StringSet snaps = PropertySetterUtil.extractValuesFromStringSet(SupportedVolumeInformation.SNAPSHOTS.toString(), unManagedVolumeInformation);
if (snaps != null && !snaps.isEmpty()) {
unmanagedReplicaGUIDs.addAll(snaps);
StringSet snapGUIDs = VolumeIngestionUtil.getListofVolumeIds(snaps);
expectedIngestedReplicas.addAll(snapGUIDs);
foundIngestedReplicas.addAll(VolumeIngestionUtil.getSnapObjects(snapGUIDs, requestContext, _dbClient));
}
StringSet remoteMirrors = PropertySetterUtil.extractValuesFromStringSet(SupportedVolumeInformation.REMOTE_MIRRORS.toString(), unManagedVolumeInformation);
if (remoteMirrors != null && !remoteMirrors.isEmpty()) {
unmanagedReplicaGUIDs.addAll(remoteMirrors);
StringSet remoteMirrorGUIDs = VolumeIngestionUtil.getListofVolumeIds(remoteMirrors);
expectedIngestedReplicas.addAll(remoteMirrorGUIDs);
foundIngestedReplicas.addAll(VolumeIngestionUtil.getVolumeObjects(remoteMirrorGUIDs, requestContext, _dbClient));
}
StringSet vplexBackendVolumes = PropertySetterUtil.extractValuesFromStringSet(SupportedVolumeInformation.VPLEX_BACKEND_VOLUMES.toString(), unManagedVolumeInformation);
StringSet vplexBackendVolumeGUIDs = null;
if (vplexBackendVolumes != null && !vplexBackendVolumes.isEmpty()) {
unmanagedReplicaGUIDs.addAll(vplexBackendVolumes);
vplexBackendVolumeGUIDs = VolumeIngestionUtil.getListofVolumeIds(vplexBackendVolumes);
expectedIngestedReplicas.addAll(vplexBackendVolumeGUIDs);
foundIngestedReplicas.addAll(VolumeIngestionUtil.getVolumeObjects(vplexBackendVolumeGUIDs, requestContext, _dbClient));
}
if (unmanagedReplicaGUIDs.contains(currentUnManagedVolume.getNativeGuid())) {
foundIngestedReplicas.add(currentBlockObject);
}
getFoundIngestedReplicaURIs(foundIngestedReplicas, foundIngestedReplicaNativeGuids);
_logger.info("Expected replicas : {} -->Found replica URIs : {}", expectedIngestedReplicas.size(), foundIngestedReplicaNativeGuids.size());
_logger.info("Expected replicas {} : Found {} : ", Joiner.on(", ").join(expectedIngestedReplicas), Joiner.on(", ").join(foundIngestedReplicaNativeGuids));
if (foundIngestedReplicas.size() == expectedIngestedReplicas.size()) {
if (null != rootBlockObject && !foundIngestedReplicas.isEmpty()) {
parentReplicaMap.put(rootBlockObject, foundIngestedReplicas);
unManagedVolumeGUIDs.add(unManagedVolumeNativeGUID);
unManagedVolumeGUIDs.addAll(unmanagedReplicaGUIDs);
traverseTree = true;
}
} else {
Set<String> unIngestedReplicas = VolumeIngestionUtil.getUnIngestedReplicas(expectedIngestedReplicas, foundIngestedReplicas);
_logger.info("The replicas {} not ingested for volume {}", Joiner.on(", ").join(unIngestedReplicas), unManagedVolumeNativeGUID);
StringBuffer taskStatus = requestContext.getTaskStatusMap().get(currentUnManagedVolume.getNativeGuid());
if (taskStatus == null) {
taskStatus = new StringBuffer();
requestContext.getTaskStatusMap().put(currentUnManagedVolume.getNativeGuid(), taskStatus);
}
// volume guids in the list returned to the user
if (vplexBackendVolumeGUIDs != null) {
_logger.info("removing the subset of vplex backend volume GUIDs from the error message: " + vplexBackendVolumeGUIDs);
// have to convert this because getUningestedReplicas returns an immutable set
Set<String> mutableSet = new HashSet<String>();
mutableSet.addAll(unIngestedReplicas);
mutableSet.removeAll(vplexBackendVolumeGUIDs);
unIngestedReplicas = mutableSet;
}
taskStatus.append(String.format("The umanaged volume %s has been partially ingested, but not all replicas " + "have been ingested. Uningested replicas: %s.", currentUnManagedVolume.getLabel(), Joiner.on(", ").join(unIngestedReplicas)));
// clear the map and stop traversing
parentReplicaMap.clear();
traverseTree = false;
}
if (traverseTree && !unmanagedReplicaGUIDs.isEmpty()) {
// get all the unmanaged volume replicas and traverse through them
List<UnManagedVolume> replicaUnManagedVolumes = _dbClient.queryObject(UnManagedVolume.class, VolumeIngestionUtil.getUnManagedVolumeUris(unmanagedReplicaGUIDs, _dbClient));
for (UnManagedVolume replica : replicaUnManagedVolumes) {
BlockObject replicaBlockObject = null;
if (replica.getNativeGuid().equals(currentUnManagedVolume.getNativeGuid())) {
replicaBlockObject = currentBlockObject;
} else {
_logger.info("Checking for replica object in created object map");
String replicaGUID = replica.getNativeGuid().replace(VolumeIngestionUtil.UNMANAGEDVOLUME, VolumeIngestionUtil.VOLUME);
replicaBlockObject = requestContext.getRootIngestionRequestContext().findCreatedBlockObject(replicaGUID);
if (replicaBlockObject == null) {
_logger.info("Checking if the replica is ingested");
replicaBlockObject = VolumeIngestionUtil.getBlockObject(replicaGUID, _dbClient);
}
}
runReplicasIngestedCheck(replica, replicaBlockObject, currentUnManagedVolume, currentBlockObject, unManagedVolumeGUIDs, parentReplicaMap, requestContext);
// TODO- break out if the parent-replica map is empty
}
}
}
use of com.emc.storageos.db.client.model.StringSetMap in project coprhd-controller by CoprHD.
the class BlockIngestOrchestrator method getAutoTierPolicy.
/**
* Compare unmanaged volume and given virtual pool's Auto Tier Policy are
* same.
*
* @param unManagedVolume
* @param system
* @param vPool
* @return
*/
protected String getAutoTierPolicy(UnManagedVolume unManagedVolume, StorageSystem system, VirtualPool vPool) {
StringSetMap unManagedVolumeInformation = unManagedVolume.getVolumeInformation();
String autoTierPolicyId = null;
// get Policy name
if (null != unManagedVolumeInformation.get(SupportedVolumeInformation.AUTO_TIERING_POLICIES.toString())) {
for (String policyName : unManagedVolumeInformation.get(SupportedVolumeInformation.AUTO_TIERING_POLICIES.toString())) {
autoTierPolicyId = NativeGUIDGenerator.generateAutoTierPolicyNativeGuid(system.getNativeGuid(), policyName, NativeGUIDGenerator.getTieringPolicyKeyForSystem(system));
break;
}
}
if (!DiscoveryUtils.checkVPoolValidForUnManagedVolumeAutoTieringPolicy(vPool, autoTierPolicyId, system)) {
_logger.warn(String.format(UnManagedVolumeService.AUTO_TIERING_NOT_CONFIGURED, new Object[] { unManagedVolume.getId(), autoTierPolicyId, vPool.getAutoTierPolicyName(), vPool.getLabel() }));
return "POLICY_NOT_MATCH";
}
return autoTierPolicyId;
}
use of com.emc.storageos.db.client.model.StringSetMap in project coprhd-controller by CoprHD.
the class BlockRemoteReplicationIngestOrchestrator method validateSourceVolumeVarrayWithTargetVPool.
/**
* Validate the SourceVolume VArray details with ingested target volumes
* VArray.
*
* @param unManagedVolume
* @param VirtualPool
* @return
*/
private void validateSourceVolumeVarrayWithTargetVPool(UnManagedVolume unManagedVolume, VirtualPool sourceVPool) {
StringSetMap unManagedVolumeInformation = unManagedVolume.getVolumeInformation();
// find whether all targets are ingested
StringSet targetUnManagedVolumeGuids = unManagedVolumeInformation.get(SupportedVolumeInformation.REMOTE_MIRRORS.toString());
if (null != targetUnManagedVolumeGuids && !targetUnManagedVolumeGuids.isEmpty()) {
StringSet targetVolumeNativeGuids = VolumeIngestionUtil.getListofVolumeIds(targetUnManagedVolumeGuids);
// check whether target exists
List<URI> targetUris = VolumeIngestionUtil.getVolumeUris(targetVolumeNativeGuids, _dbClient);
if (null == targetUris || targetUris.isEmpty()) {
_logger.info("None of the targets ingested for source volume: {}", unManagedVolume.getNativeGuid());
} else {
List<Volume> targetVolumes = _dbClient.queryObject(Volume.class, targetUris);
for (Volume targetVolume : targetVolumes) {
Map<URI, VpoolRemoteCopyProtectionSettings> settings = sourceVPool.getRemoteProtectionSettings(sourceVPool, _dbClient);
if (null == settings || settings.size() == 0 || !settings.containsKey(targetVolume.getVirtualArray())) {
_logger.info("Target Volume's VArray {} is not matching already ingested source volume virtual pool's remote VArray {}", targetVolume.getVirtualArray(), Joiner.on(",").join(settings.keySet()));
throw IngestionException.exceptions.unmanagedSRDFSourceVolumeVArrayMismatch(unManagedVolume.getLabel(), targetVolume.getVirtualArray().toString());
}
}
}
}
}
Aggregations