}
if (diskOfferingId == null) throw new EC2ServiceException(ServerError.InternalError, "No Customize Disk Offering Found");
}
// // -> no volume name is given in the Amazon request but is required in the cloud API
CloudStackVolume vol = getApi().createVolume(UUID.randomUUID().toString(), null, diskOfferingId, null, size, snapshotId, toZoneId(request.getZoneName(), null));
if (vol != null) {
EC2Volume resp = new EC2Volume();
resp.setAttached(vol.getAttached());
resp.setCreated(vol.getCreated());
// resp.setDevice();
resp.setDeviceId(vol.getDeviceId());
resp.setHypervisor(vol.getHypervisor());
resp.setId(vol.getId());
resp.setInstanceId(vol.getVirtualMachineId());
resp.setSize(vol.getSize());
resp.setSnapshotId(vol.getSnapshotId());
resp.setState(vol.getState());
resp.setType(vol.getVolumeType());
resp.setVMState(vol.getVirtualMachineState());
resp.setAttachmentState("detached");
resp.setZoneName(vol.getZoneName());
return resp;
}
return null;
} catch( Exception e ) {
logger.error( "EC2 CreateVolume - ", e);