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