assert (morefOfNewVm != null);
msg = "import succeeded.";
System.out.println(msg); logger_.info(msg);
/* 6. Add contorollers and empty disks. */
VirtualMachineManager vmm = gm_.searchVmWithMoref(morefOfNewVm);
if (vmm == null) {
throw new Exception("Could not find newly created vm.");
}
vmm.addEmptyDisks(vcmList);
vmm.reload(); /* reload to get information of added disks
for the next step. */
{
int numDisks = 0;
for (VirtualControllerManager vcm : vcmList) {
numDisks += vcm.getNumOfDisks();
}
msg = String.format("add empty %d disks succeeded.", numDisks);
}
System.out.println(msg); logger_.info(msg);
/* 7. Get VmdkInfo list for remote disk path of
the newly created vmdk files,
and get the corresponding diskId to restore.
Then call vmdkbkp command to restore each vmdk file. */
if (restoreInfo.isNoVmdk) {
msg = String.format
("Disks are not restored because specified --novmdk option.");
System.out.println(msg); logger_.info(msg);
} else {
/* Create snapshot and get moref of the snapshot. */
Calendar cal = Calendar.getInstance();
String snapName = generateSnapshotName(cal);
createSnapshot(vmm, snapName);
msg = String.format
("create snapshot name %s succeeded.", snapName);
System.out.println(msg); logger_.info(msg);
SnapshotManager snap = vmm.getCurrentSnapshot();
if (snap == null || snapName.equals(snap.getName()) == false) {
throw new Exception("Could not get snapshot.");
}
String snapMoref = snap.getMoref();