[vbox-dev] Unable to get a session - lockMachine

Bikram Gupta bikramkgupta at gmail.com
Tue Jan 17 08:39:05 GMT 2012


Thank you. I tried that, but does not work. I used Ubuntu 11.10, Python
2.7, Virtualbox 4.1.8, SDK 3.2.12, and a plain XP guest VM.

Is there something very fundamental I am missing?

Regards,
Bikram

+++++

import sys
import vboxapi


vb_mgr = vboxapi.VirtualBoxManager(None, None)
vbox = vb_mgr.vbox
mgr = vb_mgr.mgr
constants = vb_mgr.constants

name = "cuckoo3"

machine = vbox.findMachine(name)
print "Found the machine"

session = mgr.getSessionObject(vbox)

try:
        machine.lockMachine(session, constants.LockType_Shared)

except Exception, why:
        print "Unable to lock machine:",why
        #sys.exit(-1);
        raise

# here we can do what we need with the VM

print "Never reached here!"
session.unlockMachine()

+++++




On Mon, Jan 16, 2012 at 11:53 PM, Alexey Eromenko <al4321 at gmail.com> wrote:

> Try this:
> vbc = vboxapi.VirtualBoxReflectionInfo(False)
> vb_mgr = vboxapi.VirtualBoxManager(None, None)
> +constants = vb_mgr.constants
>
> ...
> -        machine.lockMachine(session, vbc.LockType_Shared)
> +        machine.lockMachine(session, constants.LockType_Shared)
>
> No idea about this: "vbc = vboxapi.VirtualBoxReflectionInfo(False)". I
> never used it.
>
> --
> -Alexey Eromenko "Technologov"
>
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> https://www.virtualbox.org/mailman/listinfo/vbox-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20120117/0a1cd357/attachment.html>


More information about the vbox-dev mailing list