use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.
the class RemoteReplicationIngestor method runRemoteReplicationStepsOnPartiallyIngestedVolume.
public static boolean runRemoteReplicationStepsOnPartiallyIngestedVolume(UnManagedVolume unManagedVolume, BlockObject bo, List<UnManagedVolume> unManagedVolumes, DbClient dbClient) {
Volume volume = (Volume) bo;
StringSetMap unManagedVolumeInformation = unManagedVolume.getVolumeInformation();
boolean remoteLinksEstablished = false;
String type = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.REMOTE_VOLUME_TYPE.toString(), unManagedVolumeInformation);
if (null == type) {
return true;
}
if (RemoteMirrorObject.Types.SOURCE.toString().equalsIgnoreCase(type)) {
volume.setPersonality(PersonalityTypes.SOURCE.toString());
remoteLinksEstablished = runRemoteReplicationStepsOnSource(unManagedVolume, volume, unManagedVolumes, type, dbClient);
} else if (RemoteMirrorObject.Types.TARGET.toString().equalsIgnoreCase(type)) {
volume.setPersonality(PersonalityTypes.TARGET.toString());
remoteLinksEstablished = runRemoteReplicationStepsOnTarget(unManagedVolume, volume, unManagedVolumes, type, dbClient);
}
return remoteLinksEstablished;
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.
the class VolumeIngestionUtil method getUnManagedSnaphots.
/**
* Returns a List of UnManagedVolumes that are snapshots of the given
* source UnManagedVolume.
*
* @param unManagedVolume the volume to check for snapshots
* @param dbClient a reference to the database client
*
* @return a List of UnManagedVolumes that are snapshots of the given
* source UnManagedVolume
*/
public static List<UnManagedVolume> getUnManagedSnaphots(UnManagedVolume unManagedVolume, DbClient dbClient) {
List<UnManagedVolume> snapshots = new ArrayList<UnManagedVolume>();
_logger.info("checking for snapshots related to unmanaged volume " + unManagedVolume.getLabel());
if (checkUnManagedVolumeHasReplicas(unManagedVolume)) {
StringSet snapshotNativeIds = PropertySetterUtil.extractValuesFromStringSet(SupportedVolumeInformation.SNAPSHOTS.toString(), unManagedVolume.getVolumeInformation());
List<URI> snapshotUris = new ArrayList<URI>();
if (null != snapshotNativeIds && !snapshotNativeIds.isEmpty()) {
for (String nativeId : snapshotNativeIds) {
_logger.info(" found snapshot native id " + nativeId);
URIQueryResultList unManagedVolumeList = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeInfoNativeIdConstraint(nativeId), unManagedVolumeList);
if (unManagedVolumeList.iterator().hasNext()) {
snapshotUris.add(unManagedVolumeList.iterator().next());
}
}
}
if (!snapshotUris.isEmpty()) {
snapshots = dbClient.queryObject(UnManagedVolume.class, snapshotUris, true);
_logger.info(" returning snapshot objects: " + snapshots);
}
}
return snapshots;
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.
the class VolumeIngestionUtil method getUnManagedVolumeForBlockObject.
/**
* Returns an UnManagedVolume object if the blockObject has an UnManagedVolume.
* Otherwise, returns null;
*
* @param blockObject the block object to check
* @param dbClient a reference to the database client
* @return a UnManagedVolume object
*/
public static UnManagedVolume getUnManagedVolumeForBlockObject(BlockObject blockObject, DbClient dbClient) {
String unmanagedVolumeGUID = blockObject.getNativeGuid().replace(VOLUME, UNMANAGEDVOLUME);
URIQueryResultList umvUriList = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeInfoNativeIdConstraint(unmanagedVolumeGUID), umvUriList);
while (umvUriList.iterator().hasNext()) {
URI umvUri = (umvUriList.iterator().next());
UnManagedVolume umVolume = dbClient.queryObject(UnManagedVolume.class, umvUri);
_logger.info("block object {} is UnManagedVolume {}", blockObject.getLabel(), umVolume.getId());
return umVolume;
}
return null;
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.
the class VolumeIngestionUtil method getRPVolume.
/**
* Gets the RP block object corresponding to the passed in block object.
* The unamanged volume corresponding to the block object is retrieved to determine the RP properties
* because the RP properties might not yet be set in the BlockObject.
*
* If the passed in block object is RP protected, returns back the same block object.
*
* If the passed in block object is a VPLEX backend volume, returns the block object
* corresponding to the VPLEX virtual volume
*
* @param requestContext current unManagedVolume Ingestion context.
* @param blockObject Block object
* @param dbClient dbClient reference
* @return RP protected block object, null if not RP protected.
*/
public static BlockObject getRPVolume(IngestionRequestContext requestContext, BlockObject blockObject, DbClient dbClient) {
UnManagedVolume umVolume = getUnManagedVolumeForBlockObject(blockObject, dbClient);
if (umVolume != null && checkUnManagedResourceIsRecoverPointEnabled(umVolume)) {
return blockObject;
}
// If this is a vplex backend volume, then check if the vplex virtual volume is RP enabled
if (umVolume != null && isVplexBackendVolume(umVolume)) {
String vplexParentVolumeGUID = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.VPLEX_PARENT_VOLUME.toString(), umVolume.getVolumeInformation());
String vplexParentBlockObjectGUID = vplexParentVolumeGUID.replace(VolumeIngestionUtil.UNMANAGEDVOLUME, VolumeIngestionUtil.VOLUME);
BlockObject vplexParentBlockObject = requestContext.findCreatedBlockObject(vplexParentBlockObjectGUID);
if (vplexParentBlockObject == null) {
vplexParentBlockObject = VolumeIngestionUtil.getBlockObject(vplexParentBlockObjectGUID, dbClient);
}
URIQueryResultList unManagedVolumeList = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeInfoNativeIdConstraint(vplexParentVolumeGUID), unManagedVolumeList);
if (unManagedVolumeList.iterator().hasNext()) {
UnManagedVolume umv = dbClient.queryObject(UnManagedVolume.class, unManagedVolumeList.iterator().next());
if (umv != null && checkUnManagedResourceIsRecoverPointEnabled(umv)) {
return vplexParentBlockObject;
}
}
}
return null;
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume in project coprhd-controller by CoprHD.
the class VolumeIngestionUtil method getUnManagedClones.
/**
* Returns a List of UnManagedVolumes that are clones of the given
* source UnManagedVolume.
*
* @param unManagedVolume the volume to check for clones
* @param dbClient a reference to the database client
*
* @return a List of UnManagedVolumes that are clones of the given
* source UnManagedVolume
*/
public static List<UnManagedVolume> getUnManagedClones(UnManagedVolume unManagedVolume, DbClient dbClient) {
List<UnManagedVolume> clones = new ArrayList<UnManagedVolume>();
_logger.info("checking for clones (full copies) related to unmanaged volume " + unManagedVolume.getLabel());
if (checkUnManagedVolumeHasReplicas(unManagedVolume)) {
StringSet cloneNativeIds = PropertySetterUtil.extractValuesFromStringSet(SupportedVolumeInformation.FULL_COPIES.toString(), unManagedVolume.getVolumeInformation());
List<URI> cloneUris = new ArrayList<URI>();
if (null != cloneNativeIds && !cloneNativeIds.isEmpty()) {
for (String nativeId : cloneNativeIds) {
_logger.info(" found clone native id " + nativeId);
URIQueryResultList unManagedVolumeList = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeInfoNativeIdConstraint(nativeId), unManagedVolumeList);
if (unManagedVolumeList.iterator().hasNext()) {
cloneUris.add(unManagedVolumeList.iterator().next());
}
}
}
if (!cloneUris.isEmpty()) {
clones = dbClient.queryObject(UnManagedVolume.class, cloneUris, true);
_logger.info(" returning clone objects: " + clones);
}
}
return clones;
}
Aggregations