Search in sources :

Example 6 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class ProtectionOrchestrationDeviceController method performSRDFProtectionOperation.

@Override
public void performSRDFProtectionOperation(URI storageSystemId, Copy copy, String op, String task) {
    StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, storageSystemId);
    // Maps Vplex volume that needs to be flushed to underlying array volume
    Map<Volume, Volume> vplexToArrayVolumesToFlush = getVplexVolumesToBeCacheFlushed(copy, op);
    List<URI> readOnlyVolumes = getVolumesForResume(copy);
    if (!vplexToArrayVolumesToFlush.isEmpty()) {
        executeFlushWorkflow(vplexToArrayVolumesToFlush, storageSystem, copy, op, task);
    } else if (op.equalsIgnoreCase(RESUME) && !readOnlyVolumes.isEmpty()) {
        executeResumeWorkflow(storageSystem, readOnlyVolumes, copy, op, task);
    } else {
        srdfDeviceController.performProtectionOperation(storageSystemId, copy, op, task);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) 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 7 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class NetworkScheduler method getVPlexClusterSerialNumber.

/**
 * For the passed VPLEX port, determines the VPLEX cluster for the port
 * and then returns the serial number for that cluster. Called when
 * configuring the zone name for a VPLEX port.
 *
 * @param port A reference to a VPLEX port.
 * @return The serial number for the port's cluster.
 */
private String getVPlexClusterSerialNumber(StoragePort port) {
    URI systemURI = port.getStorageDevice();
    StorageSystem vplexSystem = _dbClient.queryObject(StorageSystem.class, systemURI);
    String portClusterId = ConnectivityUtil.getVplexClusterOfPort(port);
    return VPlexUtil.getVPlexClusterSerialNumber(portClusterId, vplexSystem);
}
Also used : URI(java.net.URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 8 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem 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 9 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class SRDFDeviceController method resumeSyncPairStep.

public boolean resumeSyncPairStep(final URI systemURI, final URI sourceURI, final URI targetURI, final boolean onGroup, final String opId) {
    log.info("START Resume Sync Pair onGroup={}", onGroup);
    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));
        if (onGroup) {
            SRDFUtils.addSRDFCGVolumesForTaskCompleter(sourceURI, dbClient, combined);
        }
        completer = new SRDFLinkResumeCompleter(combined, opId);
        getRemoteMirrorDevice().doResumeLink(system, targetVolume, false, completer);
    } catch (Exception e) {
        return completeAsError(completer, DeviceControllerException.errors.jobFailed(e), opId);
    }
    return true;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) 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) 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) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) SRDFLinkResumeCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFLinkResumeCompleter)

Example 10 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class SRDFDeviceController method suspendSrdfGroupStep.

/**
 * Method to suspend SRDF group called a workflow step.
 *
 * @param systemURI Reference to storage system URI
 * @param group Reference to RemoteDirectorGroup which represents SRDF group.
 * @param sourceVolumes List of source volumes URI
 * @param targetVolumes List of target volumes URI
 * @param opId The stepId used for completion.
 * @return true if suspend is successful else false
 */
public boolean suspendSrdfGroupStep(final URI systemURI, final RemoteDirectorGroup group, final List<URI> sourceVolumes, final List<URI> targetVolumes, String opId) {
    log.info("START Suspend SRDF group {} for {}", group.getLabel(), systemURI);
    TaskCompleter completer = null;
    try {
        WorkflowStepCompleter.stepExecuting(opId);
        StorageSystem system = getStorageSystem(systemURI);
        List<Volume> volumes = utils.getAssociatedVolumesForSRDFGroup(system, group);
        Collection<Volume> tgtVolumes = newArrayList(filter(volumes, utils.volumePersonalityPredicate(TARGET)));
        if (!tgtVolumes.isEmpty() && tgtVolumes.iterator().hasNext()) {
            List<URI> combinedVolumeList = new ArrayList<URI>();
            combinedVolumeList.addAll(sourceVolumes);
            combinedVolumeList.addAll(targetVolumes);
            completer = new SRDFLinkSuspendCompleter(combinedVolumeList, opId);
            getRemoteMirrorDevice().doSuspendLink(system, tgtVolumes.iterator().next(), false, false, completer);
        } else {
            log.info("There are no more volumes in the SRDF group {} {}, so no need to call suspend.", group.getLabel(), group.getId());
            WorkflowStepCompleter.stepSucceded(opId);
        }
    } catch (Exception e) {
        return completeAsError(completer, DeviceControllerException.errors.jobFailed(e), opId);
    }
    return true;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) SRDFLinkSuspendCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFLinkSuspendCompleter) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) 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) 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) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1088 URI (java.net.URI)581 ArrayList (java.util.ArrayList)424 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)319 Volume (com.emc.storageos.db.client.model.Volume)299 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)272 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)258 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)246 NamedURI (com.emc.storageos.db.client.model.NamedURI)243 WorkflowException (com.emc.storageos.workflow.WorkflowException)233 ControllerException (com.emc.storageos.volumecontroller.ControllerException)231 HashMap (java.util.HashMap)172 StoragePool (com.emc.storageos.db.client.model.StoragePool)159 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)158 StringSet (com.emc.storageos.db.client.model.StringSet)156 URISyntaxException (java.net.URISyntaxException)145 List (java.util.List)139 IOException (java.io.IOException)136 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)127 Workflow (com.emc.storageos.workflow.Workflow)126