Search in sources :

Example 16 with Workflow

use of com.emc.storageos.workflow.Workflow in project coprhd-controller by CoprHD.

the class ImageServerControllerImpl method importImageToServers.

/**
 * Import image to all available imageServer
 *
 * @param task {@link AsyncTask} instance
 */
@Override
public void importImageToServers(AsyncTask task) throws InternalException {
    log.info("importImage");
    URI ciId = task._id;
    boolean wfHasSteps = false;
    Workflow workflow = workflowService.getNewWorkflow(this, IMPORT_IMAGE_WF, true, task._opId);
    TaskCompleter completer = new ComputeImageCompleter(ciId, task._opId, OperationTypeEnum.CREATE_COMPUTE_IMAGE, EVENT_SERVICE_TYPE);
    try {
        List<URI> ids = dbClient.queryByType(ComputeImageServer.class, true);
        for (URI imageServerId : ids) {
            log.info("import to server:" + imageServerId.toString());
            ComputeImageServer imageServer = dbClient.queryObject(ComputeImageServer.class, imageServerId);
            if (imageServer.getComputeImages() == null || !imageServer.getComputeImages().contains(ciId.toString())) {
                log.info("verify Image Server");
                String verifyServerStepId = workflow.createStep(IMAGESERVER_VERIFICATION_STEP, String.format("Verifying ImageServer %s", imageServerId), null, imageServerId, imageServerId.toString(), this.getClass(), new Workflow.Method("verifyComputeImageServer", imageServerId), new Workflow.Method(ROLLBACK_NOTHING_METHOD), null);
                workflow.createStep(IMPORT_IMAGE_TO_SERVER_STEP, String.format("Importing image for %s", imageServerId), verifyServerStepId, imageServerId, imageServerId.toString(), this.getClass(), new Workflow.Method("importImageMethod", ciId, imageServer, null), new Workflow.Method(ROLLBACK_NOTHING_METHOD), null);
                wfHasSteps = true;
            }
        }
        if (wfHasSteps) {
            workflow.executePlan(completer, SUCCESS);
        }
    } catch (Exception e) {
        log.error("importImage caught an exception.", e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        completer.error(dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) ComputeImageCompleter(com.emc.storageos.imageservercontroller.ComputeImageCompleter) ComputeImageServer(com.emc.storageos.db.client.model.ComputeImageServer) Workflow(com.emc.storageos.workflow.Workflow) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) URI(java.net.URI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException) ImageServerControllerException(com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException)

Example 17 with Workflow

use of com.emc.storageos.workflow.Workflow in project coprhd-controller by CoprHD.

the class SRDFDeviceController method expandVolume.

@Override
public void expandVolume(URI storage, URI pool, URI volumeId, Long size, String task) throws InternalException {
    TaskCompleter completer = null;
    Workflow workflow = workflowService.getNewWorkflow(this, "expandVolume", true, task);
    String waitFor = null;
    try {
        Volume source = dbClient.queryObject(Volume.class, volumeId);
        StringSet targets = source.getSrdfTargets();
        List<URI> combined = Lists.newArrayList();
        combined.add(source.getId());
        combined.addAll(transform(targets, FCTN_STRING_TO_URI));
        completer = new SRDFExpandCompleter(combined, task);
        if (null != targets) {
            for (String targetURI : targets) {
                Volume target = dbClient.queryObject(Volume.class, URI.create(targetURI));
                log.info("target Volume {} with srdf group {}", target.getNativeGuid(), target.getSrdfGroup());
                RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
                StorageSystem system = dbClient.queryObject(StorageSystem.class, group.getSourceStorageSystemUri());
                Set<String> volumes = findVolumesPartOfRDFGroups(system, group);
                if (group.getVolumes() == null) {
                    group.setVolumes(new StringSet());
                }
                group.getVolumes().replace(volumes);
                dbClient.persistObject(group);
                if (!source.hasConsistencyGroup()) {
                    // First we suspend the mirror...
                    Workflow.Method suspendMethod = suspendSRDFLinkMethod(system.getId(), source.getId(), target.getId(), true);
                    // TODO Belongs as a rollback for the detach step
                    Workflow.Method rollbackMethod = createSRDFVolumePairMethod(system.getId(), source.getId(), target.getId(), null);
                    String suspendStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, SPLIT_SRDF_MIRRORS_STEP_DESC, waitFor, system.getId(), system.getSystemType(), getClass(), suspendMethod, rollbackMethod, null);
                    // Second we detach the mirror...
                    Workflow.Method detachMethod = detachVolumePairMethod(system.getId(), source.getId(), target.getId());
                    String detachStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, DETACH_SRDF_MIRRORS_STEP_DESC, suspendStep, system.getId(), system.getSystemType(), getClass(), detachMethod, null, null);
                    // Expand the source and target Volumes
                    String expandStep = addExpandBlockVolumeSteps(workflow, detachStep, pool, volumeId, size, task);
                    // resync source and target again
                    createSyncSteps(workflow, expandStep, source, system);
                } else {
                    if (volumes.size() == 1) {
                        // split all members the group
                        Workflow.Method splitMethod = splitSRDFGroupLinkMethod(system.getId(), source.getId(), target.getId(), false);
                        String splitStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, SPLIT_SRDF_MIRRORS_STEP_DESC, waitFor, system.getId(), system.getSystemType(), getClass(), splitMethod, null, null);
                        // Second we detach the group...
                        Workflow.Method detachMethod = detachGroupPairsMethod(system.getId(), source.getId(), target.getId());
                        Workflow.Method resumeMethod = resumeGroupPairsMethod(system.getId(), source.getId(), target.getId());
                        String detachMirrorStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, DETACH_SRDF_MIRRORS_STEP_DESC, splitStep, system.getId(), system.getSystemType(), getClass(), detachMethod, resumeMethod, null);
                        // Expand the source and target Volumes
                        String expandStep = addExpandBlockVolumeSteps(workflow, detachMirrorStep, pool, volumeId, size, task);
                        // re-establish again
                        List<URI> sourceURIs = new ArrayList<URI>();
                        sourceURIs.add(source.getId());
                        List<URI> targetURIs = new ArrayList<URI>();
                        targetURIs.add(target.getId());
                        Workflow.Method createGroupsMethod = createSrdfCgPairsMethod(system.getId(), sourceURIs, targetURIs, null);
                        workflow.createStep(CREATE_SRDF_MIRRORS_STEP_GROUP, CREATE_SRDF_MIRRORS_STEP_DESC, expandStep, system.getId(), system.getSystemType(), getClass(), createGroupsMethod, null, null);
                    } else {
                        // First we remove the sync pair from Async CG...
                        Workflow.Method removeAsyncPairMethod = removePairFromGroup(system.getId(), source.getId(), target.getId(), true);
                        List<URI> sourceUris = new ArrayList<URI>();
                        sourceUris.add(system.getId());
                        String removePairFromGroupWorkflowDesc = String.format(REMOVE_SRDF_PAIR_STEP_DESC, target.getSrdfCopyMode());
                        String detachVolumePairWorkflowDesc = String.format(DETACH_SRDF_PAIR_STEP_DESC, target.getSrdfCopyMode());
                        Workflow.Method addSyncPairMethod = addVolumePairsToCgMethod(system.getId(), sourceUris, group.getId(), null);
                        String removeAsyncPairStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, removePairFromGroupWorkflowDesc, waitFor, system.getId(), system.getSystemType(), getClass(), removeAsyncPairMethod, addSyncPairMethod, null);
                        // split the removed async pair
                        Workflow.Method suspend = suspendSRDFLinkMethod(system.getId(), source.getId(), target.getId(), true);
                        Workflow.Method resumeSyncPairMethod = resumeSyncPairMethod(system.getId(), source.getId(), target.getId());
                        String suspendStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, SPLIT_SRDF_MIRRORS_STEP_DESC, removeAsyncPairStep, system.getId(), system.getSystemType(), getClass(), suspend, resumeSyncPairMethod, null);
                        // Finally we detach the removed async pair...
                        Workflow.Method detachAsyncPairMethod = detachVolumePairMethod(system.getId(), source.getId(), target.getId());
                        Workflow.Method createSyncPairMethod = createSRDFVolumePairMethod(system.getId(), source.getId(), target.getId(), null);
                        String detachStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, detachVolumePairWorkflowDesc, suspendStep, system.getId(), system.getSystemType(), getClass(), detachAsyncPairMethod, createSyncPairMethod, null);
                        // Expand the source and target Volumes
                        String expandStep = addExpandBlockVolumeSteps(workflow, detachStep, pool, volumeId, size, task);
                        // create Relationship again
                        createSrdfCGPairStepsOnPopulatedGroup(source, expandStep, workflow);
                    }
                }
            }
        }
        String successMessage = String.format("Workflow of SRDF Expand Volume %s successfully created", volumeId);
        workflow.executePlan(completer, successMessage);
    } catch (Exception e) {
        log.error("Failed SRDF Expand Volume operation ", e);
        completeAsError(completer, DeviceControllerException.errors.jobFailed(e), task);
    }
}
Also used : SRDFExpandCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFExpandCompleter) Method(com.emc.storageos.workflow.Workflow.Method) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) Workflow(com.emc.storageos.workflow.Workflow) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) LockRetryException(com.emc.storageos.locking.LockRetryException) Volume(com.emc.storageos.db.client.model.Volume) StringSet(com.emc.storageos.db.client.model.StringSet) SRDFChangeCopyModeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFChangeCopyModeTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) NullTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.NullTaskCompleter) SRDFTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFTaskCompleter) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 18 with Workflow

use of com.emc.storageos.workflow.Workflow 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;
}
Also used : Method(com.emc.storageos.workflow.Workflow.Method) Volume(com.emc.storageos.db.client.model.Volume) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) StringSet(com.emc.storageos.db.client.model.StringSet) Workflow(com.emc.storageos.workflow.Workflow) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) Method(com.emc.storageos.workflow.Workflow.Method) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 19 with Workflow

use of com.emc.storageos.workflow.Workflow 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);
}
Also used : Method(com.emc.storageos.workflow.Workflow.Method) Workflow(com.emc.storageos.workflow.Workflow) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 20 with Workflow

use of com.emc.storageos.workflow.Workflow in project coprhd-controller by CoprHD.

the class SRDFDeviceController method addStepsForExpandVolume.

// TODO : JIRA CTRL-5335 SRDF expand needs to go via BlockOrchestrationController. Close this JIRA.
@Override
public String addStepsForExpandVolume(Workflow workflow, String waitFor, List<VolumeDescriptor> descriptors, String task) {
    TaskCompleter completer = null;
    descriptors = VolumeDescriptor.filterByType(descriptors, VolumeDescriptor.Type.SRDF_SOURCE);
    if (descriptors.isEmpty()) {
        return waitFor;
    }
    if (descriptors.size() > 1) {
        throw WorkflowException.exceptions.workflowConstructionError("SRDFDeviceController.addStepsForExpandVolume only supports one source volume");
    }
    VolumeDescriptor descriptor = descriptors.get(0);
    Long size = descriptor.getVolumeSize();
    List<URI> uris = VolumeDescriptor.getVolumeURIs(descriptors);
    URI volumeId = uris.get(0);
    try {
        Volume source = dbClient.queryObject(Volume.class, volumeId);
        StringSet targets = source.getSrdfTargets();
        List<URI> combined = Lists.newArrayList();
        combined.add(source.getId());
        combined.addAll(transform(targets, FCTN_STRING_TO_URI));
        completer = new SRDFExpandCompleter(combined, task);
        if (null != targets) {
            for (String targetURI : targets) {
                Volume target = dbClient.queryObject(Volume.class, URI.create(targetURI));
                log.info("target Volume {} with srdf group {}", target.getNativeGuid(), target.getSrdfGroup());
                RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
                StorageSystem system = dbClient.queryObject(StorageSystem.class, group.getSourceStorageSystemUri());
                Set<String> volumes = findVolumesPartOfRDFGroups(system, group);
                if (group.getVolumes() == null) {
                    group.setVolumes(new StringSet());
                }
                group.getVolumes().replace(volumes);
                dbClient.persistObject(group);
                if (!source.hasConsistencyGroup()) {
                    // First we suspend the mirror...
                    Workflow.Method suspendMethod = suspendSRDFLinkMethod(system.getId(), source.getId(), target.getId(), true);
                    // TODO Belongs as a rollback for the detach step
                    Workflow.Method rollbackMethod = createSRDFVolumePairMethod(system.getId(), source.getId(), target.getId(), null);
                    String suspendStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, SPLIT_SRDF_MIRRORS_STEP_DESC, waitFor, system.getId(), system.getSystemType(), getClass(), suspendMethod, rollbackMethod, null);
                    // Second we detach the mirror...
                    Workflow.Method detachMethod = detachVolumePairMethod(system.getId(), source.getId(), target.getId());
                    String detachStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, DETACH_SRDF_MIRRORS_STEP_DESC, suspendStep, system.getId(), system.getSystemType(), getClass(), detachMethod, null, null);
                    // Expand the source and target Volumes
                    String expandStep = addExpandBlockVolumeSteps(workflow, detachStep, source.getPool(), volumeId, size, task);
                    // resync source and target again
                    waitFor = createSyncSteps(workflow, expandStep, source, system);
                } else {
                    if (volumes.size() == 1) {
                        // split all members the group
                        Workflow.Method splitMethod = splitSRDFGroupLinkMethod(system.getId(), source.getId(), target.getId(), false);
                        String splitStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, SPLIT_SRDF_MIRRORS_STEP_DESC, waitFor, system.getId(), system.getSystemType(), getClass(), splitMethod, null, null);
                        // Second we detach the group...
                        Workflow.Method detachMethod = detachGroupPairsMethod(system.getId(), source.getId(), target.getId());
                        Workflow.Method resumeMethod = resumeGroupPairsMethod(system.getId(), source.getId(), target.getId());
                        String detachMirrorStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, DETACH_SRDF_MIRRORS_STEP_DESC, splitStep, system.getId(), system.getSystemType(), getClass(), detachMethod, resumeMethod, null);
                        // Expand the source and target Volumes
                        String expandStep = addExpandBlockVolumeSteps(workflow, detachMirrorStep, source.getPool(), volumeId, size, task);
                        // re-establish again
                        List<URI> sourceURIs = new ArrayList<URI>();
                        sourceURIs.add(source.getId());
                        List<URI> targetURIs = new ArrayList<URI>();
                        targetURIs.add(target.getId());
                        Workflow.Method createGroupsMethod = createSrdfCgPairsMethod(system.getId(), sourceURIs, targetURIs, null);
                        waitFor = workflow.createStep(CREATE_SRDF_MIRRORS_STEP_GROUP, CREATE_SRDF_MIRRORS_STEP_DESC, expandStep, system.getId(), system.getSystemType(), getClass(), createGroupsMethod, null, null);
                    } else {
                        // First we remove the sync pair from Async CG...
                        Workflow.Method removeAsyncPairMethod = removePairFromGroup(system.getId(), source.getId(), target.getId(), true);
                        List<URI> sourceUris = new ArrayList<URI>();
                        sourceUris.add(system.getId());
                        String removePairFromGroupWorkflowDesc = String.format(REMOVE_SRDF_PAIR_STEP_DESC, target.getSrdfCopyMode());
                        String detachVolumePairWorkflowDesc = String.format(DETACH_SRDF_PAIR_STEP_DESC, target.getSrdfCopyMode());
                        Workflow.Method addSyncPairMethod = addVolumePairsToCgMethod(system.getId(), sourceUris, group.getId(), null);
                        String removeAsyncPairStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, removePairFromGroupWorkflowDesc, waitFor, system.getId(), system.getSystemType(), getClass(), removeAsyncPairMethod, addSyncPairMethod, null);
                        // split the removed async pair
                        Workflow.Method suspend = suspendSRDFLinkMethod(system.getId(), source.getId(), target.getId(), true);
                        Workflow.Method resumeSyncPairMethod = resumeSyncPairMethod(system.getId(), source.getId(), target.getId());
                        String suspendStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, SPLIT_SRDF_MIRRORS_STEP_DESC, removeAsyncPairStep, system.getId(), system.getSystemType(), getClass(), suspend, resumeSyncPairMethod, null);
                        // Finally we detach the removed async pair...
                        Workflow.Method detachAsyncPairMethod = detachVolumePairMethod(system.getId(), source.getId(), target.getId());
                        Workflow.Method createSyncPairMethod = createSRDFVolumePairMethod(system.getId(), source.getId(), target.getId(), null);
                        String detachStep = workflow.createStep(DELETE_SRDF_MIRRORS_STEP_GROUP, detachVolumePairWorkflowDesc, suspendStep, system.getId(), system.getSystemType(), getClass(), detachAsyncPairMethod, createSyncPairMethod, null);
                        // Expand the source and target Volumes
                        String expandStep = addExpandBlockVolumeSteps(workflow, detachStep, source.getPool(), volumeId, size, task);
                        // create Relationship again
                        waitFor = createSrdfCGPairStepsOnPopulatedGroup(source, expandStep, workflow);
                    }
                }
            }
        }
    } catch (Exception e) {
        log.error("Failed SRDF Expand Volume operation ", e);
        completeAsError(completer, DeviceControllerException.errors.jobFailed(e), task);
        throw e;
    }
    return waitFor;
}
Also used : SRDFExpandCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFExpandCompleter) Method(com.emc.storageos.workflow.Workflow.Method) VolumeDescriptor(com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) Workflow(com.emc.storageos.workflow.Workflow) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) LockRetryException(com.emc.storageos.locking.LockRetryException) Volume(com.emc.storageos.db.client.model.Volume) StringSet(com.emc.storageos.db.client.model.StringSet) SRDFChangeCopyModeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFChangeCopyModeTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) NullTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.NullTaskCompleter) SRDFTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFTaskCompleter) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

Workflow (com.emc.storageos.workflow.Workflow)285 URI (java.net.URI)204 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)171 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)127 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)126 ControllerException (com.emc.storageos.volumecontroller.ControllerException)126 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)124 ArrayList (java.util.ArrayList)123 WorkflowException (com.emc.storageos.workflow.WorkflowException)119 NamedURI (com.emc.storageos.db.client.model.NamedURI)102 Volume (com.emc.storageos.db.client.model.Volume)76 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)72 HashMap (java.util.HashMap)66 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)65 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)61 ExportMask (com.emc.storageos.db.client.model.ExportMask)54 ExportTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter)54 List (java.util.List)54 BlockObject (com.emc.storageos.db.client.model.BlockObject)41 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)41