private String createVolume ( String storageId , String snapshotId , int size ) { String volumeType = Ec2IaasHandler . findStorageProperty ( this . targetProperties , storageId , VOLUME_TYPE_PREFIX ) ; if ( volumeType == null ) volumeType = "standard" ; CreateVolumeRequest createVolumeRequest = new CreateVolumeRequest ( ) . withAvailabilityZone ( this . availabilityZone ) . withVolumeType ( volumeType ) . withSize ( size ) ; // The size of the volume, in gigabytes. // EC2 snapshot IDs start with "snap-"... if ( ! Utils . isEmptyOrWhitespaces ( snapshotId ) && snapshotId . startsWith ( "snap-" ) ) createVolumeRequest . withSnapshotId ( snapshotId ) ; CreateVolumeResult createVolumeResult = this . ec2Api . createVolume ( createVolumeRequest ) ; return createVolumeResult . getVolume ( ) . getVolumeId ( ) ; }
Creates volume for EBS .