use of com.emc.storageos.workflow.Workflow.Method 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;
}
use of com.emc.storageos.workflow.Workflow.Method 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.workflow.Workflow.Method in project coprhd-controller by CoprHD.
the class SRDFDeviceController method createNonCGSrdfPairStepsOnEmptyGroup.
/**
* This method creates steps to create SRDF pairs in an empty 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 createNonCGSrdfPairStepsOnEmptyGroup(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);
}
}
/*
* Invoke CreateListReplica with all source/target pairings.
*/
Method createListMethod = createListReplicasMethod(system.getId(), sourceURIs, targetURIs, vpoolChangeUri, true);
// false here because we want to rollback individual links not the entire (pre-existing) group.
Method rollbackMethod = rollbackSRDFLinksMethod(system.getId(), sourceURIs, targetURIs, false, vpoolChangeUri != null);
String stepId = workflow.createStep(CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_GROUP, CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_DESC, waitFor, system.getId(), system.getSystemType(), getClass(), createListMethod, rollbackMethod, null);
return stepId;
}
use of com.emc.storageos.workflow.Workflow.Method in project coprhd-controller by CoprHD.
the class SRDFDeviceController method addRollbackStepsForRefreshSystems.
/**
* Add rollback steps for refreshing the target providers. Currently, for SRDF workflow steps
* we always try to use the active source provider, so here we will filter only the target descriptors
* in order to determine their provider, which most likely has gotten out of sync.
*
* @param workflow The workflow instance.
* @param waitFor Step ID to wait on until complete.
* @param srdfDescriptors All SRDF descriptors.
* @return Step ID.
*/
private String addRollbackStepsForRefreshSystems(Workflow workflow, String waitFor, List<VolumeDescriptor> srdfDescriptors) {
List<VolumeDescriptor> targetDescriptors = VolumeDescriptor.filterByType(srdfDescriptors, VolumeDescriptor.Type.SRDF_TARGET);
if (targetDescriptors.isEmpty()) {
return waitFor;
}
URI targetSystem = targetDescriptors.get(0).getDeviceURI();
StorageSystem tgt = dbClient.queryObject(StorageSystem.class, targetSystem);
Workflow.Method refreshTargetSystemsMethod = new Method(REFRESH_SRDF_TARGET_SYSTEM, tgt, null);
workflow.createStep(ROLLBACK_REFRESH_SYSTEM_STEP_GROUP, String.format(ROLLBACK_REFRESH_SYSTEM_STEP_DESC, tgt.getSerialNumber()), waitFor, tgt.getId(), tgt.getSystemType(), this.getClass(), rollbackMethodNullMethod(), refreshTargetSystemsMethod, null);
return ROLLBACK_REFRESH_SYSTEM_STEP_GROUP;
}
use of com.emc.storageos.workflow.Workflow.Method in project coprhd-controller by CoprHD.
the class SRDFDeviceController method updateSourceAndTargetPairings.
private String updateSourceAndTargetPairings(Workflow workflow, String waitFor, List<VolumeDescriptor> sourceDescriptors, List<VolumeDescriptor> targetDescriptors, Map<URI, Volume> uriVolumeMap) {
log.info("Creating step to update source and target pairings");
List<URI> sourceURIs = VolumeDescriptor.getVolumeURIs(sourceDescriptors);
List<URI> targetURIs = VolumeDescriptor.getVolumeURIs(targetDescriptors);
Volume firstSource = dbClient.queryObject(Volume.class, sourceURIs.get(0));
StorageSystem sourceSystem = dbClient.queryObject(StorageSystem.class, firstSource.getStorageController());
Method method = updateSourceAndTargetPairingsMethod(sourceURIs, targetURIs);
workflow.createStep(UPDATE_SRDF_PAIRING_STEP_GROUP, UPDATE_SRDF_PAIRING_STEP_GROUP, waitFor, sourceSystem.getId(), sourceSystem.getSystemType(), getClass(), method, rollbackMethodNullMethod(), null);
return UPDATE_SRDF_PAIRING_STEP_GROUP;
}
Aggregations