Search in sources :

Example 1 with ScVolumeStorageUsage

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

the class DellSCUtil method getStorageVolumeFromScVolume.

/**
 * Populates a StorageVolume instance with Storage Center volume data.
 *
 * @param api The API connection.
 * @param volume The Storage Center volume.
 * @param cgInfo Consistency group information or null.
 * @return The StorageVolume.
 * @throws StorageCenterAPIException
 */
public StorageVolume getStorageVolumeFromScVolume(StorageCenterAPI api, ScVolume volume, Map<ScReplayProfile, List<String>> cgInfo) throws StorageCenterAPIException {
    ScVolumeStorageUsage storageUsage = api.getVolumeStorageUsage(volume.instanceId);
    StorageVolume driverVol = new StorageVolume();
    driverVol.setStorageSystemId(volume.scSerialNumber);
    driverVol.setStoragePoolId(volume.storageType.instanceId);
    driverVol.setNativeId(volume.instanceId);
    driverVol.setThinlyProvisioned(true);
    driverVol.setProvisionedCapacity(SizeUtil.sizeStrToBytes(volume.configuredSize));
    driverVol.setAllocatedCapacity(SizeUtil.sizeStrToBytes(storageUsage.totalDiskSpace));
    driverVol.setWwn(volume.deviceId);
    driverVol.setDeviceLabel(volume.name);
    // Check consistency group membership
    if (cgInfo != null) {
        for (ScReplayProfile cg : cgInfo.keySet()) {
            if (cgInfo.get(cg).contains(volume.instanceId)) {
                // Found our volume in a consistency group
                driverVol.setConsistencyGroup(cg.instanceId);
                break;
            }
        }
    }
    return driverVol;
}
Also used : StorageVolume(com.emc.storageos.storagedriver.model.StorageVolume) ScVolumeStorageUsage(com.emc.storageos.driver.dellsc.scapi.objects.ScVolumeStorageUsage) ScReplayProfile(com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile)

Aggregations

ScReplayProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile)1 ScVolumeStorageUsage (com.emc.storageos.driver.dellsc.scapi.objects.ScVolumeStorageUsage)1 StorageVolume (com.emc.storageos.storagedriver.model.StorageVolume)1