use of com.emc.storageos.scaleio.api.restapi.request.ScaleIOCreateVolume in project coprhd-controller by CoprHD.
the class ScaleIORestClient method addVolume.
/**
* Create a volume
*
* @param protectionDomainId The protection domain ID
* @param storagePoolId The storage pool ID
* @param volumeName The volume name
* @param volumeSize The volume Size
* @param thinProvisioned true for thinProvisioned, false for thickProvisioned
* @return
* @throws Exception
*/
public ScaleIOVolume addVolume(String protectionDomainId, String storagePoolId, String volumeName, String volumeSize, boolean thinProvisioned) throws Exception {
ScaleIOCreateVolume volume = new ScaleIOCreateVolume();
Long sizeInKb = Long.parseLong(volumeSize) / 1024L;
volume.setVolumeSizeInKb(sizeInKb.toString());
volume.setStoragePoolId(storagePoolId);
volume.setName(volumeName);
volume.setProtectionDomainId(protectionDomainId);
if (thinProvisioned) {
volume.setVolumeType(ScaleIOConstants.THIN_PROVISIONED);
} else {
volume.setVolumeType(ScaleIOConstants.THICK_PROVISIONED);
}
ClientResponse response = post(URI.create(ScaleIOConstants.VOLUMES_URI), getJsonForEntity(volume));
ScaleIOVolume createdVol = getResponseObject(ScaleIOVolume.class, response);
return queryVolume(createdVol.getId());
}
use of com.emc.storageos.scaleio.api.restapi.request.ScaleIOCreateVolume in project coprhd-controller by CoprHD.
the class ScaleIORestClient method addVolume.
/**
* Create a volume
*
* @param protectionDomainId The protection domain ID
* @param storagePoolId The storage pool ID
* @param volumeName The volume name
* @param volumeSize The volume Size
* @return The detail of the created volume
* @throws Exception
*/
public ScaleIOVolume addVolume(String protectionDomainId, String storagePoolId, String volumeName, String volumeSize) throws Exception {
ScaleIOCreateVolume volume = new ScaleIOCreateVolume();
Long sizeInKb = Long.parseLong(volumeSize) / 1024L;
volume.setVolumeSizeInKb(sizeInKb.toString());
volume.setStoragePoolId(storagePoolId);
volume.setName(volumeName);
volume.setProtectionDomainId(protectionDomainId);
ClientResponse response = post(URI.create(ScaleIOConstants.VOLUMES_URI), getJsonForEntity(volume));
ScaleIOVolume createdVol = getResponseObject(ScaleIOVolume.class, response);
return queryVolume(createdVol.getId());
}
Aggregations