Search in sources :

Example 1 with Mode

use of com.emc.storageos.volumecontroller.impl.smis.SRDFOperations.Mode 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)

Example 2 with Mode

use of com.emc.storageos.volumecontroller.impl.smis.SRDFOperations.Mode in project coprhd-controller by CoprHD.

the class SRDFDeviceController method createCGSRDFVolumes.

protected void createCGSRDFVolumes(Workflow workflow, String waitFor, List<VolumeDescriptor> sourceDescriptors, List<VolumeDescriptor> targetDescriptors, Map<URI, Volume> uriVolumeMap) {
    RemoteDirectorGroup group = getRAGroup(targetDescriptors, uriVolumeMap);
    StorageSystem system = dbClient.queryObject(StorageSystem.class, group.getSourceStorageSystemUri());
    StorageSystem targetSystem = dbClient.queryObject(StorageSystem.class, group.getRemoteStorageSystemUri());
    // finding actual volumes from Provider
    Set<String> volumes = findVolumesPartOfRDFGroups(system, group);
    if (group.getVolumes() == null) {
        group.setVolumes(new StringSet());
    }
    /*
         * Check the following 2 conditions.
         * 1. If there are no volumes in RDFGroup on Array & volumes in RDFGroup in ViPR DB.
         * 2. If there are volumes in RDFGroup on Array & no volumes in RDFGroup in ViPR DB.
         */
    if ((group.getVolumes().isEmpty() && !volumes.isEmpty()) || (!group.getVolumes().isEmpty() && volumes.isEmpty())) {
        // throw Exception rediscover source and target arrays.
        log.warn("RDF Group {} out of sync with Array", group.getNativeGuid());
        List<URI> sourceURIs = VolumeDescriptor.getVolumeURIs(sourceDescriptors);
        List<URI> targetURIs = VolumeDescriptor.getVolumeURIs(targetDescriptors);
        URI vpoolChangeUri = getVirtualPoolChangeVolume(sourceDescriptors);
        for (URI sourceUri : sourceURIs) {
            Volume sourceVolume = dbClient.queryObject(Volume.class, sourceUri);
            if (null != sourceVolume) {
                log.info("Clearing source volume {}-->{}", sourceVolume.getNativeGuid(), sourceVolume.getId());
                if (null == vpoolChangeUri) {
                    // clear everything if not vpool change
                    sourceVolume.setPersonality(NullColumnValueGetter.getNullStr());
                    sourceVolume.setAccessState(Volume.VolumeAccessState.READWRITE.name());
                    sourceVolume.setInactive(true);
                    sourceVolume.setConsistencyGroup(NullColumnValueGetter.getNullURI());
                }
                if (null != sourceVolume.getSrdfTargets()) {
                    sourceVolume.getSrdfTargets().clear();
                }
                dbClient.updateObject(sourceVolume);
            }
        }
        for (URI targetUri : targetURIs) {
            Volume targetVolume = dbClient.queryObject(Volume.class, targetUri);
            if (null != targetVolume) {
                log.info("Clearing target volume {}-->{}", targetVolume.getNativeGuid(), targetVolume.getId());
                targetVolume.setPersonality(NullColumnValueGetter.getNullStr());
                targetVolume.setAccessState(Volume.VolumeAccessState.READWRITE.name());
                targetVolume.setSrdfParent(new NamedURI(NullColumnValueGetter.getNullURI(), NullColumnValueGetter.getNullStr()));
                targetVolume.setSrdfCopyMode(NullColumnValueGetter.getNullStr());
                targetVolume.setSrdfGroup(NullColumnValueGetter.getNullURI());
                targetVolume.setConsistencyGroup(NullColumnValueGetter.getNullURI());
                targetVolume.setInactive(true);
                dbClient.updateObject(targetVolume);
            }
        }
        throw DeviceControllerException.exceptions.srdfAsyncStepCreationfailed(group.getNativeGuid());
    }
    group.getVolumes().replace(volumes);
    dbClient.updateObject(group);
    if (volumes.isEmpty() && SupportedCopyModes.ALL.toString().equalsIgnoreCase(group.getSupportedCopyMode())) {
        log.info("RA Group {} was empty", group.getId());
        waitFor = createSrdfCgPairStepsOnEmptyGroup(sourceDescriptors, targetDescriptors, group, waitFor, workflow);
    } else {
        log.info("RA Group {} not empty", group.getId());
        waitFor = createSrdfCGPairStepsOnPopulatedGroup(sourceDescriptors, group, uriVolumeMap, waitFor, workflow);
    }
    // Generate workflow step to refresh target system after CG creation.
    if (null != system) {
        waitFor = addStepToRefreshSystem(CREATE_SRDF_MIRRORS_STEP_GROUP, system, null, waitFor, workflow);
    }
    if (null != targetSystem) {
        waitFor = addStepToRefreshSystem(CREATE_SRDF_MIRRORS_STEP_GROUP, targetSystem, null, waitFor, workflow);
    }
    // Refresh target volume properties
    Mode SRDFMode = getSRDFMode(sourceDescriptors, uriVolumeMap);
    if (Mode.ACTIVE.equals(SRDFMode)) {
        refreshVolumeProperties(targetDescriptors, targetSystem, waitFor, workflow);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) NamedURI(com.emc.storageos.db.client.model.NamedURI) Mode(com.emc.storageos.volumecontroller.impl.smis.SRDFOperations.Mode) StringSet(com.emc.storageos.db.client.model.StringSet) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) 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 3 with Mode

use of com.emc.storageos.volumecontroller.impl.smis.SRDFOperations.Mode in project coprhd-controller by CoprHD.

the class SRDFDeviceController method createSrdfCGPairStepsOnPopulatedGroup.

private String createSrdfCGPairStepsOnPopulatedGroup(List<VolumeDescriptor> sourceDescriptors, RemoteDirectorGroup group, Map<URI, Volume> uriVolumeMap, String waitFor, Workflow workflow) {
    List<URI> sourceURIs = VolumeDescriptor.getVolumeURIs(sourceDescriptors);
    StorageSystem system = dbClient.queryObject(StorageSystem.class, group.getSourceStorageSystemUri());
    URI vpoolChangeUri = getVirtualPoolChangeVolume(sourceDescriptors);
    log.info("VPoolChange URI {}", vpoolChangeUri);
    String stepId = waitFor;
    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);
    // suspending all the pairs.
    if (Mode.ACTIVE.equals(SRDFMode) && !NullColumnValueGetter.isNullURI(vpoolChangeUri)) {
        /*
             * Invoke Suspend on the SRDF group as more ACTIVE pairs cannot be added until all other
             * existing pairs are in NOT-READY state
             */
        Method suspendGroupMethod = suspendSRDFGroupMethod(system.getId(), group, sourceURIs, targetURIs);
        Method resumeRollbackMethod = resumeSRDFGroupMethod(system.getId(), group, sourceURIs, targetURIs);
        stepId = workflow.createStep(CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_GROUP, SUSPEND_SRDF_MIRRORS_STEP_DESC, waitFor, system.getId(), system.getSystemType(), getClass(), suspendGroupMethod, resumeRollbackMethod, null);
    }
    /*
         * 1. 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));
    stepId = workflow.createStep(CREATE_SRDF_SYNC_VOLUME_PAIR_STEP_GROUP, CREATE_SRDF_SYNC_VOLUME_PAIR_STEP_DESC, stepId, system.getId(), system.getSystemType(), getClass(), createListMethod, rollbackMethod, null);
    /**
     * If R1/R2 has group snap/clone/mirror, add pair to group is not supported unless we provide force flag.
     * Force flag is implemented by default
     * Create new snap/clone/mirror for new R1/R2 volumes,
     * add them to DeviceMaskingGroup (DMG) which is equivalent to its ReplicationGroup (RG)
     * (adding new devices to existing RG is not supported. As a workaround, add them to DMG)
     *
     * Note: This is supported from SMI-S 8.0.3.11 onwards.
     * It will be called from API to create replica objects for new volumes and add them to DMG.
     */
    /*
         * 2. Invoke AddSyncpair with the created StorageSynchronized from Step 1
         */
    Workflow.Method addMethod = addVolumePairsToCgMethod(system.getId(), sourceURIs, group.getId(), vpoolChangeUri);
    Workflow.Method rollbackAddMethod = rollbackAddSyncVolumePairMethod(system.getId(), sourceURIs, targetURIs, false);
    String addVolumestoCgStep = workflow.createStep(CREATE_SRDF_MIRRORS_STEP_GROUP, CREATE_SRDF_MIRRORS_STEP_DESC, stepId, system.getId(), system.getSystemType(), getClass(), addMethod, rollbackAddMethod, null);
    // Resume All the pairs in RDF Group only if its change Virtual Pool operation.
    if (Mode.ACTIVE.equals(SRDFMode) && !NullColumnValueGetter.isNullURI(vpoolChangeUri)) {
        /*
             * Invoke Resume on the SRDF group to get all pairs back in the READY state.
             */
        Method resumeGroupMethod = resumeSRDFGroupMethod(system.getId(), group, sourceURIs, targetURIs);
        return workflow.createStep(CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_GROUP, RESUME_SRDF_MIRRORS_STEP_DESC, addVolumestoCgStep, system.getId(), system.getSystemType(), getClass(), resumeGroupMethod, rollbackMethodNullMethod(), null);
    } else {
        return addVolumestoCgStep;
    }
}
Also used : Method(com.emc.storageos.workflow.Workflow.Method) 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) Workflow(com.emc.storageos.workflow.Workflow) 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 4 with Mode

use of com.emc.storageos.volumecontroller.impl.smis.SRDFOperations.Mode in project coprhd-controller by CoprHD.

the class SRDFDeviceController method createElementReplicaSteps.

private String createElementReplicaSteps(final Workflow workflow, String waitFor, final List<VolumeDescriptor> volumeDescriptors) {
    log.info("START create element replica steps");
    List<VolumeDescriptor> sourceDescriptors = VolumeDescriptor.filterByType(volumeDescriptors, VolumeDescriptor.Type.SRDF_SOURCE, VolumeDescriptor.Type.SRDF_EXISTING_SOURCE);
    List<VolumeDescriptor> targetDescriptors = VolumeDescriptor.filterByType(volumeDescriptors, VolumeDescriptor.Type.SRDF_TARGET);
    Map<URI, Volume> uriVolumeMap = queryVolumes(volumeDescriptors);
    /**
     * Locks that must be acquired before continuing.
     */
    acquireWorkflowLockOrThrow(workflow, generateLocks(volumeDescriptors, uriVolumeMap));
    /**
     * If copy Mode synchronous, then always run createElementReplica, irrespective of
     * whether existing volumes are present in RA Group or not. Consistency parameter
     * doesn't have any effect , hence creating replication groups for each volume
     * doesn't make sense. Moreover, SMI-S has done rigorous testing of
     * Pause,resume,fail over,fail back on StorageSynchronized rather than on Groups.
     */
    boolean volumePartOfCG = isVolumePartOfCG(sourceDescriptors, uriVolumeMap);
    if (!volumePartOfCG) {
        Mode SRDFMode = getSRDFMode(sourceDescriptors, uriVolumeMap);
        if (Mode.ACTIVE.equals(SRDFMode)) {
            createNonCGSRDFActiveModeVolumes(workflow, waitFor, sourceDescriptors, targetDescriptors, uriVolumeMap);
        } else {
            createNonCGSRDFVolumes(workflow, waitFor, sourceDescriptors, uriVolumeMap);
        }
    } else {
        createCGSRDFVolumes(workflow, waitFor, sourceDescriptors, targetDescriptors, uriVolumeMap);
    }
    waitFor = CREATE_SRDF_MIRRORS_STEP_GROUP;
    if (volumePartOfCG && sourceDescriptors.size() > 1) {
        waitFor = updateSourceAndTargetPairings(workflow, waitFor, sourceDescriptors, targetDescriptors, uriVolumeMap);
    }
    return waitFor;
}
Also used : VolumeDescriptor(com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor) Volume(com.emc.storageos.db.client.model.Volume) Mode(com.emc.storageos.volumecontroller.impl.smis.SRDFOperations.Mode) 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)

Aggregations

NamedURI (com.emc.storageos.db.client.model.NamedURI)4 Volume (com.emc.storageos.db.client.model.Volume)4 FCTN_STRING_TO_URI (com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI)4 Mode (com.emc.storageos.volumecontroller.impl.smis.SRDFOperations.Mode)4 URI (java.net.URI)4 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)3 StringSet (com.emc.storageos.db.client.model.StringSet)3 Method (com.emc.storageos.workflow.Workflow.Method)2 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)2 ArrayList (java.util.ArrayList)2 VolumeDescriptor (com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor)1 RemoteDirectorGroup (com.emc.storageos.db.client.model.RemoteDirectorGroup)1 Workflow (com.emc.storageos.workflow.Workflow)1