summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2022-02-16 12:13:16 -0500
committerCole Robinson <crobinso@redhat.com>2022-02-16 14:03:44 -0500
commit2c477f330244e04614e174f50fbf37260c535705 (patch)
treed0d8cc0f2c5ede3e598fc0a1b55fef3263111c20
parentfc9a22afe0df6a9803d2510ab92aaf8ee3caf012 (diff)
downloadvirt-manager-2c477f330244e04614e174f50fbf37260c535705.tar.gz
domain: cpu: Use host-passthrough by default on x86
When libvirt and qemu are new enough, use host-passthrough for the CPU default. Nowadays this is recommended over host-model for most end user usage where migration isn't a critical feature. Signed-off-by: Cole Robinson <crobinso@redhat.com>
-rw-r--r--tests/data/cli/compare/virt-install-boot-uefi-oldcaps.xml2
-rw-r--r--tests/data/cli/compare/virt-install-boot-uefi.xml2
-rw-r--r--tests/data/cli/compare/virt-install-cdrom-centos-label.xml4
-rw-r--r--tests/data/cli/compare/virt-install-f21-kvm-remote.xml2
-rw-r--r--tests/data/cli/compare/virt-install-graphics-usb-disable.xml2
-rw-r--r--tests/data/cli/compare/virt-install-kvm-centos7.xml4
-rw-r--r--tests/data/cli/compare/virt-install-kvm-rhel5.xml4
-rw-r--r--tests/data/cli/compare/virt-install-kvm-rhel6.xml4
-rw-r--r--tests/data/cli/compare/virt-install-kvm-rhel7.xml4
-rw-r--r--tests/data/cli/compare/virt-install-kvm-session-defaults.xml4
-rw-r--r--tests/data/cli/compare/virt-install-kvm-win10.xml4
-rw-r--r--tests/data/cli/compare/virt-install-kvm-win2k3-cdrom.xml4
-rw-r--r--tests/data/cli/compare/virt-install-linux2020.xml4
-rw-r--r--tests/data/cli/compare/virt-install-location-iso.xml4
-rw-r--r--tests/data/cli/compare/virt-install-location-manual-kernel.xml4
-rw-r--r--tests/data/cli/compare/virt-install-network-install-resources.xml4
-rw-r--r--tests/data/cli/compare/virt-install-openbsd-defaults.xml2
-rw-r--r--tests/data/cli/compare/virt-install-osinfo-multiple-short-id.xml4
-rw-r--r--tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml4
-rw-r--r--tests/data/cli/compare/virt-install-osinfo-unattended-treeapis.xml4
-rw-r--r--tests/data/cli/compare/virt-install-osinfo-url-unattended.xml4
-rw-r--r--tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml4
-rw-r--r--tests/data/cli/compare/virt-install-osinfo-url.xml4
-rw-r--r--tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml4
-rw-r--r--tests/data/cli/compare/virt-install-q35-defaults.xml4
-rw-r--r--tests/data/cli/compare/virt-install-win7-uefi.xml4
-rw-r--r--tests/data/cli/compare/virt-install-x86_64-graphics.xml2
-rw-r--r--tests/data/cli/compare/virt-install-x86_64-headless.xml2
-rw-r--r--virtinst/domain/cpu.py24
-rw-r--r--virtinst/domcapabilities.py22
30 files changed, 82 insertions, 62 deletions
diff --git a/tests/data/cli/compare/virt-install-boot-uefi-oldcaps.xml b/tests/data/cli/compare/virt-install-boot-uefi-oldcaps.xml
index 92e4053b..11ef2cfd 100644
--- a/tests/data/cli/compare/virt-install-boot-uefi-oldcaps.xml
+++ b/tests/data/cli/compare/virt-install-boot-uefi-oldcaps.xml
@@ -15,7 +15,7 @@
<smm state="on"/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-boot-uefi.xml b/tests/data/cli/compare/virt-install-boot-uefi.xml
index 651498b1..e95f1407 100644
--- a/tests/data/cli/compare/virt-install-boot-uefi.xml
+++ b/tests/data/cli/compare/virt-install-boot-uefi.xml
@@ -13,7 +13,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-cdrom-centos-label.xml b/tests/data/cli/compare/virt-install-cdrom-centos-label.xml
index a0bc4a12..f5705c05 100644
--- a/tests/data/cli/compare/virt-install-cdrom-centos-label.xml
+++ b/tests/data/cli/compare/virt-install-cdrom-centos-label.xml
@@ -19,7 +19,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -98,7 +98,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-f21-kvm-remote.xml b/tests/data/cli/compare/virt-install-f21-kvm-remote.xml
index 5c38039b..633e840a 100644
--- a/tests/data/cli/compare/virt-install-f21-kvm-remote.xml
+++ b/tests/data/cli/compare/virt-install-f21-kvm-remote.xml
@@ -18,7 +18,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-graphics-usb-disable.xml b/tests/data/cli/compare/virt-install-graphics-usb-disable.xml
index 7007ccaf..d27a9d62 100644
--- a/tests/data/cli/compare/virt-install-graphics-usb-disable.xml
+++ b/tests/data/cli/compare/virt-install-graphics-usb-disable.xml
@@ -18,7 +18,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-kvm-centos7.xml b/tests/data/cli/compare/virt-install-kvm-centos7.xml
index f9b0b234..4f8f9554 100644
--- a/tests/data/cli/compare/virt-install-kvm-centos7.xml
+++ b/tests/data/cli/compare/virt-install-kvm-centos7.xml
@@ -19,7 +19,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -87,7 +87,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-kvm-rhel5.xml b/tests/data/cli/compare/virt-install-kvm-rhel5.xml
index 828428d6..3c7c6a80 100644
--- a/tests/data/cli/compare/virt-install-kvm-rhel5.xml
+++ b/tests/data/cli/compare/virt-install-kvm-rhel5.xml
@@ -19,7 +19,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -88,7 +88,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-kvm-rhel6.xml b/tests/data/cli/compare/virt-install-kvm-rhel6.xml
index 0b1322b6..b236dd83 100644
--- a/tests/data/cli/compare/virt-install-kvm-rhel6.xml
+++ b/tests/data/cli/compare/virt-install-kvm-rhel6.xml
@@ -20,7 +20,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -93,7 +93,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-kvm-rhel7.xml b/tests/data/cli/compare/virt-install-kvm-rhel7.xml
index d9ed1e40..03184d2f 100644
--- a/tests/data/cli/compare/virt-install-kvm-rhel7.xml
+++ b/tests/data/cli/compare/virt-install-kvm-rhel7.xml
@@ -20,7 +20,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -87,7 +87,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-kvm-session-defaults.xml b/tests/data/cli/compare/virt-install-kvm-session-defaults.xml
index aa1a2bfa..0b74cb8b 100644
--- a/tests/data/cli/compare/virt-install-kvm-session-defaults.xml
+++ b/tests/data/cli/compare/virt-install-kvm-session-defaults.xml
@@ -19,7 +19,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -92,7 +92,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-kvm-win10.xml b/tests/data/cli/compare/virt-install-kvm-win10.xml
index 39d20adf..0bdfc47c 100644
--- a/tests/data/cli/compare/virt-install-kvm-win10.xml
+++ b/tests/data/cli/compare/virt-install-kvm-win10.xml
@@ -24,7 +24,7 @@
</hyperv>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -96,7 +96,7 @@
</hyperv>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-kvm-win2k3-cdrom.xml b/tests/data/cli/compare/virt-install-kvm-win2k3-cdrom.xml
index 8a2f48d4..2f6fd8a1 100644
--- a/tests/data/cli/compare/virt-install-kvm-win2k3-cdrom.xml
+++ b/tests/data/cli/compare/virt-install-kvm-win2k3-cdrom.xml
@@ -24,7 +24,7 @@
</hyperv>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -96,7 +96,7 @@
</hyperv>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-linux2020.xml b/tests/data/cli/compare/virt-install-linux2020.xml
index b47192da..f9882c26 100644
--- a/tests/data/cli/compare/virt-install-linux2020.xml
+++ b/tests/data/cli/compare/virt-install-linux2020.xml
@@ -19,7 +19,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -87,7 +87,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-location-iso.xml b/tests/data/cli/compare/virt-install-location-iso.xml
index 2b3bef30..28d87f6b 100644
--- a/tests/data/cli/compare/virt-install-location-iso.xml
+++ b/tests/data/cli/compare/virt-install-location-iso.xml
@@ -19,7 +19,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -97,7 +97,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-location-manual-kernel.xml b/tests/data/cli/compare/virt-install-location-manual-kernel.xml
index 6199710f..032d80c7 100644
--- a/tests/data/cli/compare/virt-install-location-manual-kernel.xml
+++ b/tests/data/cli/compare/virt-install-location-manual-kernel.xml
@@ -14,7 +14,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -79,7 +79,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-network-install-resources.xml b/tests/data/cli/compare/virt-install-network-install-resources.xml
index 8e7750de..4a217d07 100644
--- a/tests/data/cli/compare/virt-install-network-install-resources.xml
+++ b/tests/data/cli/compare/virt-install-network-install-resources.xml
@@ -19,7 +19,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -68,7 +68,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-openbsd-defaults.xml b/tests/data/cli/compare/virt-install-openbsd-defaults.xml
index d8cc2f9c..71e66f09 100644
--- a/tests/data/cli/compare/virt-install-openbsd-defaults.xml
+++ b/tests/data/cli/compare/virt-install-openbsd-defaults.xml
@@ -18,7 +18,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-osinfo-multiple-short-id.xml b/tests/data/cli/compare/virt-install-osinfo-multiple-short-id.xml
index 1d720bd1..e099caad 100644
--- a/tests/data/cli/compare/virt-install-osinfo-multiple-short-id.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-multiple-short-id.xml
@@ -18,7 +18,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -72,7 +72,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml b/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml
index 14dbe38b..5b3312c5 100644
--- a/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml
@@ -19,7 +19,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -74,7 +74,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-osinfo-unattended-treeapis.xml b/tests/data/cli/compare/virt-install-osinfo-unattended-treeapis.xml
index b2877072..57d24993 100644
--- a/tests/data/cli/compare/virt-install-osinfo-unattended-treeapis.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-unattended-treeapis.xml
@@ -19,7 +19,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -77,7 +77,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-osinfo-url-unattended.xml b/tests/data/cli/compare/virt-install-osinfo-url-unattended.xml
index 5f1ecf9b..2813978e 100644
--- a/tests/data/cli/compare/virt-install-osinfo-url-unattended.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-url-unattended.xml
@@ -19,7 +19,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -68,7 +68,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml b/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml
index 754ec155..eddebc02 100644
--- a/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml
@@ -19,7 +19,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -78,7 +78,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-osinfo-url.xml b/tests/data/cli/compare/virt-install-osinfo-url.xml
index 840b8e20..f96787db 100644
--- a/tests/data/cli/compare/virt-install-osinfo-url.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-url.xml
@@ -19,7 +19,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -68,7 +68,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml b/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml
index ee5afe63..3a5b1df0 100644
--- a/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml
@@ -22,7 +22,7 @@
<spinlocks state="on" retries="8191"/>
</hyperv>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -98,7 +98,7 @@
<spinlocks state="on" retries="8191"/>
</hyperv>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-q35-defaults.xml b/tests/data/cli/compare/virt-install-q35-defaults.xml
index 3defcf5a..eafb720c 100644
--- a/tests/data/cli/compare/virt-install-q35-defaults.xml
+++ b/tests/data/cli/compare/virt-install-q35-defaults.xml
@@ -14,7 +14,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -84,7 +84,7 @@
<apic/>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-win7-uefi.xml b/tests/data/cli/compare/virt-install-win7-uefi.xml
index 0d072268..702ebf5f 100644
--- a/tests/data/cli/compare/virt-install-win7-uefi.xml
+++ b/tests/data/cli/compare/virt-install-win7-uefi.xml
@@ -26,7 +26,7 @@
</hyperv>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
@@ -112,7 +112,7 @@
</hyperv>
<vmport state="off"/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-x86_64-graphics.xml b/tests/data/cli/compare/virt-install-x86_64-graphics.xml
index 932d9ad7..b72f7c52 100644
--- a/tests/data/cli/compare/virt-install-x86_64-graphics.xml
+++ b/tests/data/cli/compare/virt-install-x86_64-graphics.xml
@@ -17,7 +17,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/tests/data/cli/compare/virt-install-x86_64-headless.xml b/tests/data/cli/compare/virt-install-x86_64-headless.xml
index f2e868a6..d0fc9e4b 100644
--- a/tests/data/cli/compare/virt-install-x86_64-headless.xml
+++ b/tests/data/cli/compare/virt-install-x86_64-headless.xml
@@ -17,7 +17,7 @@
<acpi/>
<apic/>
</features>
- <cpu mode="host-model"/>
+ <cpu mode="host-passthrough"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
diff --git a/virtinst/domain/cpu.py b/virtinst/domain/cpu.py
index 23ded402..d74c3ffc 100644
--- a/virtinst/domain/cpu.py
+++ b/virtinst/domain/cpu.py
@@ -260,14 +260,26 @@ class DomainCpu(XMLBuilder):
SPECIAL_MODE_HOST_COPY, SPECIAL_MODE_HOST_MODEL,
SPECIAL_MODE_HOST_PASSTHROUGH, SPECIAL_MODE_CLEAR,
SPECIAL_MODE_APP_DEFAULT]
+
+ def _get_app_default_mode(self, guest):
+ # Depending on if libvirt+qemu is new enough, we prefer
+ # host-passthrough, then host-model, and finally host-model-only
+ domcaps = guest.lookup_domcaps()
+
+ if domcaps.supports_safe_host_passthrough():
+ return self.SPECIAL_MODE_HOST_PASSTHROUGH
+
+ log.debug("Safe host-passthrough is not available")
+ if domcaps.supports_safe_host_model():
+ return self.SPECIAL_MODE_HOST_MODEL
+
+ log.debug("Safe host-model is not available")
+ return self.SPECIAL_MODE_HOST_MODEL_ONLY
+
def set_special_mode(self, guest, val):
if val == self.SPECIAL_MODE_APP_DEFAULT:
- # If libvirt is new enough to support reliable mode=host-model
- # then use it, otherwise use previous default HOST_MODEL_ONLY
- domcaps = guest.lookup_domcaps()
- val = self.SPECIAL_MODE_HOST_MODEL_ONLY
- if domcaps.supports_safe_host_model():
- val = self.SPECIAL_MODE_HOST_MODEL
+ val = self._get_app_default_mode(guest)
+ log.debug("Using default cpu mode=%s", val)
if (val == self.SPECIAL_MODE_HOST_MODEL or
val == self.SPECIAL_MODE_HOST_PASSTHROUGH):
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index 4a217556..99a9a518 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -129,10 +129,9 @@ class _CPUModel(XMLBuilder):
fallback = XMLProperty("./@fallback")
-class _CPUMode(XMLBuilder):
+class _CPUMode(_CapsBlock):
XML_NAME = "mode"
name = XMLProperty("./@name")
- supported = XMLProperty("./@supported", is_yesno=True)
models = XMLChildProperty(_CPUModel)
def get_model(self, name):
@@ -265,11 +264,20 @@ class DomainCapabilities(XMLBuilder):
host-model in fact predates this support, however it wasn't
general purpose safe prior to domcaps advertisement.
"""
- for m in self.cpu.modes:
- if (m.name == "host-model" and m.supported and
- m.models[0].fallback == "forbid"):
- return True
- return False
+ m = self.cpu.get_mode("host-model")
+ return (m and m.supported and
+ m.models[0].fallback == "forbid")
+
+ def supports_safe_host_passthrough(self):
+ """
+ Return True if host-passthrough is safe enough to use by default.
+ We limit this to domcaps new enough to report whether host-passthrough
+ is migratable or not, which also means libvirt is about new enough
+ to not taint the VM for using host-passthrough
+ """
+ m = self.cpu.get_mode("host-passthrough")
+ return (m and m.supported and
+ "on" in m.get_enum("hostPassthroughMigratable").get_values())
def get_cpu_models(self):
models = []