]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
Cache result of QEMU capabilities extraction
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 5 Mar 2014 16:51:59 +0000 (16:51 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 11 Mar 2014 10:59:00 +0000 (10:59 +0000)
commitcbde35899b901ab3f3108110f23ebf944d7aed74
tree0c2ccbc53e5ed8cd79b9d2d0e048644841d2cff4
parentf5059a929e0db6689e908e354b13a60661c143e1
Cache result of QEMU capabilities extraction

Extracting capabilities from QEMU takes a notable amount of time
when all QEMU binaries are installed. Each system emulator
needs about 200-300ms multiplied by 26 binaries == ~5-8 seconds.

This change causes the QEMU driver to save an XML file containing
the content of the virQEMUCaps object instance in the cache
dir eg /var/cache/libvirt/qemu/capabilities/$SHA256(binarypath).xml
or $HOME/.cache/libvirt/qemu/cache/capabilities/$SHA256(binarypath).xml

We attempt to load this and only if it fails, do we fallback to
probing the QEMU binary. The ctime of the QEMU binary and libvirtd
are stored in the cached file and its data discarded if either
of them change.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h
src/qemu/qemu_driver.c