[libvirt] [PATCH 3/4] Cache result of QEMU capabilities extraction

Daniel P. Berrange berrange at redhat.com
Thu Mar 6 09:30:44 UTC 2014


On Wed, Mar 05, 2014 at 09:40:34PM +0100, Guido Günther wrote:
> Hi Daniel,
> On Wed, Mar 05, 2014 at 05:53:53PM +0000, Daniel P. Berrange wrote:
> [..snip..] 
> > +    /* Discard if cache is older that QEMU binary */
> > +    /* XXX must also compare to libvirtd timestamp  */
> > +    if (sb.st_mtime < qemuCaps->mtime) {
> I think looking at the mtime isn't sufficent here. Tools like dpkg set
> the mtime to the time the package was built at not the installation time
> so we might end up updating qemu but still having an mtime older than
> the time the xml was created (same holds for downgrades to older qemu
> versions) or are we simply requiring distributors to clean the cache
> upon package upgrades (which would mandate using a trigger)?

NB the existing code already has the flaw you speak of - we cache the
capabilities in memory currently and only invalidate when mtime is
outdated.

> Maybe we need to actually calculate the binaries checksum not only the
> pathname? We could then simply just wipe alle checksums upon libvirt
> upgrades to get rid of old entries.

Checksumming the binary content is reasonably heavyweight, but we could
just use ctime like Eric suggests

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list