On Thu, Nov 03, 2016 at 16:37:59 +0100, Pavel Hrdina wrote:
On Wed, Nov 02, 2016 at 10:22:35AM +0100, Jiri Denemark wrote:
> Let's keep all run time validation of cached QEMU capabilities in
> virQEMUCapsIsValid and call it whenever we access the cache.
> virQEMUCapsInitCached should keep only the checks which do not make
> sense once the cache is loaded in memory.
>
> Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
> ---
> src/qemu/qemu_capabilities.c | 59 ++++++++++++++++++++++++++++++--------------
> src/qemu/qemu_capabilities.h | 3 ++-
> 2 files changed, 42 insertions(+), 20 deletions(-)
..
> + return false;
> + }
> + ctime = sb.st_ctime;
> + }
> +
> + if (ctime != qemuCaps->ctime) {
> + VIR_DEBUG("Dropping cached capabilities for '%s': "
> + "binary is newer than cache (%lld vs %lld)",
> + qemuCaps->binary,
> + (long long) ctime, (long long) qemuCaps->ctime);
... same here. This function doesn't drop the capabilities.
ACK, the suggested change is only for debug logs so I'll leave it up to you,
but it would be cleaner :)
Yeah, the suggested changes make sense. I moved the "Dropping..."
message to the place where we actually drop the cache and pushed the
result.
Thanks,
Jirka