Hello, I am beginner in virtualbox java API and now I need
change the memory size of a vm. I am using the following code:
public void setMemorySize() {
VirtualBoxManager mgr = VirtualBoxManager.createInstance(null);
ISession session = mgr.getSessionObject();
IVirtualBox vbox = mgr.getVBox();
IMachine machine = vbox.getMachines().get(1);
IProgress progress = machine.launchVMProcess(session, "gui", "");
progress.waitForCompletion(-1);
machine.lockMachine(session, LockType.Write); // machine is now
locked for writing
IMachine mutable = session.getMachine();
// obtain the mutable machine copy
mutable.setMemorySize((long) 1024);
mutable.saveSettings();
// write settings to XML
session.unlockMachine();
}
But, returns the following error:
Exception in thread "main" org.virtualbox_4_1.VBoxException: The function
"lockMachine" returned an error condition: "The given session is busy"
(0x80bb0007)
at org.virtualbox_4_1.IMachine.lockMachine(IMachine.java:798)
at teste.elasticidade.IniciaVM.setMemorySize(IniciaVM.java:51)
at teste.elasticidade.IniciaVM.main(IniciaVM.java:37)
what may be happening?
thanks a lot.
--
Rafael Braga <http://www.linkedin.com/myprofile?trk=hb_tab_pro>
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev