mirror of https://github.com/apache/jclouds.git
added waitForCompletion on snapshot creation and deletion has multi-node was failing
This commit is contained in:
parent
6967743044
commit
ec7552cdbb
|
@ -47,6 +47,7 @@ import org.jclouds.virtualbox.statements.SetIpAddress;
|
||||||
import org.jclouds.virtualbox.util.MachineUtils;
|
import org.jclouds.virtualbox.util.MachineUtils;
|
||||||
import org.virtualbox_4_1.CleanupMode;
|
import org.virtualbox_4_1.CleanupMode;
|
||||||
import org.virtualbox_4_1.IMachine;
|
import org.virtualbox_4_1.IMachine;
|
||||||
|
import org.virtualbox_4_1.IProgress;
|
||||||
import org.virtualbox_4_1.ISession;
|
import org.virtualbox_4_1.ISession;
|
||||||
import org.virtualbox_4_1.NetworkAttachmentType;
|
import org.virtualbox_4_1.NetworkAttachmentType;
|
||||||
import org.virtualbox_4_1.VirtualBoxManager;
|
import org.virtualbox_4_1.VirtualBoxManager;
|
||||||
|
@ -116,7 +117,8 @@ public class NodeCreator implements Function<NodeSpec, NodeAndInitialCredentials
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("error opening vbox machine session: " + e.getMessage(), e);
|
throw new RuntimeException("error opening vbox machine session: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
session.getConsole().deleteSnapshot(master.getMachine().getCurrentSnapshot().getId());
|
IProgress progress = session.getConsole().deleteSnapshot(master.getMachine().getCurrentSnapshot().getId());
|
||||||
|
progress.waitForCompletion(-1);
|
||||||
session.unlockMachine();
|
session.unlockMachine();
|
||||||
}
|
}
|
||||||
String masterNameWithoutPrefix = master.getSpec().getVmSpec().getVmName().replace(VIRTUALBOX_IMAGE_PREFIX, "");
|
String masterNameWithoutPrefix = master.getSpec().getVmSpec().getVmName().replace(VIRTUALBOX_IMAGE_PREFIX, "");
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class TakeSnapshotIfNotAlreadyAttached implements Function<IMachine, ISna
|
||||||
try {
|
try {
|
||||||
session = manager.get().openMachineSession(machine);
|
session = manager.get().openMachineSession(machine);
|
||||||
IProgress progress = session.getConsole().takeSnapshot(snapshotName, snapshotDesc);
|
IProgress progress = session.getConsole().takeSnapshot(snapshotName, snapshotDesc);
|
||||||
|
progress.waitForCompletion(-1);
|
||||||
if (progress.getCompleted())
|
if (progress.getCompleted())
|
||||||
logger.debug("Snapshot %s (description: %s) taken from %s", snapshotName, snapshotDesc, machine.getName());
|
logger.debug("Snapshot %s (description: %s) taken from %s", snapshotName, snapshotDesc, machine.getName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue