qemu: add explicit flag to skip qemu caps invalidation

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.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2019-12-20 11:56:38 +00:00
parent 6337311358
commit 25db737471
2 changed files with 17 additions and 0 deletions

View File

@ -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;

View File

@ -36,6 +36,9 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch,
unsigned int microcodeVersion,
const char *kernelVersion);
void virQEMUCapsSetInvalidation(virQEMUCapsPtr qemuCaps,
bool enabled);
int virQEMUCapsLoadCache(virArch hostArch,
virQEMUCapsPtr qemuCaps,
const char *filename);