Search in sources :

Example 16 with StorageSystem

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;
}
Also used : SRDFLinkSyncCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFLinkSyncCompleter) 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)

Example 17 with StorageSystem

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;
}
Also used : SRDFMirrorCreateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFMirrorCreateCompleter) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) 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)

Example 18 with StorageSystem

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;
}
Also used : 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) SRDFTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFTaskCompleter) 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)

Example 19 with StorageSystem

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);
    }
}
Also used : 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) SRDFMirrorRollbackCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFMirrorRollbackCompleter) 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)

Example 20 with StorageSystem

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;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) Mode(com.emc.storageos.volumecontroller.impl.smis.SRDFOperations.Mode) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) StringSet(com.emc.storageos.db.client.model.StringSet) 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)

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