Search in sources :

Example 6 with VNXePool

use of com.emc.storageos.vnxe.models.VNXePool in project coprhd-controller by CoprHD.

the class VNXeJob method updateStoragePoolCapacity.

/**
 * Update storage pool capacity
 *
 * @param dbClient
 * @param vnxeApiClient
 * @param storagePoolUri
 * @param reservedCapacityVolumesIds The volumes reserved capacity in the pool that needs to be removed
 */
public static void updateStoragePoolCapacity(DbClient dbClient, VNXeApiClient vnxeApiClient, URI storagePoolUri, List<String> reservedCapacityVolumeIds) {
    StoragePool storagePool = dbClient.queryObject(StoragePool.class, storagePoolUri);
    if (reservedCapacityVolumeIds != null && !reservedCapacityVolumeIds.isEmpty()) {
        storagePool.removeReservedCapacityForVolumes(reservedCapacityVolumeIds);
    }
    String poolNativeId = storagePool.getNativeId();
    VNXePool pool = vnxeApiClient.getPool(poolNativeId);
    storagePool.setFreeCapacity(VNXeUtils.convertDoubleSizeToViPRLong(pool.getSizeFree()));
    storagePool.setSubscribedCapacity(VNXeUtils.convertDoubleSizeToViPRLong(pool.getSizeSubscribed()));
    dbClient.updateObject(storagePool);
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) VNXePool(com.emc.storageos.vnxe.models.VNXePool)

Aggregations

VNXePool (com.emc.storageos.vnxe.models.VNXePool)6 StoragePool (com.emc.storageos.db.client.model.StoragePool)4 StringSet (com.emc.storageos.db.client.model.StringSet)3 PoolTier (com.emc.storageos.vnxe.models.PoolTier)3 ArrayList (java.util.ArrayList)3 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)2 VNXeException (com.emc.storageos.vnxe.VNXeException)2 DiskGroup (com.emc.storageos.vnxe.models.DiskGroup)2 RaidGroup (com.emc.storageos.vnxe.models.RaidGroup)2 RaidTypeEnum (com.emc.storageos.vnxe.models.RaidTypeEnum)2 VNXeBase (com.emc.storageos.vnxe.models.VNXeBase)2 HashMap (java.util.HashMap)2 List (java.util.List)2 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)1 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)1 Disk (com.emc.storageos.vnxe.models.Disk)1 Health (com.emc.storageos.vnxe.models.Health)1 URI (java.net.URI)1 Test (org.junit.Test)1