use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class SRDFDeviceController method restoreStep.
public boolean restoreStep(final URI systemURI, final URI sourceURI, final URI targetURI, final String opId) {
log.info("START Restore");
TaskCompleter completer = null;
try {
WorkflowStepCompleter.stepExecuting(opId);
StorageSystem system = getStorageSystem(systemURI);
Volume targetVolume = dbClient.queryObject(Volume.class, targetURI);
List<URI> combined = new ArrayList<URI>(Arrays.asList(sourceURI, targetURI));
SRDFUtils.addSRDFCGVolumesForTaskCompleter(sourceURI, dbClient, combined);
completer = new SRDFLinkSyncCompleter(combined, opId);
getRemoteMirrorDevice().doSyncLink(system, targetVolume, completer);
} catch (Exception e) {
return completeAsError(completer, DeviceControllerException.errors.jobFailed(e), opId);
}
return true;
}
use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class SRDFDeviceController method createSrdfCgPairsStep.
public boolean createSrdfCgPairsStep(URI systemURI, List<URI> sourceURIs, List<URI> targetURIs, URI vpoolChangeUri, String opId) {
log.info("START creating SRDF Pairs in CGs");
SRDFMirrorCreateCompleter completer = null;
try {
WorkflowStepCompleter.stepExecuting(opId);
StorageSystem system = getStorageSystem(systemURI);
List<URI> combined = new ArrayList<>(sourceURIs);
combined.addAll(targetURIs);
completer = new SRDFMirrorCreateCompleter(combined, vpoolChangeUri, opId);
InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_078);
getRemoteMirrorDevice().doCreateCgPairs(system, sourceURIs, targetURIs, completer);
InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_079);
// No code after this point.
} catch (Exception e) {
completeAsError(completer, DeviceControllerException.errors.jobFailed(e), opId);
return false;
}
return true;
}
use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class SRDFDeviceController method removePairFromGroup.
public boolean removePairFromGroup(final URI systemURI, final URI sourceURI, final URI targetURI, final boolean rollback, final String opId) {
log.info("START Remove Pair from Group");
TaskCompleter completer = null;
try {
WorkflowStepCompleter.stepExecuting(opId);
StorageSystem system = getStorageSystem(systemURI);
dbClient.queryObject(Volume.class, targetURI);
completer = new SRDFTaskCompleter(sourceURI, targetURI, opId);
getRemoteMirrorDevice().doRemoveVolumePair(system, sourceURI, targetURI, rollback, completer);
} catch (Exception e) {
return completeAsError(completer, DeviceControllerException.errors.jobFailed(e), opId);
}
return true;
}
use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class SRDFDeviceController method rollbackAddSyncVolumePairStep.
public boolean rollbackAddSyncVolumePairStep(final URI systemURI, final List<URI> sourceURIs, final List<URI> targetURIs, final boolean isGroupRollback, final String opId) {
log.info("START rollback srdf volume pair");
TaskCompleter completer = new SRDFMirrorRollbackCompleter(sourceURIs, opId);
try {
StorageSystem system = getStorageSystem(systemURI);
List<Volume> sources = dbClient.queryObject(Volume.class, sourceURIs);
for (Volume source : sources) {
StringSet targets = source.getSrdfTargets();
for (String targetStr : targets) {
URI targetURI = URI.create(targetStr);
if (!targetURIs.contains(targetURI)) {
continue;
}
Volume target = dbClient.queryObject(Volume.class, targetURI);
rollbackAddSyncVolumePair(system, source, target);
}
}
} catch (Exception e) {
log.warn("Error during rollback for adding sync pairs", e);
} finally {
return completeAsReady(completer, opId);
}
}
use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class SRDFDeviceController method createNonCGSrdfPairStepsOnPopulatedGroup.
/**
* This method creates steps to create SRDF pairs in a populated SRDF group.
*
* @param sourceDescriptors list of source volume descriptors
* @param targetDescriptors list of target volume descriptors
* @param group reference to RemoteDirectorGroup
* @param uriVolumeMap map of volume URI to volume object
* @param waitFor String waitFor of previous step, we wait on this to complete
* @param workflow Reference to Workflow
* @return stepId
*/
private String createNonCGSrdfPairStepsOnPopulatedGroup(List<VolumeDescriptor> sourceDescriptors, List<VolumeDescriptor> targetDescriptors, RemoteDirectorGroup group, Map<URI, Volume> uriVolumeMap, String waitFor, Workflow workflow) {
StorageSystem system = dbClient.queryObject(StorageSystem.class, group.getSourceStorageSystemUri());
URI vpoolChangeUri = getVirtualPoolChangeVolume(sourceDescriptors);
log.info("VPoolChange URI {}", vpoolChangeUri);
List<URI> sourceURIs = VolumeDescriptor.getVolumeURIs(sourceDescriptors);
List<URI> targetURIs = new ArrayList<>();
for (URI sourceURI : sourceURIs) {
Volume source = uriVolumeMap.get(sourceURI);
StringSet srdfTargets = source.getSrdfTargets();
for (String targetStr : srdfTargets) {
URI targetURI = URI.create(targetStr);
targetURIs.add(targetURI);
}
}
Mode SRDFMode = getSRDFMode(sourceDescriptors, uriVolumeMap);
/*
* Invoke Suspend on the SRDF group as more ACTIVE pairs cannot added until all other
* existing pairs are in NOT-READY state
*/
// Suspend All the pairs in RDF Group only if its change Virtual Pool operation, the reason being the format flag introduced in Trinity
// would wipe data on the source volumes. Data in source volumes is only possible during change Virtual Pool operations, hence going ahead with
// suspending all the pairs.
String suspendGroupStep = waitFor;
if (Mode.ACTIVE.equals(SRDFMode) && !NullColumnValueGetter.isNullURI(vpoolChangeUri)) {
Method suspendGroupMethod = suspendSRDFGroupMethod(system.getId(), group, sourceURIs, targetURIs);
Method resumeRollbackMethod = resumeSRDFGroupMethod(system.getId(), group, sourceURIs, targetURIs);
suspendGroupStep = workflow.createStep(CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_GROUP, SUSPEND_SRDF_MIRRORS_STEP_DESC, waitFor, system.getId(), system.getSystemType(), getClass(), suspendGroupMethod, resumeRollbackMethod, null);
}
/*
* Invoke CreateListReplica with all source/target pairings.
*/
Method createListMethod = createListReplicasMethod(system.getId(), sourceURIs, targetURIs, vpoolChangeUri, false);
// false here because we want to rollback individual links not the entire (pre-existing) group.
Method rollbackMethod = rollbackSRDFLinksMethod(system.getId(), sourceURIs, targetURIs, false, !NullColumnValueGetter.isNullURI(vpoolChangeUri));
String createListReplicaStep = workflow.createStep(CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_GROUP, CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_DESC, suspendGroupStep, system.getId(), system.getSystemType(), getClass(), createListMethod, rollbackMethod, null);
String resumeGroupStep = createListReplicaStep;
/*
* Invoke Resume on the SRDF group to get all pairs back in the READY state.
*/
if (Mode.ACTIVE.equals(SRDFMode) && !NullColumnValueGetter.isNullURI(vpoolChangeUri)) {
Method resumeGroupMethod = resumeSRDFGroupMethod(system.getId(), group, sourceURIs, targetURIs);
resumeGroupStep = workflow.createStep(CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_GROUP, RESUME_SRDF_MIRRORS_STEP_DESC, createListReplicaStep, system.getId(), system.getSystemType(), getClass(), resumeGroupMethod, rollbackMethodNullMethod(), null);
}
return resumeGroupStep;
}
Aggregations