- Remove all qemu emulators
- Restart libvirtd
- Install qemu emulators
- Call 'virsh version' -> errors

The only thing that will force the qemu driver to refresh it's cached
capablities info is an explict API call to GetCapabilities.

However in the case when the initial caps lookup at driver connect didn't
find a single qemu emulator to poll, the driver is effectively useless
and really can't do anything until it's populated some qemu capabilities
info.

With the above steps, the user would have to either know about the
magic refresh capabilities call, or restart libvirtd to pick up the
changes.

Instead, this patch changes things so that every time a part of th
driver requests access to capabilities info, check to see if
we've previously seen any emulators. If not, force a refresh.

In the case of 'still no emulators found', this is still very quick, so
I can't think of a downside.

https://bugzilla.redhat.com/show_bug.cgi?id=1000116
---
 src/qemu/qemu_conf.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 2cf3905..b662b69 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -965,6 +965,13 @@ virCapsPtr virQEMUDriverGetCapabilities(virQEMUDriverPtr 
driver,
         qemuDriverLock(driver);
     }
 
+    if (driver->caps->nguests == 0 && !refresh) {
+        VIR_DEBUG("Capabilities didn't detect any guests. Forcing a "
+            "refresh.");
+        qemuDriverUnlock(driver);
+        return virQEMUDriverGetCapabilities(driver, true);
+    }
+
     ret = virObjectRef(driver->caps);
     qemuDriverUnlock(driver);
     return ret;
-- 
2.3.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to