mirror of
https://src.fedoraproject.org/rpms/virt-manager.git
synced 2025-07-15 16:53:32 +00:00
174 lines
6.8 KiB
Diff
174 lines
6.8 KiB
Diff
From eea16141b79aeee41986b48b66311da89e504f2f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk@redhat.com>
|
|
Date: Tue, 5 Apr 2022 15:57:42 +0200
|
|
Subject: [PATCH] devices: video: Use virtio default more often
|
|
|
|
---
|
|
.../virt-install-graphics-usb-disable.xml | 2 +-
|
|
.../virt-install-kvm-fedoralatest-url.xml | 4 ++--
|
|
.../virt-install-singleton-config-2.xml | 4 ++--
|
|
.../compare/virt-install-x86_64-graphics.xml | 2 +-
|
|
virtinst/devices/video.py | 9 +++++++
|
|
virtinst/domcapabilities.py | 24 +++++++++++++++++++
|
|
virtinst/osdict.py | 5 ++++
|
|
7 files changed, 44 insertions(+), 6 deletions(-)
|
|
|
|
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 d594851..0ffcd26 100644
|
|
--- a/tests/data/cli/compare/virt-install-graphics-usb-disable.xml
|
|
+++ b/tests/data/cli/compare/virt-install-graphics-usb-disable.xml
|
|
@@ -54,7 +54,7 @@
|
|
</graphics>
|
|
<sound model="ich9"/>
|
|
<video>
|
|
- <model type="qxl"/>
|
|
+ <model type="virtio"/>
|
|
</video>
|
|
<memballoon model="virtio"/>
|
|
<rng model="virtio">
|
|
diff --git a/tests/data/cli/compare/virt-install-kvm-fedoralatest-url.xml b/tests/data/cli/compare/virt-install-kvm-fedoralatest-url.xml
|
|
index a55e7ce..9d689de 100644
|
|
--- a/tests/data/cli/compare/virt-install-kvm-fedoralatest-url.xml
|
|
+++ b/tests/data/cli/compare/virt-install-kvm-fedoralatest-url.xml
|
|
@@ -49,7 +49,7 @@
|
|
<image compression="off"/>
|
|
</graphics>
|
|
<video>
|
|
- <model type="qxl"/>
|
|
+ <model type="virtio"/>
|
|
</video>
|
|
<memballoon model="virtio"/>
|
|
<rng model="virtio">
|
|
@@ -106,7 +106,7 @@
|
|
<image compression="off"/>
|
|
</graphics>
|
|
<video>
|
|
- <model type="qxl"/>
|
|
+ <model type="virtio"/>
|
|
</video>
|
|
<memballoon model="virtio"/>
|
|
<rng model="virtio">
|
|
diff --git a/tests/data/cli/compare/virt-install-singleton-config-2.xml b/tests/data/cli/compare/virt-install-singleton-config-2.xml
|
|
index d524fba..10c8897 100644
|
|
--- a/tests/data/cli/compare/virt-install-singleton-config-2.xml
|
|
+++ b/tests/data/cli/compare/virt-install-singleton-config-2.xml
|
|
@@ -198,7 +198,7 @@
|
|
</tpm>
|
|
<graphics type="vnc" port="-1"/>
|
|
<video>
|
|
- <model type="bochs"/>
|
|
+ <model type="virtio"/>
|
|
</video>
|
|
<watchdog model="ib700" action="pause"/>
|
|
<memballoon model="virtio" autodeflate="on">
|
|
@@ -442,7 +442,7 @@
|
|
</tpm>
|
|
<graphics type="vnc" port="-1"/>
|
|
<video>
|
|
- <model type="bochs"/>
|
|
+ <model type="virtio"/>
|
|
</video>
|
|
<watchdog model="ib700" action="pause"/>
|
|
<memballoon model="virtio" autodeflate="on">
|
|
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 c1b06ca..6121ca3 100644
|
|
--- a/tests/data/cli/compare/virt-install-x86_64-graphics.xml
|
|
+++ b/tests/data/cli/compare/virt-install-x86_64-graphics.xml
|
|
@@ -48,7 +48,7 @@
|
|
<input type="tablet" bus="usb"/>
|
|
<graphics type="vnc" port="-1"/>
|
|
<video>
|
|
- <model type="vga"/>
|
|
+ <model type="virtio"/>
|
|
</video>
|
|
<memballoon model="virtio"/>
|
|
<rng model="virtio">
|
|
diff --git a/virtinst/devices/video.py b/virtinst/devices/video.py
|
|
index f938313..585820a 100644
|
|
--- a/virtinst/devices/video.py
|
|
+++ b/virtinst/devices/video.py
|
|
@@ -38,6 +38,15 @@ class DeviceVideo(Device):
|
|
if guest.has_spice() and guest.os.is_x86():
|
|
if guest.has_gl():
|
|
return "virtio"
|
|
+ if (guest.lookup_domcaps().supports_video_virtio() and
|
|
+ guest.osinfo.supports_virtiogpu()):
|
|
+ # When the guest supports it, this is the top preference
|
|
+ return "virtio"
|
|
+ if (guest.os.is_x86() and
|
|
+ guest.has_spice() and
|
|
+ guest.lookup_domcaps().supports_video_qxl()):
|
|
+ # qxl is only beneficial over regular vga when paired with spice.
|
|
+ # The device still may not be available though
|
|
return "qxl"
|
|
if (guest.is_uefi() and
|
|
guest.lookup_domcaps().supports_video_bochs()):
|
|
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
|
|
index 81f664e..ed01a91 100644
|
|
--- a/virtinst/domcapabilities.py
|
|
+++ b/virtinst/domcapabilities.py
|
|
@@ -44,6 +44,9 @@ class _CapsBlock(_HasValues):
|
|
def enum_names(self):
|
|
return [e.name for e in self.enums]
|
|
|
|
+ def has_enum(self, name):
|
|
+ return name in self.enum_names()
|
|
+
|
|
def get_enum(self, name):
|
|
for enum in self.enums:
|
|
if enum.name == name:
|
|
@@ -100,6 +103,7 @@ class _Devices(_CapsBlock):
|
|
hostdev = XMLChildProperty(_make_capsblock("hostdev"), is_single=True)
|
|
disk = XMLChildProperty(_make_capsblock("disk"), is_single=True)
|
|
video = XMLChildProperty(_make_capsblock("video"), is_single=True)
|
|
+ graphics = XMLChildProperty(_make_capsblock("graphics"), is_single=True)
|
|
|
|
|
|
class _Features(_CapsBlock):
|
|
@@ -342,6 +346,26 @@ class DomainCapabilities(XMLBuilder):
|
|
models = self.devices.video.get_enum("modelType").get_values()
|
|
return bool("bochs" in models)
|
|
|
|
+ def supports_video_qxl(self):
|
|
+ if not self.devices.video.has_enum("modelType"):
|
|
+ # qxl long predates modelType in domcaps, so if it is missing,
|
|
+ # use spice support as a rough value
|
|
+ return self.supports_graphics_spice()
|
|
+ return "qxl" in self.devices.video.get_enum("modelType").get_values()
|
|
+
|
|
+ def supports_video_virtio(self):
|
|
+ return "virtio" in self.devices.video.get_enum("modelType").get_values()
|
|
+
|
|
+ def supports_graphics_spice(self):
|
|
+ if not self.devices.graphics.supported:
|
|
+ # domcaps is too old, or the driver doesn't advertise graphics
|
|
+ # support. Use our pre-existing logic
|
|
+ if not self.conn.is_qemu() and not self.conn.is_test():
|
|
+ return False
|
|
+ return self.conn.caps.host.cpu.arch in ["i686", "x86_64"]
|
|
+
|
|
+ return self.devices.graphics.get_enum("type").has_value("spice")
|
|
+
|
|
XML_NAME = "domainCapabilities"
|
|
os = XMLChildProperty(_OS, is_single=True)
|
|
cpu = XMLChildProperty(_CPU, is_single=True)
|
|
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
|
|
index 1273b93..1d83823 100644
|
|
--- a/virtinst/osdict.py
|
|
+++ b/virtinst/osdict.py
|
|
@@ -513,6 +513,11 @@ class _OsVariant(object):
|
|
devids = ["http://usb.org/usb/80ee/0021"]
|
|
return bool(self._device_filter(devids=devids, extra_devs=extra_devs))
|
|
|
|
+ def supports_virtiogpu(self, extra_devs=None):
|
|
+ # virtio1.0-gpu and virtio1.0
|
|
+ devids = ["http://pcisig.com/pci/1af4/1050"]
|
|
+ return bool(self._device_filter(devids=devids, extra_devs=extra_devs))
|
|
+
|
|
def supports_virtiodisk(self, extra_devs=None):
|
|
# virtio-block and virtio1.0-block
|
|
devids = ["http://pcisig.com/pci/1af4/1001",
|
|
--
|
|
2.35.1
|
|
|