Search in sources :

Example 1 with CreateVolumeOptions

use of org.jclouds.openstack.cinder.v1.options.CreateVolumeOptions in project legacy-jclouds-examples by jclouds.

the class CreateVolumeAndAttach method createVolume.

private Volume createVolume() throws TimeoutException {
    CreateVolumeOptions options = CreateVolumeOptions.Builder.name(Constants.NAME).metadata(ImmutableMap.<String, String>of("key1", "value1"));
    System.out.println("Create Volume");
    // 100 GB is the minimum volume size on the Rackspace Cloud
    Volume volume = volumeApi.create(100, options);
    // /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
    if (!VolumePredicates.awaitAvailable(volumeApi).apply(volume)) {
        throw new TimeoutException("Timeout on volume: " + volume);
    }
    System.out.println("  " + volume);
    return volume;
}
Also used : Volume(org.jclouds.openstack.cinder.v1.domain.Volume) CreateVolumeOptions(org.jclouds.openstack.cinder.v1.options.CreateVolumeOptions) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

TimeoutException (java.util.concurrent.TimeoutException)1 Volume (org.jclouds.openstack.cinder.v1.domain.Volume)1 CreateVolumeOptions (org.jclouds.openstack.cinder.v1.options.CreateVolumeOptions)1