Machine is already locked for a session
Posted: 14. Dec 2012, 17:32
Hi,
I'm trying to manipulate a linux VM (hosted on windows) via the VBox webservice. First I shutdown my VM, but when I want to change stuff on it with the webservice (and java), I get: The machine "X" is already locked for a session (or being unlocked). My code goes wrong when locking with the write locktype.
Anyone got any Idea's?
I'm trying to manipulate a linux VM (hosted on windows) via the VBox webservice. First I shutdown my VM, but when I want to change stuff on it with the webservice (and java), I get: The machine "X" is already locked for a session (or being unlocked). My code goes wrong when locking with the write locktype.
Anyone got any Idea's?
Code: Select all
LOGGER.info("connecting to VM");
VirtualBoxManager manager = VirtualBoxManager.createInstance(null);
manager.connect("http://localhost:18083", "", "");
final IVirtualBox box = manager.getVBox();
IMachine machine = box.findMachine("Linux");
IStorageController controller = machine.getStorageControllerByName("Storage");
ISession session = manager.getSessionObject();
machine.lockMachine(session, LockType.Write);
IMachine openedMachine = session.getMachine();