Search in sources :

Example 1 with CreateSnapshotOptions

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

the class CreateSnapshot method createSnapshot.

private void createSnapshot(Volume volume) throws TimeoutException {
    System.out.println("Create Snapshot");
    CreateSnapshotOptions options = CreateSnapshotOptions.Builder.name(Constants.NAME).description("Snapshot of " + volume.getId());
    Snapshot snapshot = snapshotApi.create(volume.getId(), options);
    // /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
    if (!SnapshotPredicates.awaitAvailable(snapshotApi).apply(snapshot)) {
        throw new TimeoutException("Timeout on volume: " + volume);
    }
    System.out.println("  " + snapshot);
}
Also used : Snapshot(org.jclouds.openstack.cinder.v1.domain.Snapshot) CreateSnapshotOptions(org.jclouds.openstack.cinder.v1.options.CreateSnapshotOptions) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

TimeoutException (java.util.concurrent.TimeoutException)1 Snapshot (org.jclouds.openstack.cinder.v1.domain.Snapshot)1 CreateSnapshotOptions (org.jclouds.openstack.cinder.v1.options.CreateSnapshotOptions)1