use of org.jclouds.openstack.cinder.v1.domain.Volume in project legacy-jclouds-examples by jclouds.
the class CreateSnapshot method main.
/**
* To get a username and API key see
* http://www.jclouds.org/documentation/quickstart/rackspace/
*
* The first argument (args[0]) must be your username The second argument
* (args[1]) must be your API key
*/
public static void main(String[] args) {
CreateSnapshot createSnapshot = new CreateSnapshot();
try {
createSnapshot.init(args);
Volume volume = createSnapshot.getVolume();
createSnapshot.createSnapshot(volume);
} catch (Exception e) {
e.printStackTrace();
} finally {
createSnapshot.close();
}
}
use of org.jclouds.openstack.cinder.v1.domain.Volume 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;
}
use of org.jclouds.openstack.cinder.v1.domain.Volume in project legacy-jclouds-examples by jclouds.
the class DeleteVolume method main.
/**
* To get a username and API key see
* http://www.jclouds.org/documentation/quickstart/rackspace/
*
* The first argument (args[0]) must be your username The second argument
* (args[1]) must be your API key
*/
public static void main(String[] args) {
DeleteVolume deleteVolume = new DeleteVolume();
try {
deleteVolume.init(args);
Volume volume = deleteVolume.getVolume();
deleteVolume.deleteVolume(volume);
} catch (Exception e) {
e.printStackTrace();
} finally {
deleteVolume.close();
}
}
use of org.jclouds.openstack.cinder.v1.domain.Volume 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);
}
use of org.jclouds.openstack.cinder.v1.domain.Volume in project legacy-jclouds-examples by jclouds.
the class CreateVolumeAndAttach method main.
/**
* To get a username and API key see http://www.jclouds.org/documentation/quickstart/rackspace/
*
* The first argument (args[0]) must be your username
* The second argument (args[1]) must be your API key
*/
public static void main(String[] args) {
CreateVolumeAndAttach createVolumeAndAttach = new CreateVolumeAndAttach();
try {
createVolumeAndAttach.init(args);
NodeMetadata node = createVolumeAndAttach.createServer();
Volume volume = createVolumeAndAttach.createVolume();
createVolumeAndAttach.attachVolume(volume, node);
createVolumeAndAttach.mountVolume(node);
} catch (Exception e) {
e.printStackTrace();
} finally {
createVolumeAndAttach.close();
}
}
Aggregations