Sending as an RFC primarily because I'm looking for whether either
or both mechanisms in the series is more or less desired. Likewise,
if it's felt that the current process of telling customers to just
delete the cache is acceptible, then so be it. If there's other ideas
I'm willing to give them a go too. I did consider adding a virsh
option to "virsh capabilities" (still possible) and/or a virt-admin
option to force the refresh. These just were "easier" and didn't
require an API adjustment to implement.
Patch1 is essentially a means to determine if the kernel config
was changed to allow nested virtualization and to force a refresh
of the capabilities in that case. Without doing so the CPU settings
for a guest may not add the vmx=on depending on configuration and
for the user that doesn't make sense. There is a private bz on this
so I won't bother posting it.
Patch2 and Patch3 make use of the 'service libvirtd reload' function
in order to invalidate all the entries in the internal QEMU capabilities
hash table and then to force a reread. This perhaps has downsides related
to guest usage and previous means to use reload and not refresh if a guest
was running. On the other hand, we tell people to just clear the QEMU
capabilities cache (e.g. rm /var/cache/libvirt/qemu/capabilities/*.xml)
and restart libvirtd, so in essence, the same result. It's not clear
how frequently this is used (it's essentially a SIGHUP to libvirtd).
BTW: I did try deleting the files in the cache in one iteration, but
for some reason (and I didn't investigate too long), the files wouldn't
be recreated even though the cache was repopulated. They were recreated
after a libvirt restart...
John Ferlan (3):
qemu: Add check for whether nesting was enabled
util: Introduce virFileCacheForEach
qemu: Add ability to invalidate the capabilities cache
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 78 ++++++++++++++++++++++++++++++++++++
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_capspriv.h | 2 +
src/qemu/qemu_driver.c | 4 +-
src/util/virfilecache.c | 24 +++++++++++
src/util/virfilecache.h | 5 +++
tests/qemucapabilitiestest.c | 3 ++
8 files changed, 118 insertions(+), 1 deletion(-)
--
2.17.2