Currently if the binary path is NULL in the qemu capabilities object,
cache invalidation is skipped. A future patch will ensure that the
binary path is always non-NULL, so a way to explicitly skip invalidation
is required.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 14 ++++++++++++++
src/qemu/qemu_capabilities.h | 3 +++
2 files changed, 17 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 2223589058..cc6d9bbd44 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -612,6 +612,7 @@ struct _virQEMUCaps {
char *binary;
time_t ctime;
time_t libvirtCtime;
+ bool invalidation;
virBitmapPtr flags;
@@ -1633,6 +1634,7 @@ virQEMUCapsNew(void)
if (!(qemuCaps = virObjectNew(virQEMUCapsClass)))
return NULL;
+ qemuCaps->invalidation = true;
if (!(qemuCaps->flags = virBitmapNew(QEMU_CAPS_LAST)))
goto error;
@@ -1647,6 +1649,14 @@ virQEMUCapsNew(void)
}
+void
+virQEMUCapsSetInvalidation(virQEMUCapsPtr qemuCaps,
+ bool enabled)
+{
+ qemuCaps->invalidation = enabled;
+}
+
+
static int
virQEMUCapsHostCPUDataCopy(virQEMUCapsHostCPUDataPtr dst,
virQEMUCapsHostCPUDataPtr src)
@@ -1746,6 +1756,7 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps)
if (!ret)
return NULL;
+ ret->invalidation = qemuCaps->invalidation;
ret->usedQMP = qemuCaps->usedQMP;
ret->kvmSupportsNesting = qemuCaps->kvmSupportsNesting;
@@ -4423,6 +4434,9 @@ virQEMUCapsIsValid(void *data,
struct stat sb;
bool kvmSupportsNesting;
+ if (!qemuCaps->invalidation)
+ return true;
+
if (!qemuCaps->binary)
return true;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 1b2522126c..7488b9ddb8 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -545,6 +545,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUCaps, virObjectUnref);
virQEMUCapsPtr virQEMUCapsNew(void);
+void virQEMUCapsSetInvalidation(virQEMUCapsPtr qemuCaps,
+ bool enabled);
+
void virQEMUCapsSet(virQEMUCapsPtr qemuCaps,
virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1);
--
2.23.0