I believe that the reason the machine is locked is because you are already locking it at " IProgress progress = machine.launchVMProcess(session, "gui", "");"
Please refer to the SDK ref for more information. Regards, Danny. From: [email protected] [mailto:[email protected]] On Behalf Of Rafael Braga Sent: Thursday, September 01, 2011 21:49 To: [email protected] Subject: [vbox-dev] The given session is busy 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 --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
_______________________________________________ vbox-dev mailing list [email protected] http://vbox.innotek.de/mailman/listinfo/vbox-dev
