提交 25db7374 编写于 作者: D Daniel P. Berrangé

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: NMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 63373113
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册