
On 03/05/2014 10:53 AM, Daniel P. Berrange wrote:
Currently the QEMU capabilities cache files on disk are only invalidated if the QEMU binary changes. New versions of libvirt, however, may want to extract more information from existing binaries. Thus we must take into account modification time of the libvirtd daemon and/or any loadable driver modules when checking cache validity
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> ---
+++ b/src/qemu/qemu_capabilities.c @@ -2564,18 +2564,21 @@ virQEMUCapsSaveCache(virQEMUCapsPtr qemuCaps, const char *filename) goto cleanup; }
- ut.actime = qemuCaps->mtime; - ut.modtime = qemuCaps->mtime; + ut.modtime = virGetSelfLastModified(); + if (qemuCaps->mtime > ut.modtime) + ut.modtime = qemuCaps->mtime; +
I'm still thinking that mtime is a bit dangerous, compared to ctime.
+ ut.actime = ut.modtime; if (utime(filename, &ut) < 0) { virReportSystemError(errno, - _("Failed to set mtime on '%s' for '%s'"), - filename, qemuCaps->binary); + _("Failed to set mtime on '%s' for '%s' to %lld"), + filename, qemuCaps->binary, (long long)ut.modtime);
If you go by ctime, you can't use utime() (or the modern futimens counterpart). I'm also still not convinced that just storing the time in the xml file is going to be any slower than playing file timestamp games. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org