use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class SRDFDeviceController method deleteAllSrdfVolumesInCG.
/**
* Delete All SRDF Volumes in CG in one attempt.
*
* @param sourcesVolumeMap
* @param workflow
* @param waitFor
* @return
*/
private String deleteAllSrdfVolumesInCG(Map<URI, Volume> sourcesVolumeMap, final Workflow workflow, String waitFor, final List<VolumeDescriptor> sourceDescriptors) {
// TODO Improve this logic
Volume sourceVolume = sourcesVolumeMap.get(sourceDescriptors.get(0).getVolumeURI());
Volume targetVolume = getFirstTarget(sourceVolume);
if (targetVolume == null) {
log.info("No target volume available for source {}", sourceVolume.getId());
return waitFor;
}
RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, targetVolume.getSrdfGroup());
StorageSystem sourceSystem = dbClient.queryObject(StorageSystem.class, group.getSourceStorageSystemUri());
StorageSystem targetSystem = dbClient.queryObject(StorageSystem.class, group.getRemoteStorageSystemUri());
// Suspend all members in the group
Method method = suspendSRDFGroupLinkMethod(targetSystem.getId(), sourceVolume.getId(), targetVolume.getId(), false);
String splitStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, SPLIT_SRDF_MIRRORS_STEP_DESC, waitFor, targetSystem.getId(), targetSystem.getSystemType(), getClass(), method, null, null);
// Second we detach the group...
Workflow.Method detachMethod = detachGroupPairsMethod(targetSystem.getId(), sourceVolume.getId(), targetVolume.getId());
String detachMirrorStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, DETACH_SRDF_MIRRORS_STEP_DESC, splitStep, targetSystem.getId(), targetSystem.getSystemType(), getClass(), detachMethod, null, null);
waitFor = detachMirrorStep;
List<URI> targetVolumeIds = new ArrayList<URI>();
for (Volume source : sourcesVolumeMap.values()) {
StringSet srdfTargets = source.getSrdfTargets();
for (String srdfTarget : srdfTargets) {
log.info("suspend and detach: source:{}, target:{}", source.getId(), srdfTarget);
URI targetURI = URI.create(srdfTarget);
Volume target = dbClient.queryObject(Volume.class, targetURI);
if (null == target) {
log.warn("Target volume {} not available for SRDF source volume {}", source.getId(), targetURI);
return DELETE_SRDF_MIRRORS_STEP_GROUP;
}
log.info("target Volume {} with srdf group {}", target.getNativeGuid(), target.getSrdfGroup());
// Third we remove the device groups, a defensive step to remove
// members from deviceGroups if it exists.
Workflow.Method removeGroupsMethod = removeDeviceGroupsMethod(sourceSystem.getId(), source.getId(), targetURI);
waitFor = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, REMOVE_DEVICE_GROUPS_STEP_DESC, waitFor, sourceSystem.getId(), sourceSystem.getSystemType(), getClass(), removeGroupsMethod, null, null);
}
}
// refresh provider before invoking deleteVolume call
if (null != targetSystem) {
addStepToRefreshSystem(DELETE_SRDF_MIRRORS_STEP_GROUP, targetSystem, targetVolumeIds, waitFor, workflow);
}
return DELETE_SRDF_MIRRORS_STEP_GROUP;
}
use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class SRDFDeviceController method addVolumePairsToCgMethodStep.
public boolean addVolumePairsToCgMethodStep(URI systemURI, List<URI> sourceURIs, URI remoteDirectorGroupURI, URI vpoolChangeUri, String opId) {
log.info("START Add VolumePair to CG");
TaskCompleter completer = null;
try {
WorkflowStepCompleter.stepExecuting(opId);
StorageSystem system = getStorageSystem(systemURI);
completer = new SRDFAddPairToGroupCompleter(sourceURIs, vpoolChangeUri, opId);
getRemoteMirrorDevice().doAddVolumePairsToCg(system, sourceURIs, remoteDirectorGroupURI, 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 suspendSRDFLinkStep.
public boolean suspendSRDFLinkStep(URI systemURI, URI sourceURI, URI targetURI, boolean consExempt, boolean onGroup, String opId) {
log.info("START Suspend SRDF link OnGroup={}", onGroup);
TaskCompleter completer = null;
try {
WorkflowStepCompleter.stepExecuting(opId);
StorageSystem system = getStorageSystem(systemURI);
Volume target = dbClient.queryObject(Volume.class, targetURI);
List<URI> combined = new ArrayList<URI>(Arrays.asList(sourceURI, targetURI));
if (onGroup) {
SRDFUtils.addSRDFCGVolumesForTaskCompleter(sourceURI, dbClient, combined);
}
completer = new SRDFLinkSuspendCompleter(combined, opId);
getRemoteMirrorDevice().doSuspendLink(system, target, consExempt, false, 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 splitSRDFLinkStep.
public boolean splitSRDFLinkStep(URI systemURI, URI sourceURI, URI targetURI, boolean rollback, String opId) {
log.info("START Split SRDF link");
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 SRDFLinkPauseCompleter(combined, opId);
getRemoteMirrorDevice().doSplitLink(system, targetVolume, 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 createSrdfCgPairStepsOnEmptyGroup.
private String createSrdfCgPairStepsOnEmptyGroup(List<VolumeDescriptor> sourceDescriptors, List<VolumeDescriptor> targetDescriptors, RemoteDirectorGroup group, 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 = VolumeDescriptor.getVolumeURIs(targetDescriptors);
Workflow.Method createGroupsMethod = createSrdfCgPairsMethod(system.getId(), sourceURIs, targetURIs, vpoolChangeUri);
Workflow.Method rollbackGroupsMethod = rollbackSRDFLinksMethod(system.getId(), sourceURIs, targetURIs, true, !NullColumnValueGetter.isNullURI(vpoolChangeUri));
return workflow.createStep(CREATE_SRDF_MIRRORS_STEP_GROUP, CREATE_SRDF_MIRRORS_STEP_DESC, waitFor, system.getId(), system.getSystemType(), getClass(), createGroupsMethod, rollbackGroupsMethod, null);
}
Aggregations