VirtualBox API Version - 4.3.10
Connection Type - WebServer
Language - Java
OS - Ubuntu 14.04
The IMachine::cloneTo function does not appear to be working. Here is the code I have written,
Code: Select all
static IMachine copyVM(VirtualBoxManager mgr)
{
IVirtualBox vbox = mgr.getVBox();
IMachine oldMachine = vbox.findMachine("21e48f31-248b-4f34-b20b-783a0ae27849"); //this is the vm to clone
IMachine new_machine = vbox.createMachine(null, "vmName", null, oldMachine.getOSTypeId(), null); //the new vm to clone to
new_machine.saveSettings();
vbox.registerMachine(new_machine);
List<CloneOptions> options = new ArrayList<CloneOptions>(); //clone options
options.add(CloneOptions.KeepDiskNames); //just keep the disk name
IProgress clone_progress = oldMachine.cloneTo(newMachine, CloneMode.MachineState, options); //start the clone process
progressBar(clone_progress); //this function keeps track of the clone percent
return newMachine;
}
Code: Select all
static boolean progressBar(IProgress p)
{
while (!p.getCompleted())
{
System.out.println(p.getPercent() + " . ");
}
return true;
}
Looks like a bug to me, But I might be doing something wrong maybe?
Any suggestions?