Search in sources :

Example 1 with ScStorageTypeStorageUsage

use of com.emc.storageos.driver.dellsc.scapi.objects.ScStorageTypeStorageUsage in project coprhd-controller by CoprHD.

the class DellSCUtil method getStoragePoolFromStorageType.

/**
 * Gets a StoragePool object for a storage type.
 *
 * @param api The Storage Center API connection.
 * @param storageType The storage type.
 * @param pool The StoragePool object to populate or null.
 * @return The StoragePool.
 */
public StoragePool getStoragePoolFromStorageType(StorageCenterAPI api, ScStorageType storageType, StoragePool pool) {
    if (pool == null) {
        pool = new StoragePool();
    }
    pool.setNativeId(storageType.instanceId);
    pool.setStorageSystemId(storageType.scSerialNumber);
    LOG.info("Discovered Pool {}, storageSystem {}", pool.getNativeId(), pool.getStorageSystemId());
    pool.setDeviceLabel(storageType.name);
    pool.setDisplayName(storageType.name);
    pool.setPoolName(storageType.name);
    pool.setCapabilities(new ArrayList<>(0));
    // Get the supported transport protocols
    Set<StoragePool.Protocols> protocols = new HashSet<>();
    List<String> transportProtocols = getSupportedProtocols(api, storageType.scSerialNumber);
    if (transportProtocols.contains(Protocol.FC.toString())) {
        protocols.add(StoragePool.Protocols.FC);
    }
    if (transportProtocols.contains(Protocol.iSCSI.toString())) {
        protocols.add(StoragePool.Protocols.iSCSI);
    }
    pool.setProtocols(protocols);
    pool.setPoolServiceType(StoragePool.PoolServiceType.block);
    pool.setMaximumThickVolumeSize(0L);
    pool.setMinimumThickVolumeSize(0L);
    // Max 512 TB
    pool.setMaximumThinVolumeSize(549755813888L);
    // Min 1 GB
    pool.setMinimumThinVolumeSize(1048576L);
    pool.setSupportedResourceType(StoragePool.SupportedResourceType.THIN_ONLY);
    ScStorageTypeStorageUsage su = api.getStorageTypeStorageUsage(storageType.instanceId);
    LOG.info("Space info: {} {} {}", su.allocatedSpace, su.freeSpace, su.usedSpace);
    pool.setSubscribedCapacity(SizeUtil.sizeStrToKBytes(su.usedSpace));
    pool.setFreeCapacity(SizeUtil.sizeStrToKBytes(su.freeSpace));
    pool.setTotalCapacity(SizeUtil.sizeStrToKBytes(su.allocatedSpace));
    pool.setOperationalStatus(StoragePool.PoolOperationalStatus.READY);
    return pool;
}
Also used : Protocols(com.emc.storageos.storagedriver.model.StoragePool.Protocols) StoragePool(com.emc.storageos.storagedriver.model.StoragePool) ScStorageTypeStorageUsage(com.emc.storageos.driver.dellsc.scapi.objects.ScStorageTypeStorageUsage) HashSet(java.util.HashSet)

Aggregations

ScStorageTypeStorageUsage (com.emc.storageos.driver.dellsc.scapi.objects.ScStorageTypeStorageUsage)1 StoragePool (com.emc.storageos.storagedriver.model.StoragePool)1 Protocols (com.emc.storageos.storagedriver.model.StoragePool.Protocols)1 HashSet (java.util.HashSet)1