public boolean apply(Snapshot snapshot) { logger.trace("looking for status on snapshot %s", snapshot.getId()); snapshot = Iterables.getOnlyElement(client.describeSnapshotsInRegion(snapshot.getRegion(), snapshotIds(snapshot.getId()))); logger.trace("%s: looking for status %s: currently: %s; progress %d/100", snapshot, Snapshot.Status.COMPLETED, snapshot.getStatus(), snapshot.getProgress()); return snapshot.getStatus() == Snapshot.Status.COMPLETED; }
public boolean apply(Snapshot snapshot) { logger.trace("looking for status on snapshot %s", snapshot.getId()); snapshot = Iterables.getOnlyElement(client.describeSnapshotsInRegion(snapshot.getRegion(), snapshotIds(snapshot.getId()))); logger.trace("%s: looking for status %s: currently: %s; progress %d/100", snapshot, Snapshot.Status.COMPLETED, snapshot.getStatus(), snapshot.getProgress()); return snapshot.getStatus() == Snapshot.Status.COMPLETED; }
public boolean apply(Snapshot snapshot) { logger.trace("looking for status on snapshot %s", snapshot.getId()); snapshot = Iterables.getOnlyElement(client.describeSnapshotsInRegion(snapshot.getRegion(), snapshotIds(snapshot.getId()))); logger.trace("%s: looking for status %s: currently: %s; progress %d/100", snapshot, Snapshot.Status.COMPLETED, snapshot.getStatus(), snapshot.getProgress()); return snapshot.getStatus() == Snapshot.Status.COMPLETED; }
public boolean apply(Snapshot snapshot) { logger.trace("looking for status on snapshot %s", snapshot.getId()); snapshot = Iterables.getOnlyElement(client.describeSnapshotsInRegion(snapshot.getRegion(), snapshotIds(snapshot.getId()))); logger.trace("%s: looking for status %s: currently: %s; progress %d/100", snapshot, Snapshot.Status.COMPLETED, snapshot.getStatus(), snapshot.getProgress()); return snapshot.getStatus() == Snapshot.Status.COMPLETED; }
public boolean apply(Snapshot snapshot) { logger.trace("looking for status on snapshot %s", snapshot.getId()); snapshot = Iterables.getOnlyElement(client.describeSnapshotsInRegion(snapshot.getRegion(), snapshotIds(snapshot.getId()))); logger.trace("%s: looking for status %s: currently: %s; progress %d/100", snapshot, Snapshot.Status.COMPLETED, snapshot.getStatus(), snapshot.getProgress()); return snapshot.getStatus() == Snapshot.Status.COMPLETED; }
/** * Create a snapshot of the volume attached to the VM * @param vmi a VMInstance */ public String createSnapshot(VMInstance vmi){ NodeMetadata nm=getVMById(vmi.getId()); ElasticBlockStoreApi ebsClient = ec2api.getElasticBlockStoreApi().get(); journal.log(Level.INFO, ">> Creating snapshot of VM: "+vmi.getName()); Snapshot snapshot = ebsClient.createSnapshotInRegion("eu-west-1", nm.getHardware().getVolumes().get(0).getId()); String status=""; while (!status.toLowerCase().equals("completed")){ for(Snapshot s:ebsClient.describeSnapshotsInRegion("eu-west-1")) if(s.getId().equals(snapshot.getId())){ status=s.getStatus().name(); } try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } } journal.log(Level.INFO, ">> Snapshot created with ID: "+snapshot.getId()); return snapshot.getId(); }