use of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId in project legacy-jclouds-examples by jclouds.
the class DetachVolume method unmountVolume.
/**
* Make sure you've unmounted the volume first. Failure to do so could result in failure or data loss.
*/
private void unmountVolume(VolumeAttachment volumeAttachment) {
System.out.println("Unmount Volume");
String script = new ScriptBuilder().addStatement(exec("umount /mnt")).render(OsFamily.UNIX);
RunScriptOptions options = RunScriptOptions.Builder.overrideLoginUser(Constants.ROOT).overrideLoginPassword(Constants.PASSWORD).blockOnComplete(true);
ZoneAndId zoneAndId = ZoneAndId.fromZoneAndId(Constants.ZONE, volumeAttachment.getServerId());
ExecResponse response = compute.runScriptOnNode(zoneAndId.slashEncode(), script, options);
if (response.getExitStatus() == 0) {
System.out.println(" Exit Status: " + response.getExitStatus());
} else {
System.out.println(" Error: " + response.getOutput());
}
}
Aggregations