]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Force capabilities cache refresh if libvirtd date is different
authorJohn Ferlan <jferlan@redhat.com>
Wed, 20 May 2015 12:05:17 +0000 (08:05 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 26 May 2015 15:48:56 +0000 (11:48 -0400)
https://bugzilla.redhat.com/show_bug.cgi?id=1195882

Original commit id 'cbde3589' indicates that the cache file would be
discarded if either the QEMU binary or libvirtd 'ctime' changes; however,
the code only discarded if the QEMU binary time didn't match or if the
new libvirtd ctime was later than what created the cache file.

Since many factors come into play with 'ctime' adjustments (including
perhaps turning back the hands of time), change the logic to also force
a refresh if the ctime of libvirt is different than what's in the cache.

src/qemu/qemu_capabilities.c

index 375df22345c75aba662d78d185d8b5c7ee7f396b..a6fae38a0e6f479e19b84727471c84530e5fc33d 100644 (file)
@@ -2981,9 +2981,9 @@ virQEMUCapsInitCached(virQEMUCapsPtr qemuCaps, const char *cacheDir)
         goto cleanup;
     }
 
-    /* Discard if cache is older that QEMU binary */
+    /* Discard cache if QEMU binary or libvirtd changed */
     if (qemuctime != qemuCaps->ctime ||
-        selfctime < virGetSelfLastChanged()) {
+        selfctime != virGetSelfLastChanged()) {
         VIR_DEBUG("Outdated cached capabilities '%s' for '%s' "
                   "(%lld vs %lld, %lld vs %lld)",
                   capsfile, qemuCaps->binary,