[libvirt] [PATCH 2/2] VirtualBox support

Florian Vichot florian.vichot at diateam.net
Wed Apr 8 17:11:03 UTC 2009

I've just had time to test start, shutdown, dominfo and list but works
great so far :) Tomorrow I'll probably try define create VRDP etc...

Just one quick patch though:
I'm not sure you know, but you call VBoxCGlueInit() twice at every start
of virsh: once in vboxRegister() and once in vboxInitialize(). Is that
intentional/necessary ? Because it breaks your automagical VBox path

For it to work with a VBox 2.2 install in /usr/lib/virtualbox, you need
to change:

line 103 in vbox_XPCOMCGlue.c from:
    setenv("VBOX_APP_HOME", pszHome, 0 /* no need to overwrite */);
    setenv("VBOX_APP_HOME", pszHome, 1 );

otherwise if VBOX_APP_HOME isn't set when starting virsh, the first call
to VBoxCGlueInit() calls in turn tryLoadOne("/opt/VirtualBox") which
sets VBOX_APP_HOME to "/opt/VirtualBox", and when Vbox is detected to be
in "/usr/lib/virtualbox" it's not updated (because of the no overwrite
policy), and so when VBoxCGlueInit() is called a second time it fails
(as it tries to use the value in VBOX_APP_HOME, which is wrong).

Of course it works if one starts virsh thusly:
     VBOX_APP_HOME=/usr/lib/virtualbox src/virsh -c vbox:///session
but it kind of defeats the purpose :)


Pritesh Kothari a écrit :
> Hi All,
> I have attached a patch which when applied on the HEAD as of today would allow 
> virtualbox support in libvirt. It takes cares of all the stuff mentioned on 
> the list earlier. Still if I have missed anything, please do tell me.
> The patch works very well with the VirtualBox OSE version and the 2.2 release.
> [PATCH 1/2] contains diff of files already in libvirt.
> [PATCH 2/2] contains new files needed for VirtualBox support.
> Regards,
> Pritesh
> ------------------------------------------------------------------------
> This body part will be downloaded on demand.

More information about the libvir-list mailing list