From a discussion last year[1], Dan recommended libvirt drop the tain
flag for cpu host-passthrough, unless the VM has been migrated.
This repurposes the existing host-cpu taint flag to do just that.
[1]:
https://www.redhat.com/archives/virt-tools-list/2019-February/msg00041.html
https://bugzilla.redhat.com/show_bug.cgi?id=1673098
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/conf/domain_conf.h | 2 +-
src/qemu/qemu_domain.c | 7 +++++--
src/qemu/qemu_domain.h | 3 ++-
src/qemu/qemu_process.c | 2 +-
4 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9a44315519..450686dfb5 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2736,7 +2736,7 @@ typedef enum {
VIR_DOMAIN_TAINT_SHELL_SCRIPTS, /* Network configuration using opaque shell
scripts */
VIR_DOMAIN_TAINT_DISK_PROBING, /* Relying on potentially unsafe disk format
probing */
VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH, /* Externally launched guest domain */
- VIR_DOMAIN_TAINT_HOST_CPU, /* Host CPU passthrough in use */
+ VIR_DOMAIN_TAINT_HOST_CPU, /* Host CPU passthrough in use after migration */
VIR_DOMAIN_TAINT_HOOK, /* Domain (possibly) changed via hook script */
VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,/* CDROM passthrough */
VIR_DOMAIN_TAINT_CUSTOM_DTB, /* Custom device tree blob was specified */
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0331fd55e0..ed4bdbd7fb 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6115,7 +6115,8 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver,
void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- qemuDomainLogContextPtr logCtxt)
+ qemuDomainLogContextPtr logCtxt,
+ bool incomingMigration)
{
size_t i;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
@@ -6144,7 +6145,9 @@ void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, logCtxt);
}
- if (obj->def->cpu && obj->def->cpu->mode ==
VIR_CPU_MODE_HOST_PASSTHROUGH)
+ if (obj->def->cpu &&
+ obj->def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH &&
+ incomingMigration)
qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HOST_CPU, logCtxt);
for (i = 0; i < obj->def->ndisks; i++)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index ec776ced72..9bf32e16c9 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -567,7 +567,8 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver,
void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- qemuDomainLogContextPtr logCtxt);
+ qemuDomainLogContextPtr logCtxt,
+ bool incomingMigration);
void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
virDomainObjPtr obj,
virDomainDiskDefPtr disk,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9122069cc9..57d764014a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6856,7 +6856,7 @@ qemuProcessLaunch(virConnectPtr conn,
qemuLogOperation(vm, "starting up", cmd, logCtxt);
- qemuDomainObjCheckTaint(driver, vm, logCtxt);
+ qemuDomainObjCheckTaint(driver, vm, logCtxt, incoming != NULL);
qemuDomainLogContextMarkPosition(logCtxt);
--
2.28.0