use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class SmisCommandHelper method getBlockObjectNativeIds.
/**
* This method will loop through the URI list and return a list of nativeIds for each of the
* BlockObject objects to which the URI applies.
*
* @param uris
* - Collection of URIs
* @return Returns a list of nativeId String values
* @throws DeviceControllerException.exceptions.notAVolumeOrBlocksnapshotUri
* f URI is not a Volume/BlockSnapshot URI
*/
public String[] getBlockObjectNativeIds(Collection<URI> uris) throws Exception {
String[] results = {};
Set<String> nativeIds = new HashSet<String>();
for (URI uri : uris) {
String nativeId;
if (URIUtil.isType(uri, Volume.class)) {
Volume volume = _dbClient.queryObject(Volume.class, uri);
nativeId = volume.getNativeId();
} else if (URIUtil.isType(uri, BlockSnapshot.class)) {
BlockSnapshot blockSnapshot = _dbClient.queryObject(BlockSnapshot.class, uri);
nativeId = blockSnapshot.getNativeId();
} else if (URIUtil.isType(uri, BlockMirror.class)) {
BlockMirror blockMirror = _dbClient.queryObject(BlockMirror.class, uri);
nativeId = blockMirror.getAlternateName();
} else {
throw DeviceControllerException.exceptions.notAVolumeOrBlocksnapshotUri(uri);
}
nativeIds.add(nativeId);
}
return nativeIds.toArray(results);
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class SmisCommandHelper method getBlockObjectNativeId.
/**
* This method will take a URI and return a nativeId for the BlockObject object to which the URI
* applies.
*
* @param uri
* - URI
* @return Returns a nativeId String value
* @throws DeviceControllerException.exceptions.notAVolumeOrBlocksnapshotUri
* if URI is not a Volume/BlockSnapshot URI
*/
public String getBlockObjectNativeId(URI uri) throws Exception {
String nativeId;
if (URIUtil.isType(uri, Volume.class)) {
Volume volume = _dbClient.queryObject(Volume.class, uri);
nativeId = volume.getNativeId();
} else if (URIUtil.isType(uri, BlockSnapshot.class)) {
BlockSnapshot blockSnapshot = _dbClient.queryObject(BlockSnapshot.class, uri);
nativeId = blockSnapshot.getNativeId();
} else if (URIUtil.isType(uri, BlockMirror.class)) {
BlockMirror blockMirror = _dbClient.queryObject(BlockMirror.class, uri);
nativeId = blockMirror.getNativeId();
} else {
throw DeviceControllerException.exceptions.notAVolumeOrBlocksnapshotUri(uri);
}
return nativeId;
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class SmisCommandHelper method isVMAX3VolumeCompressionEnabled.
/**
* This method is will check if the volume associated with virtual Pool has compression enabled.
*
* @param blockObjectURI BlockObjectURI
* @return boolean to report if compression is enabled on the vpool.
*/
public boolean isVMAX3VolumeCompressionEnabled(URI blockObjectURI) {
VirtualPool virtualPool = null;
Volume volume = null;
if (URIUtil.isType(blockObjectURI, Volume.class)) {
volume = _dbClient.queryObject(Volume.class, blockObjectURI);
} else if (URIUtil.isType(blockObjectURI, BlockSnapshot.class)) {
BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, blockObjectURI);
volume = _dbClient.queryObject(Volume.class, snapshot.getParent());
} else if (URIUtil.isType(blockObjectURI, BlockMirror.class)) {
BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, blockObjectURI);
virtualPool = _dbClient.queryObject(VirtualPool.class, mirror.getVirtualPool());
}
if (volume != null) {
virtualPool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
}
return ((virtualPool != null) && virtualPool.getCompressionEnabled());
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class XIVSmisCommandHelper method getBlockObjectAlternateName.
/**
* This method will take a URI and return alternateName for the BlockObject object to which the
* URI applies.
*
* @param uri
* - URI
* @return Returns a nativeId String value
* @throws DeviceControllerException.exceptions.notAVolumeOrBlocksnapshotUri
* if URI is not a Volume/BlockSnapshot URI
*/
private String getBlockObjectAlternateName(URI uri) throws Exception {
String nativeId;
if (URIUtil.isType(uri, Volume.class)) {
Volume volume = _dbClient.queryObject(Volume.class, uri);
nativeId = volume.getAlternateName();
} else if (URIUtil.isType(uri, BlockSnapshot.class)) {
BlockSnapshot blockSnapshot = _dbClient.queryObject(BlockSnapshot.class, uri);
nativeId = blockSnapshot.getAlternateName();
} else if (URIUtil.isType(uri, BlockMirror.class)) {
BlockMirror blockMirror = _dbClient.queryObject(BlockMirror.class, uri);
nativeId = blockMirror.getAlternateName();
} else {
throw DeviceControllerException.exceptions.notAVolumeOrBlocksnapshotUri(uri);
}
return nativeId;
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class XIVSmisCommandHelper method getBlockObjectNativeIds.
/**
* This method will loop through the URI list and return a list of nativeIds
* for each of the BlockObject objects to which the URI applies.
*
* @param uris
* - Collection of URIs
* @return Returns a list of nativeId String values
* @throws DeviceControllerException.exceptions.notAVolumeOrBlocksnapshotUri
* f URI is not a Volume/BlockSnapshot URI
*/
public String[] getBlockObjectNativeIds(Collection<URI> uris) throws Exception {
String[] results = {};
Set<String> nativeIds = new HashSet<String>();
for (URI uri : uris) {
String nativeId;
if (URIUtil.isType(uri, Volume.class)) {
Volume volume = _dbClient.queryObject(Volume.class, uri);
nativeId = volume.getNativeId();
} else if (URIUtil.isType(uri, BlockSnapshot.class)) {
BlockSnapshot blockSnapshot = _dbClient.queryObject(BlockSnapshot.class, uri);
nativeId = blockSnapshot.getNativeId();
} else if (URIUtil.isType(uri, BlockMirror.class)) {
BlockMirror blockMirror = _dbClient.queryObject(BlockMirror.class, uri);
nativeId = blockMirror.getAlternateName();
} else {
throw DeviceControllerException.exceptions.notAVolumeOrBlocksnapshotUri(uri);
}
nativeIds.add(nativeId);
}
return nativeIds.toArray(results);
}
Aggregations