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