[libvirt] [PATCH 4/7] qemu: conf: Cache domCaps in qemuCaps

Michal Privoznik mprivozn at redhat.com
Mon Apr 29 12:35:26 UTC 2019


On 4/5/19 1:37 AM, Cole Robinson wrote:
> qemuCaps is tied to a binary on disk. domCaps is tied to a combo
> of binary+machine+arch+virttype values. For the qemu driver this almost
> entirely translates to a permutation of qemuCaps though
> 
> Upcoming patches want to use the domCaps data store at XML validate
> time, but we need to cache the data so we aren't repeatedly
> regenerating it.
> 
> Add a domCapsCache hash table to qemuCaps. This ensures that the domCaps
> cache is blown away whenever qemuCaps needs to be regenerated. Adjust
> virQEMUDriverGetDomainCapabilities to search the cache and add to it
> if we don't find a hit.
> 
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>   src/qemu/qemu_capabilities.c | 11 +++++++
>   src/qemu/qemu_capabilities.h |  1 +
>   src/qemu/qemu_conf.c         | 59 +++++++++++++++++++++++++++++++-----
>   3 files changed, 64 insertions(+), 7 deletions(-)
> 

At first I was affraid, I was petrified, that we will need to invalidate 
this cache whenever corresponding qemuCaps is invalidated. But that 
should be done automatically, because virQEMUCapsCacheLookup() unrefs 
qemuCaps when if finds outdated capabilities.

Might be worth mentioning in the commit message. Or not. Your call.

Michal




More information about the libvir-list mailing list