diff options
author | Cole Robinson <crobinso@redhat.com> | 2022-02-03 13:11:20 -0500 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2022-02-03 13:42:49 -0500 |
commit | 1ab6dd50bec5e6d8a36b4295b3051045c703402d (patch) | |
tree | 5467e1927fa752155c9245d4d1c77f5273f2f81f /virtinst | |
parent | f291ad254176a4ea99f60dec22bcf7dcd3a82239 (diff) | |
download | virt-manager-1ab6dd50bec5e6d8a36b4295b3051045c703402d.tar.gz |
devices: video: Use virtio default more often
This is from Gerd's suggestions here:
https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/
When the guest supports it, we should use virtio. qxl is on the way
out, and the benefits are marginal and add a security and maintenance
burden.
While here, check domcaps that qxl or virtio are actually available.
Modern qemu has device modules, so device support may not be installed.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'virtinst')
-rw-r--r-- | virtinst/devices/video.py | 7 | ||||
-rw-r--r-- | virtinst/domcapabilities.py | 14 | ||||
-rw-r--r-- | virtinst/osdict.py | 5 |
3 files changed, 24 insertions, 2 deletions
diff --git a/virtinst/devices/video.py b/virtinst/devices/video.py index bc4d4253..70067a72 100644 --- a/virtinst/devices/video.py +++ b/virtinst/devices/video.py @@ -44,8 +44,13 @@ class DeviceVideo(Device): # virtio is implied in this case 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()): + 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" diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py index cfee07f3..67bceaa3 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: @@ -359,6 +362,16 @@ 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_tpm_emulator(self): """ Returns False if either libvirt or qemu do not have support for @@ -393,7 +406,6 @@ class DomainCapabilities(XMLBuilder): sourceTypes = self.memorybacking.get_enum("sourceType").get_values() return bool("memfd" in sourceTypes) - 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 8f75e58d..3b6ecca6 100644 --- a/virtinst/osdict.py +++ b/virtinst/osdict.py @@ -469,6 +469,11 @@ class _OsVariant(object): "http://pcisig.com/pci/1af4/1044"] 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_virtioballoon(self, extra_devs=None): # virtio-balloon and virtio1.0-balloon devids = ["http://pcisig.com/pci/1af4/1002", |