Search in sources :

Example 21 with RemoteDirectorGroup

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

the class SRDFUtils method getGroupSynchronized.

public CIMObjectPath getGroupSynchronized(final Volume targetVolume, final StorageSystem sourceSystem) {
    RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, targetVolume.getSrdfGroup());
    CIMObjectPath sourceGroupPath = null;
    CIMObjectPath targetGroupPath = null;
    if (!NullColumnValueGetter.isNotNullValue(group.getSourceReplicationGroupName()) || !NullColumnValueGetter.isNotNullValue(group.getTargetReplicationGroupName())) {
        return null;
    } else {
        sourceGroupPath = cimPath.getReplicationGroupObjectPath(sourceSystem, group.getSourceReplicationGroupName());
        targetGroupPath = cimPath.getReplicationGroupObjectPath(sourceSystem, group.getTargetReplicationGroupName());
    }
    return cimPath.getGroupSynchronized(sourceGroupPath, targetGroupPath);
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup)

Example 22 with RemoteDirectorGroup

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

the class SRDFUtils method getAssociatedTargetRemoteDirectorGroup.

/**
 * Gets the associated target remote director group
 * by forming target RDF group's NativeGuid from source group NativeGuid
 */
public static RemoteDirectorGroup getAssociatedTargetRemoteDirectorGroup(DbClient dbClient, boolean is80Provider, String raGroupId) {
    // interchange source and target ids & group ids
    // 8.0.x NativeGuid format in DB
    // SYMMETRIX+000195700985+REMOTEGROUP+000195700985+60+000195700999+60
    // SYMMETRIX+000195700999+REMOTEGROUP+000195700999+60+000195700985+60
    // 4.6.x NativeGuid format in DB
    // SYMMETRIX+000195701573+REMOTEGROUP+000195701505+60+000195701573+60
    // SYMMETRIX+000195701505+REMOTEGROUP+000195701505+60+000195701573+60
    String targetRaGroupNativeGuid = null;
    StringBuilder strBuilder = new StringBuilder();
    String[] nativeGuidArray = raGroupId.split(Constants.SMIS_PLUS_REGEX);
    String sourceArray = nativeGuidArray[1];
    if (is80Provider) {
        String targetArray = nativeGuidArray[5];
        strBuilder.append(nativeGuidArray[0]).append(Constants.PLUS).append(targetArray).append(Constants.PLUS).append(nativeGuidArray[2]).append(Constants.PLUS).append(targetArray).append(Constants.PLUS).append(nativeGuidArray[6]).append(Constants.PLUS).append(sourceArray).append(Constants.PLUS).append(nativeGuidArray[4]);
    } else {
        String targetArray = null;
        if (nativeGuidArray[3].contains(sourceArray)) {
            targetArray = nativeGuidArray[5];
        } else {
            targetArray = nativeGuidArray[3];
        }
        strBuilder.append(nativeGuidArray[0]).append(Constants.PLUS).append(targetArray).append(Constants.PLUS).append(nativeGuidArray[2]).append(Constants.PLUS).append(nativeGuidArray[3]).append(Constants.PLUS).append(nativeGuidArray[6]).append(Constants.PLUS).append(nativeGuidArray[5]).append(Constants.PLUS).append(nativeGuidArray[4]);
    }
    targetRaGroupNativeGuid = strBuilder.toString();
    log.debug("Target RA Group Id : {}", targetRaGroupNativeGuid);
    RemoteDirectorGroup remoteGroup = getRAGroupFromDB(dbClient, targetRaGroupNativeGuid);
    if (null == remoteGroup) {
        log.warn("Target RA Group {} not found", targetRaGroupNativeGuid);
        return null;
    }
    return remoteGroup;
}
Also used : RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup)

Example 23 with RemoteDirectorGroup

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

the class SRDFUtils method getRAGroupFromDB.

private static RemoteDirectorGroup getRAGroupFromDB(DbClient dbClient, String raGroupNativeGuid) {
    URIQueryResultList raGroupUris = new URIQueryResultList();
    dbClient.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)

Example 24 with RemoteDirectorGroup

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

the class SRDFTargetVolumeRDFGroupMigration method process.

@Override
public void process() throws MigrationCallbackException {
    log.info("Updating SRDF Target volume rdfGroup information.");
    DbClient dbClient = this.getDbClient();
    List<URI> volumeURIs = dbClient.queryByType(Volume.class, true);
    Map<URI, RemoteDirectorGroup> rdfGroupCache = new HashMap<URI, RemoteDirectorGroup>();
    Map<URI, StorageSystem> systemCache = new HashMap<URI, StorageSystem>();
    List<Volume> volumesToUpdate = new ArrayList<Volume>();
    Iterator<Volume> volumes = dbClient.queryIterativeObjects(Volume.class, volumeURIs);
    while (volumes.hasNext()) {
        Volume volume = volumes.next();
        try {
            if (null != volume.getSrdfParent() && !NullColumnValueGetter.isNullNamedURI(volume.getSrdfParent())) {
                if (null != volume.getSrdfGroup() && !NullColumnValueGetter.isNullURI(volume.getSrdfGroup()) && !NullColumnValueGetter.isNullURI(volume.getStorageController())) {
                    log.info("Determining SRDF Target volume {} to update rdf group", volume.getLabel());
                    RemoteDirectorGroup volumeSrdfGroup = fetchRDFGroupFromCache(rdfGroupCache, volume.getSrdfGroup());
                    StorageSystem system = fetchSystemFromCache(systemCache, volume.getStorageController());
                    // Found a target volume with the target SRDFGroup uri
                    if (URIUtil.identical(volumeSrdfGroup.getSourceStorageSystemUri(), volume.getStorageController())) {
                        // Set the source SRDF Group URI
                        RemoteDirectorGroup sourceRDFGroup = getAssociatedTargetRemoteDirectorGroup(system.getUsingSmis80(), volumeSrdfGroup.getNativeGuid());
                        if (null == sourceRDFGroup) {
                            log.info("Source RDFGroup not found in DB. Hence skipping.");
                            continue;
                        }
                        volume.setSrdfGroup(sourceRDFGroup.getId());
                        volumesToUpdate.add(volume);
                        if (volumesToUpdate.size() > 100) {
                            this.dbClient.updateObject(volumesToUpdate);
                            log.info("Updated {} SRDF Target volumes in db", volumesToUpdate.size());
                            volumesToUpdate.clear();
                        }
                    } else {
                        log.info("No need to update the rdfgroup for volume {} as it has the right source RDFGroup {}", volume.getLabel(), volume.getSrdfGroup());
                    }
                }
            }
        } catch (Exception ex) {
            log.error("Exception occurred while updating the SRDFGroup for the target volume {}. proceeding next..", volume.getLabel());
        }
    }
    // Update the remaining volumes
    if (volumesToUpdate.size() > 0) {
        this.dbClient.updateObject(volumesToUpdate);
        log.info("Updated {} SRDF Target volumes in db", volumesToUpdate.size());
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) URI(java.net.URI) MigrationCallbackException(com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException) Volume(com.emc.storageos.db.client.model.Volume) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 25 with RemoteDirectorGroup

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

the class SRDFTargetVolumeRDFGroupMigration method getAssociatedTargetRemoteDirectorGroup.

/**
 * Gets the associated target remote director group
 * by forming target RDF group's NativeGuid from source group NativeGuid
 */
private RemoteDirectorGroup getAssociatedTargetRemoteDirectorGroup(boolean is80Provider, String raGroupId) {
    // interchange source and target ids & group ids
    // 8.0.x NativeGuid format in DB
    // SYMMETRIX+000195700985+REMOTEGROUP+000195700985+60+000195700999+60
    // SYMMETRIX+000195700999+REMOTEGROUP+000195700999+60+000195700985+60
    // 4.6.x NativeGuid format in DB
    // SYMMETRIX+000195701573+REMOTEGROUP+000195701505+60+000195701573+60
    // SYMMETRIX+000195701505+REMOTEGROUP+000195701505+60+000195701573+60
    String targetRaGroupNativeGuid = null;
    StringBuilder strBuilder = new StringBuilder();
    String[] nativeGuidArray = raGroupId.split(SMIS_PLUS_REGEX);
    String sourceArray = nativeGuidArray[1];
    if (is80Provider) {
        String targetArray = nativeGuidArray[5];
        strBuilder.append(nativeGuidArray[0]).append(PLUS).append(targetArray).append(PLUS).append(nativeGuidArray[2]).append(PLUS).append(targetArray).append(PLUS).append(nativeGuidArray[6]).append(PLUS).append(sourceArray).append(PLUS).append(nativeGuidArray[4]);
    } else {
        String targetArray = null;
        if (nativeGuidArray[3].contains(sourceArray)) {
            targetArray = nativeGuidArray[5];
        } else {
            targetArray = nativeGuidArray[3];
        }
        strBuilder.append(nativeGuidArray[0]).append(PLUS).append(targetArray).append(PLUS).append(nativeGuidArray[2]).append(PLUS).append(nativeGuidArray[3]).append(PLUS).append(nativeGuidArray[6]).append(PLUS).append(nativeGuidArray[5]).append(PLUS).append(nativeGuidArray[4]);
    }
    targetRaGroupNativeGuid = strBuilder.toString();
    log.debug("Target RA Group Id : {}", targetRaGroupNativeGuid);
    RemoteDirectorGroup remoteGroup = getRAGroupFromDB(targetRaGroupNativeGuid);
    if (null == remoteGroup) {
        log.warn("Target RA Group {} not found", targetRaGroupNativeGuid);
        return null;
    }
    return remoteGroup;
}
Also used : RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup)

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