p.waitForCompletion(-1);
app.interpret();
Set<String> oids = this.getMachineIds(vbox);
p = app.importMachines();
p.waitForCompletion(-1);
IMachine machine = null;
for (IMachine m : vbox.getMachines()) {
if (!oids.contains(m.getId())) {
machine = m;
break;
}
}
machine.lockMachine(s, LockType.Write);
IMachine mm = s.getMachine();
mm.setName("iosgi-" + Long.toHexString(System.currentTimeMillis()));
mm.getNetworkAdapter(0L).setMACAddress(getRandomMACAddress());
IMedium medium = vbox.openMedium(image.getAbsolutePath(),
DeviceType.DVD, AccessMode.ReadOnly);
mm.mountMedium("IDE-Controller", 1, 0, medium, true);
mm.saveSettings();
s.unlockMachine();
return machine;
}