Search in sources :

Example 51 with RemoteDirectorGroup

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

the class SRDFDeviceController method createNonCGSRDFActiveModeVolumes.

/**
 * This method creates steps to add non CG SRDF Active mode volumes in the RDF group.
 *
 * @param workflow Reference to Workflow
 * @param waitFor String waitFor of previous step, we wait on this to complete
 * @param sourceDescriptors list of source volume descriptors
 * @param targetDescriptors list of target volume descriptors
 * @param uriVolumeMap map of volume URI to volume object
 */
protected void createNonCGSRDFActiveModeVolumes(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> volumesInRDFGroupsOnProvider = findVolumesPartOfRDFGroups(system, group);
    if (group.getVolumes() == null) {
        group.setVolumes(new StringSet());
    }
    if ((group.getVolumes().isEmpty() && !volumesInRDFGroupsOnProvider.isEmpty()) || (!group.getVolumes().isEmpty() && volumesInRDFGroupsOnProvider.isEmpty())) {
        log.info("RDF Group {} in ViPR DB is not sync with the one on the provider. ", group.getNativeGuid());
        clearSourceAndTargetVolumes(sourceDescriptors, targetDescriptors);
        throw DeviceControllerException.exceptions.rdfGroupInViprDBNotInSyncWithArray(group.getNativeGuid());
    }
    if (volumesInRDFGroupsOnProvider.isEmpty() && !SupportedCopyModes.ALL.toString().equalsIgnoreCase(group.getSupportedCopyMode())) {
        log.info("RDF Group {} is empty and supported copy mode is {} ", group.getNativeGuid(), group.getSupportedCopyMode());
        clearSourceAndTargetVolumes(sourceDescriptors, targetDescriptors);
        throw DeviceControllerException.exceptions.rdfGroupInViprDBNotInSyncWithArray(group.getNativeGuid());
    }
    if (!group.getVolumes().isEmpty()) {
        // ViPR Controller should not attempt to suspend them
        try {
            // The below call will return an error if there is a single volume in the group that does not have an associated Volume URI
            List<Volume> volumes = utils.getAssociatedVolumesForSRDFGroup(system, group);
        } catch (Exception e) {
            log.info("RDF Group {} has devices created outside ViPRController", group.getNativeGuid());
            clearSourceAndTargetVolumes(sourceDescriptors, targetDescriptors);
            throw DeviceControllerException.exceptions.rdfGroupHasPairsCreatedOutsideViPR(group.getNativeGuid());
        }
    }
    String createSrdfPairStep = null;
    if (volumesInRDFGroupsOnProvider.isEmpty() && SupportedCopyModes.ALL.toString().equalsIgnoreCase(group.getSupportedCopyMode())) {
        log.info("RA Group {} was empty", group.getId());
        createSrdfPairStep = createNonCGSrdfPairStepsOnEmptyGroup(sourceDescriptors, targetDescriptors, group, uriVolumeMap, waitFor, workflow);
    } else {
        log.info("RA Group {} not empty", group.getId());
        createSrdfPairStep = createNonCGSrdfPairStepsOnPopulatedGroup(sourceDescriptors, targetDescriptors, group, uriVolumeMap, waitFor, workflow);
    }
    // Generate workflow step to refresh source and target system .
    String refreshSourceSystemStep = null;
    if (null != system) {
        refreshSourceSystemStep = addStepToRefreshSystem(CREATE_SRDF_MIRRORS_STEP_GROUP, system, null, createSrdfPairStep, workflow);
    }
    String refreshTargetSystemStep = null;
    if (null != targetSystem) {
        refreshTargetSystemStep = addStepToRefreshSystem(CREATE_SRDF_MIRRORS_STEP_GROUP, targetSystem, null, refreshSourceSystemStep, workflow);
    }
    // Refresh target volume properties
    refreshVolumeProperties(targetDescriptors, targetSystem, refreshTargetSystemStep, workflow);
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) StringSet(com.emc.storageos.db.client.model.StringSet) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) 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 52 with RemoteDirectorGroup

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

the class SRDFDeviceController method generateLocks.

private List<String> generateLocks(List<VolumeDescriptor> volumeDescriptors, Map<URI, Volume> uriVolumeMap) {
    // List of resulting locks
    List<String> locks = new ArrayList<>();
    // Resources for building the locks
    Volume firstTarget = getFirstTarget(volumeDescriptors, uriVolumeMap);
    Volume source = uriVolumeMap.get(firstTarget.getSrdfParent().getURI());
    if (source == null) {
        log.error("Source volume was not found: {}", firstTarget.getSrdfParent().getURI());
        throw DeviceControllerException.exceptions.invalidObjectNull();
    }
    StorageSystem sourceSystem = dbClient.queryObject(StorageSystem.class, source.getStorageController());
    RemoteDirectorGroup rdfGroup = dbClient.queryObject(RemoteDirectorGroup.class, firstTarget.getSrdfGroup());
    // Generate the locks
    locks.add(generateRDFGroupLock(sourceSystem, rdfGroup));
    return locks;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 53 with RemoteDirectorGroup

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

the class SRDFDeviceController method canRemoveSrdfCg.

private boolean canRemoveSrdfCg(Map<URI, Volume> volumeMap) {
    Volume targetVol = null;
    boolean volumePartOfCG = false;
    for (Volume source : volumeMap.values()) {
        volumePartOfCG = null != source.getConsistencyGroup();
        StringSet targets = source.getSrdfTargets();
        if (targets == null) {
            return false;
        }
        for (String target : targets) {
            targetVol = dbClient.queryObject(Volume.class, URI.create(target));
            break;
        }
        break;
    }
    RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, targetVol.getSrdfGroup());
    if (null == group) {
        return true;
    }
    StorageSystem system = getStorageSystem(group.getSourceStorageSystemUri());
    Set<String> volumes = findVolumesPartOfRDFGroups(system, group);
    if (group.getVolumes() == null) {
        group.setVolumes(new StringSet());
    }
    group.getVolumes().replace(volumes);
    log.info("# volumes : {}  in RDF Group {} after refresh", Joiner.on(",").join(group.getVolumes()), group.getNativeGuid());
    dbClient.persistObject(group);
    if (null != volumes && volumes.size() == volumeMap.size() && volumePartOfCG) {
        log.info("Deleting all the volumes {} in CG  in one attempt", Joiner.on(",").join(volumeMap.keySet()));
        return true;
    }
    return false;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) StringSet(com.emc.storageos.db.client.model.StringSet) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

RemoteDirectorGroup (com.emc.storageos.db.client.model.RemoteDirectorGroup)53 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)30 URI (java.net.URI)30 Volume (com.emc.storageos.db.client.model.Volume)23 StringSet (com.emc.storageos.db.client.model.StringSet)16 ArrayList (java.util.ArrayList)15 CIMObjectPath (javax.cim.CIMObjectPath)13 NamedURI (com.emc.storageos.db.client.model.NamedURI)12 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)11 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)10 CIMInstance (javax.cim.CIMInstance)9 FCTN_STRING_TO_URI (com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI)8 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)6 NoSynchronizationsFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.NoSynchronizationsFoundException)6 RemoteGroupAssociationNotFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException)6 Workflow (com.emc.storageos.workflow.Workflow)6 Method (com.emc.storageos.workflow.Workflow.Method)6 CIMArgument (javax.cim.CIMArgument)6 WBEMException (javax.wbem.WBEMException)6 PrefixConstraint (com.emc.storageos.db.client.constraint.PrefixConstraint)5