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);
}
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;
}
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;
}
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());
}
}
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;
}
Aggregations