[libvirt] [PATCH 4/4] Refresh qemu capabilities if libvirtd binary changes

Eric Blake eblake at redhat.com
Thu Mar 6 01:46:28 UTC 2014


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 at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140305/22da8e49/attachment-0001.sig>


More information about the libvir-list mailing list