Search in sources :

Example 31 with RemoteDirectorGroup

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

the class SRDFUtils method cleanupRDG.

/**
 * Clean up ViPR remote data group associated with the passed in source and target SRDF CGs
 *
 * @param source Source volume
 * @param target Target volume
 * @param dbClient Database handle
 */
public static void cleanupRDG(Volume source, Volume target, DbClient dbClient) {
    RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
    StorageSystem targetSystem = dbClient.queryObject(StorageSystem.class, target.getStorageController());
    if (group.getVolumes() != null) {
        group.getVolumes().remove(source.getNativeGuid());
        group.getVolumes().remove(target.getNativeGuid());
    }
    if (group.getVolumes() == null || group.getVolumes().isEmpty()) {
        // update below items only when we are removing last pair from Group
        if (NullColumnValueGetter.isNotNullValue(group.getSourceReplicationGroupName())) {
            group.setSourceReplicationGroupName(NullColumnValueGetter.getNullStr());
            group.setTargetReplicationGroupName(NullColumnValueGetter.getNullStr());
            group.setSupportedCopyMode(SupportedCopyModes.ALL.toString());
        }
        if (targetSystem.getTargetCgs() != null && !targetSystem.getTargetCgs().isEmpty()) {
            URI cgUri = source.getConsistencyGroup();
            if (cgUri != null) {
                targetSystem.getTargetCgs().remove(cgUri.toString());
                dbClient.updateObject(targetSystem);
            }
        }
    }
    dbClient.updateObject(group);
}
Also used : RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) URI(java.net.URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 32 with RemoteDirectorGroup

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

the class SRDFUtils method getStorageSynchronizationsInRemoteGroup.

public Collection<CIMObjectPath> getStorageSynchronizationsInRemoteGroup(StorageSystem provider, Volume targetVolume) {
    StorageSystem targetSystem = dbClient.queryObject(StorageSystem.class, targetVolume.getStorageController());
    CIMObjectPath objectPath = cimPath.getBlockObjectPath(provider, targetSystem, targetVolume);
    RemoteDirectorGroup rdfGrp = dbClient.queryObject(RemoteDirectorGroup.class, targetVolume.getSrdfGroup());
    CIMObjectPath remoteGroupPath = getRemoteGroupPath(provider, objectPath);
    List<CIMObjectPath> volumePathsInRemoteGroup = getVolumePathsInRemoteGroup(provider, remoteGroupPath);
    List<CIMObjectPath> result = new ArrayList<>();
    for (CIMObjectPath volumePath : volumePathsInRemoteGroup) {
        CIMObjectPath storageSync = getStorageSynchronizationFromVolume(provider, volumePath, rdfGrp);
        result.add(storageSync);
    }
    return result;
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) 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 33 with RemoteDirectorGroup

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

the class SRDFUtils method getRemainingSourceVolumesForAsyncRAGroup.

/**
 * Async Without CG : All SRDF operations will be happen for all volumes available on ra group.
 * Hence we need to change the personalities of the remaining volumes too based on the srdf operation.
 *
 * This method returns the remaing source volumes list available on the ra group which belongs to given source and target volumes.
 *
 * @param sourceVolume
 * @param targetVolume
 * @return
 */
public List<Volume> getRemainingSourceVolumesForAsyncRAGroup(Volume sourceVolume, Volume targetVolume) {
    List<Volume> volumeList = new ArrayList<Volume>();
    if (sourceVolume != null && targetVolume != null && targetVolume.getSrdfGroup() != null) {
        RemoteDirectorGroup rdfGroup = dbClient.queryObject(RemoteDirectorGroup.class, targetVolume.getSrdfGroup());
        if (rdfGroup != null) {
            StringSet volumeNativeGUIdList = rdfGroup.getVolumes();
            log.info("volumeNativeGUIdList : {}", volumeNativeGUIdList);
            if (volumeNativeGUIdList != null) {
                for (String volumeNativeGUId : volumeNativeGUIdList) {
                    log.debug("volume nativeGUId:{}", volumeNativeGUId);
                    URIQueryResultList result = new URIQueryResultList();
                    dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeNativeGuidConstraint(volumeNativeGUId), result);
                    Iterator<URI> volumeIterator = result.iterator();
                    if (volumeIterator.hasNext()) {
                        Volume volume = dbClient.queryObject(Volume.class, volumeIterator.next());
                        if (volume != null && PersonalityTypes.SOURCE.toString().equalsIgnoreCase(volume.getPersonality()) && !volume.getNativeId().equalsIgnoreCase(sourceVolume.getNativeId())) {
                            log.info("Found volume {} in vipr db", volume.getNativeGuid());
                            volumeList.add(volume);
                        }
                    }
                }
            }
        }
    }
    log.info("volume list size {}", volumeList.size());
    return volumeList;
}
Also used : 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) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 34 with RemoteDirectorGroup

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

the class SRDFUtils method removeFromRemoteGroups.

/**
 * Given a target volume, this method acquires both the source and target RemoteDirectorGroup instances
 * in order to remove from it the nativeGuid's of the target and its parent.
 *
 * @param target The target volume to be removed from its RemoteDirectorGroup
 */
public void removeFromRemoteGroups(Volume target) {
    RemoteDirectorGroup tgtGroup = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
    RemoteDirectorGroup srcGroup = getAssociatedRemoteDirectorGroup(tgtGroup);
    Volume source = dbClient.queryObject(Volume.class, target.getSrdfParent().getURI());
    List<String> nativeGuids = newArrayList(source.getNativeGuid(), target.getNativeGuid());
    removeFromRemoteGroup(tgtGroup, nativeGuids);
    if (srcGroup != null) {
        removeFromRemoteGroup(srcGroup, nativeGuids);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup)

Example 35 with RemoteDirectorGroup

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

the class SRDFTargetVolumeRDFGroupMigration method getRAGroupFromDB.

/**
 * Return the RemoteDirectorGroup based on the nativeGuid.
 *
 * @param raGroupNativeGuid
 * @return
 */
private RemoteDirectorGroup getRAGroupFromDB(String raGroupNativeGuid) {
    URIQueryResultList raGroupUris = new URIQueryResultList();
    this.getDbClient().queryByConstraint(AlternateIdConstraint.Factory.getRAGroupByNativeGuidConstraint(raGroupNativeGuid), raGroupUris);
    for (URI raGroupURI : raGroupUris) {
        RemoteDirectorGroup raGroup = dbClient.queryObject(RemoteDirectorGroup.class, raGroupURI);
        if (null != raGroup && !raGroup.getInactive()) {
            return raGroup;
        }
    }
    return null;
}
Also used : RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

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