Search in sources :

Example 86 with BlockMirror

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);
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) URI(java.net.URI) HashSet(java.util.HashSet)

Example 87 with BlockMirror

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;
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot)

Example 88 with BlockMirror

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());
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) VirtualPool(com.emc.storageos.db.client.model.VirtualPool)

Example 89 with BlockMirror

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;
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot)

Example 90 with BlockMirror

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);
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) URI(java.net.URI) HashSet(java.util.HashSet)

Aggregations

BlockMirror (com.emc.storageos.db.client.model.BlockMirror)115 Volume (com.emc.storageos.db.client.model.Volume)77 URI (java.net.URI)49 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)43 ArrayList (java.util.ArrayList)33 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)30 NamedURI (com.emc.storageos.db.client.model.NamedURI)29 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)28 CIMObjectPath (javax.cim.CIMObjectPath)26 CIMInstance (javax.cim.CIMInstance)16 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)15 FCTN_MIRROR_TO_URI (com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_MIRROR_TO_URI)15 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)15 CIMArgument (javax.cim.CIMArgument)14 WBEMException (javax.wbem.WBEMException)14 BlockObject (com.emc.storageos.db.client.model.BlockObject)12 StringSet (com.emc.storageos.db.client.model.StringSet)12 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)11 ControllerException (com.emc.storageos.volumecontroller.ControllerException)10 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)9