[libvirt] [PATCH] Refresh QEMU driver caps in getCapabilities

Cole Robinson crobinso at redhat.com
Tue Apr 28 16:25:41 UTC 2009


Hi all,

The attached patch fixes QEMU getCapabilities to refresh caps before
returning them to the user. Currently the capabilities are only
refreshed once (at daemon startup), which means libvirtd needs to be
restarted to pick up changes if QEMU or KVM are installed while the
daemon is running. See:
https://bugzilla.redhat.com/show_bug.cgi?id=460649

There are several things 'wrong' with this change:

- We reset/rescan fields that won't change (host arch, mac address
prefix). This should be fixed at some point, but isn't a big deal since
total performance impact is negligible (see below).

- We only refresh the capabilities when the user calls getCapabilities,
which means we are still carrying around stale caps prior to that, which
is what libvirt validates against. In practice, virt-manager and
virt-install both call getCapabilities often so this isn't an issue,
though the caps internal API should probably address this at some point.

To test the performance impact, I used a simple python script:

import libvirt
conn = libvirt.open("qemu:///system")
for i in range(0, 30):
    conn.getCapabilities()

The time difference was on average .02 seconds slower, which I think is
negligible.

If at somepoint in the future, capabilities generation becomes smarter
(searching PATH emulators, scraping device list output, etc.) it might
be worth re-checking the time impact. But for now it doesn't seem to be
an issue.

Thanks,
Cole
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-refresh-qemu-caps.patch
Type: text/x-diff
Size: 684 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20090428/c0ccadc0/attachment-0001.bin>


More information about the libvir-list mailing list