[libvirt] QEMU/KVM auto-detection bug

Chris Lalancette clalance at redhat.com
Tue May 12 09:36:50 UTC 2009

     Even with Guido/Pritesh's recent changes to the vbox open routine, the
auto-detection in libvirt is currently broken.  What happens is that in
src/libvirt.c:do_open(), at the start of the loop to auto-detect drivers,
ret->uri is NULL.  As each driver declines, it remains NULL.  However, the very
first thing the vboxOpen() routine does is:

    if (conn->uri == NULL) {
        conn->uri = xmlParseURI(uid ? "vbox:///session" : "vbox:///system");
        if (conn->uri == NULL) {
            return VIR_DRV_OPEN_ERROR;

So, any driver that is trying to auto-probe after vboxOpen sees a conn->uri with
a scheme of vbox and a path of system/session, and they all fail (including
Qemu, which is what I'm mostly concerned with at the moment).

In point of fact, this whole auto-detection thing is fragile.  We got away with
it before because the qemuOpen() routine bombs out before doing the whole
conn->uri == NULL check, but in general, it's very easy for one buggy driver to
mess up auto-detection for all drivers.

Any thoughts about where to go here?  We should obviously fix the vboxOpen()
routine to not mess with the URI if it's going to fail.  Additionally, I was
thinking that maybe we should reset conn->uri to NULL in each iteration of the
auto-detection loop.  While that might leak memory for buggy drivers, it should
at least make this whole thing less fragile.


Chris Lalancette

More information about the libvir-list mailing list