summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2018-10-04 14:59:54 -0400
committerCole Robinson <crobinso@redhat.com>2018-10-13 14:58:57 -0400
commitedab908f42365769dd90c84efa2ac768ee3d3ff9 (patch)
tree23291f24df84ab3cca792e3a3a6d80e551a7732d
parenta00152d72a93689964e3910b346460addd3d4048 (diff)
downloadvirt-manager-edab908f42365769dd90c84efa2ac768ee3d3ff9.tar.gz
guest: Use q35 chipset by default for new qemu + supported OS
There's been various discussions about changing the x86 default from 'pc' to 'q35' over the years, but it's unlikely to happen at the qemu or libvirt level for compatibility reasons. So let's start using it for new enough OS that support it.
-rw-r--r--tests/cli-test-xml/compare/virt-install-kvm-fedoralatest-url.xml4
-rw-r--r--tests/cli-test-xml/compare/virt-install-kvm-win10.xml20
-rw-r--r--tests/cli-test-xml/compare/virt-install-many-devices.xml6
-rw-r--r--tests/cli-test-xml/compare/virt-install-singleton-config-1.xml2
-rw-r--r--tests/cli-test-xml/compare/virt-install-singleton-config-2.xml4
-rw-r--r--tests/cli-test-xml/compare/virt-install-spice-gl.xml4
-rw-r--r--tests/cli-test-xml/compare/virt-install-win7-uefi.xml20
-rw-r--r--tests/clitest.py2
-rw-r--r--tests/utils.py4
-rw-r--r--virtinst/guest.py6
-rw-r--r--virtinst/osdict.py11
-rw-r--r--virtinst/support.py4
12 files changed, 52 insertions, 35 deletions
diff --git a/tests/cli-test-xml/compare/virt-install-kvm-fedoralatest-url.xml b/tests/cli-test-xml/compare/virt-install-kvm-fedoralatest-url.xml
index 5d90e774..a08703c9 100644
--- a/tests/cli-test-xml/compare/virt-install-kvm-fedoralatest-url.xml
+++ b/tests/cli-test-xml/compare/virt-install-kvm-fedoralatest-url.xml
@@ -10,7 +10,7 @@
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
<kernel>/tmp/virtinst-vmlinuz.</kernel>
<initrd>/tmp/virtinst-initrd.img.</initrd>
<cmdline>console=ttyS0 method=tests/cli-test-xml/fakefedoratree</cmdline>
@@ -68,7 +68,7 @@
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
<boot dev="hd"/>
</os>
<features>
diff --git a/tests/cli-test-xml/compare/virt-install-kvm-win10.xml b/tests/cli-test-xml/compare/virt-install-kvm-win10.xml
index c9609411..ca95a796 100644
--- a/tests/cli-test-xml/compare/virt-install-kvm-win10.xml
+++ b/tests/cli-test-xml/compare/virt-install-kvm-win10.xml
@@ -10,7 +10,7 @@
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
<boot dev="cdrom"/>
<boot dev="hd"/>
</os>
@@ -41,19 +41,19 @@
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol1.img"/>
- <target dev="hda" bus="ide"/>
+ <target dev="sda" bus="sata"/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol2.img"/>
- <target dev="hdb" bus="ide"/>
+ <target dev="sdb" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15"/>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
- <model type="e1000"/>
+ <model type="e1000e"/>
</interface>
<console type="pty"/>
<channel type="spicevmc">
@@ -63,7 +63,7 @@
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
<image compression="off"/>
</graphics>
- <sound model="ich6"/>
+ <sound model="ich9"/>
<video>
<model type="qxl"/>
</video>
@@ -83,7 +83,7 @@
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
<boot dev="hd"/>
</os>
<features>
@@ -112,19 +112,19 @@
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol1.img"/>
- <target dev="hda" bus="ide"/>
+ <target dev="sda" bus="sata"/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol2.img"/>
- <target dev="hdb" bus="ide"/>
+ <target dev="sdb" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15"/>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
- <model type="e1000"/>
+ <model type="e1000e"/>
</interface>
<console type="pty"/>
<channel type="spicevmc">
@@ -134,7 +134,7 @@
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
<image compression="off"/>
</graphics>
- <sound model="ich6"/>
+ <sound model="ich9"/>
<video>
<model type="qxl"/>
</video>
diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml
index f7510ef5..ebc347e8 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -10,7 +10,7 @@
<currentMemory>65536</currentMemory>
<vcpu placement="static">4</vcpu>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
</os>
<features>
<acpi/>
@@ -313,9 +313,9 @@
<image compression="off"/>
<listen type="socket" socket="/tmp/foobar"/>
</graphics>
- <sound model="ich6"/>
+ <sound model="ich9"/>
<sound model="ac97"/>
- <sound model="ich6">
+ <sound model="ich9">
<codec type="micro"/>
<codec type="duplex"/>
<codec type="output"/>
diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml
index db0f54ff..009d3e29 100644
--- a/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml
+++ b/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml
@@ -20,7 +20,7 @@
<partition>/virtualmachines/production</partition>
</resource>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
<loader readonly="yes" type="pflash">/usr/share/OVMF/OVMF_CODE.fd</loader>
<boot dev="hd"/>
<smbios mode="emulate"/>
diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
index 0e76a3af..621639e1 100644
--- a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
+++ b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
@@ -66,7 +66,7 @@
</sysinfo>
<bootloader>/new/bootld</bootloader>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
<loader>/foo/bar</loader>
<boot dev="network"/>
<smbios mode="sysinfo"/>
@@ -252,7 +252,7 @@
</sysinfo>
<bootloader>/new/bootld</bootloader>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
<loader>/foo/bar</loader>
<boot dev="cdrom"/>
<boot dev="fd"/>
diff --git a/tests/cli-test-xml/compare/virt-install-spice-gl.xml b/tests/cli-test-xml/compare/virt-install-spice-gl.xml
index ba379495..723ea9f6 100644
--- a/tests/cli-test-xml/compare/virt-install-spice-gl.xml
+++ b/tests/cli-test-xml/compare/virt-install-spice-gl.xml
@@ -10,7 +10,7 @@
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
<boot dev="hd"/>
</os>
<features>
@@ -49,7 +49,7 @@
<gl enable="yes" rendernode="/dev/dri/by-path/pci-0000:00:02.0-render"/>
<image compression="off"/>
</graphics>
- <sound model="ich6"/>
+ <sound model="ich9"/>
<video>
<model type="virtio">
<acceleration accel3d="yes"/>
diff --git a/tests/cli-test-xml/compare/virt-install-win7-uefi.xml b/tests/cli-test-xml/compare/virt-install-win7-uefi.xml
index de66eb10..61791d70 100644
--- a/tests/cli-test-xml/compare/virt-install-win7-uefi.xml
+++ b/tests/cli-test-xml/compare/virt-install-win7-uefi.xml
@@ -10,7 +10,7 @@
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
<loader type="pflash">CODE.fd</loader>
<nvram template="VARS.fd"/>
<boot dev="cdrom"/>
@@ -37,12 +37,12 @@
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol1.img"/>
- <target dev="hda" bus="ide"/>
+ <target dev="sda" bus="sata"/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol2.img"/>
- <target dev="hdb" bus="ide"/>
+ <target dev="sdb" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="ich9-ehci1"/>
@@ -58,7 +58,7 @@
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
- <model type="e1000"/>
+ <model type="e1000e"/>
</interface>
<console type="pty"/>
<channel type="spicevmc">
@@ -68,7 +68,7 @@
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
<image compression="off"/>
</graphics>
- <sound model="ich6"/>
+ <sound model="ich9"/>
<video>
<model type="qxl"/>
</video>
@@ -88,7 +88,7 @@
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
- <type arch="x86_64" machine="pc">hvm</type>
+ <type arch="x86_64" machine="q35">hvm</type>
<loader type="pflash">CODE.fd</loader>
<nvram template="VARS.fd"/>
<boot dev="hd"/>
@@ -113,12 +113,12 @@
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol1.img"/>
- <target dev="hda" bus="ide"/>
+ <target dev="sda" bus="sata"/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol2.img"/>
- <target dev="hdb" bus="ide"/>
+ <target dev="sdb" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="ich9-ehci1"/>
@@ -134,7 +134,7 @@
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
- <model type="e1000"/>
+ <model type="e1000e"/>
</interface>
<console type="pty"/>
<channel type="spicevmc">
@@ -144,7 +144,7 @@
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
<image compression="off"/>
</graphics>
- <sound model="ich6"/>
+ <sound model="ich9"/>
<video>
<model type="qxl"/>
</video>
diff --git a/tests/clitest.py b/tests/clitest.py
index 90b0f9f6..e6488cd6 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -734,7 +734,7 @@ c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel7.0", "kvm-rhel7", sk
c.add_compare("--connect " + utils.URIs.kvm_nodomcaps + " --disk %(EXISTIMG1)s --pxe --os-variant rhel7.0", "kvm-cpu-default-fallback", skip_check=OLD_OSINFO) # No domcaps, so mode=host-model isn't safe, so we fallback to host-model-only
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant centos7.0", "kvm-centos7", skip_check=OLD_OSINFO) # Centos 7 defaults
c.add_compare("--disk %(EXISTIMG1)s --cdrom %(EXISTIMG2)s --os-variant win10", "kvm-win10", skip_check=OLD_OSINFO) # win10 defaults
-c.add_compare("--os-variant win7 --cdrom %(EXISTIMG2)s --boot loader_type=pflash,loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s", "win7-uefi") # no HYPER-V with UEFI
+c.add_compare("--os-variant win7 --cdrom %(EXISTIMG2)s --boot loader_type=pflash,loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s", "win7-uefi", skip_check=OLD_OSINFO) # no HYPER-V with UEFI
c.add_compare("--arch i686 --boot uefi --pxe --disk none", "kvm-i686-uefi") # i686 uefi
c.add_compare("--machine q35 --cdrom %(EXISTIMG2)s --disk %(EXISTIMG1)s", "q35-defaults") # proper q35 disk defaults
c.add_compare("--disk size=20 --os-variant solaris10", "solaris10-defaults") # test solaris OS defaults, triggers a couple specific code paths
diff --git a/tests/utils.py b/tests/utils.py
index c46db5e8..f85f4bf5 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -32,10 +32,10 @@ clistate = _CLIState()
def has_old_osinfo():
# Some tests rely on newer osinfo data. Check for a new condition
# here, and older tests will be skipped
- osname = "rhel7.0"
+ osname = "win7"
if not virtinst.OSDB.lookup_os(osname):
return True
- return not virtinst.OSDB.lookup_os(osname).supports_usb3()
+ return not virtinst.OSDB.lookup_os(osname).supports_chipset_q35()
class _URIs(object):
diff --git a/virtinst/guest.py b/virtinst/guest.py
index c89a4eac..bcdc628a 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -511,13 +511,17 @@ class Guest(XMLBuilder):
def _set_default_machine(self):
if self.os.machine:
return
+
+ capsinfo = self.lookup_capsinfo()
+
if (self.os.is_x86() and
self.conn.is_qemu() and
+ "q35" in capsinfo.machines and
+ self.conn.check_support(self.conn.SUPPORT_QEMU_Q35_DEFAULT) and
self.osinfo.supports_chipset_q35()):
self.os.machine = "q35"
return
- capsinfo = self.lookup_capsinfo()
default = capsinfo.machines and capsinfo.machines[0] or None
self.os.machine = default
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 822c9ae3..28e076da 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -411,8 +411,17 @@ class _OsVariant(object):
devids = ["http://pcisig.com/pci/1b36/0004"]
return bool(self._device_filter(devids=devids))
+ def supports_virtio1(self):
+ # Use virtio1.0-net device as a proxy for virtio1.0 as a whole
+ devids = ["http://pcisig.com/pci/1af4/1041"]
+ return bool(self._device_filter(devids=devids))
+
def supports_chipset_q35(self):
- return False
+ # For our purposes, check for the union of q35 + virtio1.0 support
+ if self.supports_virtionet() and not self.supports_virtio1():
+ return False
+ devids = ["http://qemu.org/chipset/x86/q35"]
+ return bool(self._device_filter(devids=devids))
def get_recommended_resources(self, guest):
ret = {}
diff --git a/virtinst/support.py b/virtinst/support.py
index 21333196..b469e36a 100644
--- a/virtinst/support.py
+++ b/virtinst/support.py
@@ -268,6 +268,10 @@ SUPPORT_CONN_MACHVIRT_PCI_DEFAULT = _make(version="3.0.0")
SUPPORT_CONN_QEMU_XHCI = _make(version="3.3.0", hv_version={"qemu": "2.9.0"})
SUPPORT_CONN_VNC_NONE_AUTH = _make(hv_version={"qemu": "2.9.0"})
+# We choose qemu 2.11.0 as the first version to target for q35 default.
+# That's not really based on anything except reasonably modern at the
+# time of these patches.
+SUPPORT_QEMU_Q35_DEFAULT = _make(hv_version={"qemu": "2.11.0", "test": "0"})
# This is for disk <driver name=qemu>. xen supports this, but it's
# limited to arbitrary new enough xen, since I know libxl can handle it