Compare commits

..

1 commit

Author SHA1 Message Date
František Zatloukal
4208fa53a8 Backport 4.x change to default to virtio video driver 2022-04-05 16:00:52 +02:00
6 changed files with 261 additions and 144 deletions

1
.gitignore vendored
View file

@ -1,2 +1 @@
/virt-manager-*.tar.gz
/virt-manager-*.tar.xz

View file

@ -0,0 +1,173 @@
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

View file

@ -0,0 +1,44 @@
From 4d0e323227f18e58283c45be4d240b506faacb22 Mon Sep 17 00:00:00 2001
Message-Id: <4d0e323227f18e58283c45be4d240b506faacb22.1610390294.git.crobinso@redhat.com>
From: Martin Pitt <martin@piware.de>
Date: Tue, 24 Nov 2020 14:24:06 +0100
Subject: [PATCH virt-manager] virtinst: Fix TOCTOU in domain enumeration
Similar to commit 49a01b5482, _fetch_all_domains_raw() has a race
condition where a domain may disappear (from parallel libvirt
operations) in between enumerating and inspecting the objects.
Ignore these missing domains instead of crashing.
https://bugzilla.redhat.com/show_bug.cgi?id=1901081
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
virtinst/connection.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/virtinst/connection.py b/virtinst/connection.py
index fec273b7..06bc60ad 100644
--- a/virtinst/connection.py
+++ b/virtinst/connection.py
@@ -182,8 +182,16 @@ class VirtinstConnection(object):
def _fetch_all_domains_raw(self):
dummy1, dummy2, ret = pollhelpers.fetch_vms(
self, {}, lambda obj, ignore: obj)
- return [Guest(weakref.proxy(self), parsexml=obj.XMLDesc(0))
- for obj in ret]
+ domains = []
+ for obj in ret:
+ # TOCTOU race: a domain may go away in between enumeration and inspection
+ try:
+ xml = obj.XMLDesc(0)
+ except libvirt.libvirtError as e: # pragma: no cover
+ log.debug("Fetching domain XML failed: %s", e)
+ continue
+ domains.append(Guest(weakref.proxy(self), parsexml=xml))
+ return domains
def _build_pool_raw(self, poolobj):
return StoragePool(weakref.proxy(self),
--
2.29.2

View file

@ -1,32 +0,0 @@
From ea71cf9a8a4161ce6e19eacf5f0d86d40ab74f23 Mon Sep 17 00:00:00 2001
Message-ID: <ea71cf9a8a4161ce6e19eacf5f0d86d40ab74f23.1767794644.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 29 Sep 2025 16:14:35 +0200
Subject: [PATCH] virtinst: cloudinit: include empty meta-data file
Refactor creation of cloud-init config files introduced a bug where we
stopped including empty meta-data file.
Introduced-by: 5b2d0997a1d2d213b17c227169da64e2fa7d09a6
Fixes: https://github.com/virt-manager/virt-manager/issues/975
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/install/cloudinit.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virtinst/install/cloudinit.py b/virtinst/install/cloudinit.py
index 3f565f399..b2378fbfa 100644
--- a/virtinst/install/cloudinit.py
+++ b/virtinst/install/cloudinit.py
@@ -36,7 +36,7 @@ class _CloudInitConfig:
def _create_file(self):
content = self._content()
- if not content:
+ if content is None:
return None
fileobj = tempfile.NamedTemporaryFile(
--
2.52.0

View file

@ -1 +1 @@
SHA512 (virt-manager-5.1.0.tar.xz) = 6306500ae442a6ccb36d5f19bc26b0e32984ca145ee8d41a475e175ee4db6c0d253f0cf9d908c30e3269cf7aabdad4bbd30e84f3cd0477f233da1e43e0235e3c
SHA512 (virt-manager-3.2.0.tar.gz) = 90cd98fe6b269007cd30f628490c65df440abe39b4925c65dc80667e7d80d059752695353ccf6ac3e2436206da311bc402eda50df31874d82ef8fe115966e1ec

View file

@ -1,33 +1,39 @@
# -*- rpm-spec -*-
%global default_hvs "qemu,xen,lxc"
%global have_spice %{defined fedora}
%global with_guestfs 0
%global default_hvs "qemu,xen,lxc"
# End local config
Name: virt-manager
Version: 5.1.0
Version: 3.2.0
Release: 5%{?dist}
%global verrel %{version}-%{release}
Summary: Desktop tool for managing virtual machines via libvirt
License: GPL-2.0-or-later
License: GPLv2+
BuildArch: noarch
URL: https://virt-manager.org/
Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.xz
Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz
# Fix 'domain not found' race (bz #1901081)
Patch0001: 0001-virtinst-Fix-TOCTOU-in-domain-enumeration.patch
# Use virtio as a video adapter by default
# Backport of https://github.com/virt-manager/virt-manager/commit/1ab6dd50bec5e6d8a36b4295b3051045c703402d
Patch0002: 0001-devices-video-Use-virtio-default-more-often.patch
Patch1: 0001-virtinst-cloudinit-include-empty-meta-data-file.patch
Requires: virt-manager-common = %{verrel}
Requires: python3-gobject >= 3.31.3
Requires: gtk3 >= 3.22.0
Requires: python3-gobject
Requires: gtk3
Requires: libvirt-glib >= 0.0.9
Requires: gtk-vnc2
%if %{have_spice}
Requires: spice-gtk3
%endif
# We can work with gtksourceview 3 or gtksourceview4, pick the latest one
Requires: gtksourceview4
# virt-manager is one of those apps that people will often install onto
# a headless machine for use over SSH. This means the virt-manager dep
@ -35,12 +41,7 @@ Requires: spice-gtk3
# Unfortunately nothing in our chain has an explicit dep on some kind
# of usable gsettings backend, so we explicitly depend on dconf so that
# user settings actually persist across app runs.
#
# That said, we skip this dep for flatpak, where dconf isn't used in
# the runtime. gsettings defaults to ini file in that case
%if ! 0%{?flatpak}
Requires: dconf
%endif
# The vte291 package is actually the latest vte with API version 2.91, while
# the vte3 package is effectively a compat package with API version 2.90.
@ -48,10 +49,6 @@ Requires: dconf
# no ambiguity.
Requires: vte291
# We can use GtkTextView, gtksourceview 3 or gtksourceview4, recommend
# the latest one but don't make it a hard requirement
Recommends: gtksourceview4
# Weak dependencies for the common virt-manager usecase
Recommends: (libvirt-daemon-kvm or libvirt-daemon-qemu)
Recommends: libvirt-daemon-config-network
@ -62,7 +59,6 @@ Suggests: python3-libguestfs
BuildRequires: gettext
BuildRequires: python3-devel
BuildRequires: python3-docutils
BuildRequires: meson
%description
@ -83,8 +79,8 @@ Requires: python3-requests
Requires: libosinfo >= 0.2.10
# Required for gobject-introspection infrastructure
Requires: python3-gobject-base
# Required for pulling files from iso media
Requires: xorriso
# Required for pulling files from iso media with isoinfo
Requires: genisoimage
%description common
Common files used by the different virt-manager interfaces, as well as
@ -109,40 +105,46 @@ machine).
%prep
%autosetup -p1
%setup -q
%patch0001 -p1
%patch0002 -p1
%build
%if ! %{have_spice}
%global _default_graphics -Ddefault-graphics=vnc
%if %{default_hvs}
%global _default_hvs --default-hvs %{default_hvs}
%endif
%meson \
-Ddefault-hvs=%{default_hvs} \
%{?_default_graphics} \
-Dupdate-icon-cache=false \
-Dcompile-schemas=false \
-Dtests=disabled
%meson_build
./setup.py configure \
%{?_default_hvs}
%install
%meson_install
./setup.py \
--no-update-icon-cache --no-compile-schemas \
install -O1 --root=%{buildroot}
%find_lang %{name}
%if 0%{?py_byte_compile:1}
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#manual-bytecompilation
%py_byte_compile %{__python3} %{buildroot}%{_datadir}/virt-manager/
%py_byte_compile %{python3} %{buildroot}%{_datadir}/virt-manager/
%endif
# Replace '#!/usr/bin/env python3' with '#!/usr/bin/python3'
# The format is ideal for upstream, but not a distro. See:
# https://fedoraproject.org/wiki/Features/SystemPythonExecutablesUseSystemPython
for f in $(find %{buildroot} -type f -executable -print); do
sed -i "1 s|^#!/usr/bin/env python3|#!%{__python3}|" $f || :
done
%files
%doc README.md COPYING NEWS.md
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1*
%{_datadir}/%{name}/ui
%{_datadir}/%{name}/ui/*.ui
%{_datadir}/%{name}/virtManager
%{_datadir}/%{name}/icons
@ -154,10 +156,8 @@ machine).
%files common -f %{name}.lang
%license COPYING
%doc README.md NEWS.md
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/virtinst
@ -176,76 +176,9 @@ machine).
%changelog
* Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 5.1.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 5.1.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
* Wed Jan 07 2026 Pavel Hrdina <phrdina@redhat.com> - 5.1.0.3
- Fix cloud init
* Fri Sep 19 2025 Python Maint <python-maint@redhat.com> - 5.1.0-2
- Rebuilt for Python 3.14.0rc3 bytecode
* Tue Aug 26 2025 Pavel Hrdina <phrdina@redhat.com> - 5.1.0-1
- Update to version 5.1.0
* Fri Aug 15 2025 Python Maint <python-maint@redhat.com> - 5.0.0-4
- Rebuilt for Python 3.14.0rc2 bytecode
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Mon Dec 02 2024 Pavel Hrdina <phrdina@redhat.com> - 5.0.0-1
- Update to version 5.0.0
* Tue Sep 10 2024 Cole Robinson <crobinso@redhat.com> - 4.1.0-9
- Add sev-snp changes for feature ConfidentialVirtHostAMDSEVSNP
* Mon Aug 05 2024 Cole Robinson <crobinso@redhat.com> - 4.1.0-8
- Fix flatpak build
- Add /usr/share/virt-manager/ui/ to rpm db (bz 2283244)
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Wed Jun 26 2024 Daniel. P. Berrange <berrange@redhat.com> - 4.1.0-6
- Fix compat with latest python 3.13 (rhbz #2294201)
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Sep 29 2023 Sandro Bonazzola <sbonazzo@redhat.com> - 4.1.0-4
- Drop spice-gtk3 on Fedora ELN as in CentOS Stream 9
- Resolves: fedora#2237969
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Aug 04 2022 Cole Robinson <crobinso@redhat.com> - 4.1.0-1
- Update to version 4.1.0
* Wed Aug 3 2022 Daniel. P. Berrange <berrange@redhat.com> - 4.0.0-3
- Fix compat with setuptools >= 61 (rhbz#2113754)
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Wed Mar 02 2022 Cole Robinson <crobinso@redhat.com> - 4.0.0-1
- Update to version 4.0.0
* Sun Feb 20 2022 Cole Robinson <crobinso@redhat.com> - 3.2.0-6
- Update to latest git snapshot
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Tue Apr 05 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 3.2.0-5
- Backport 4.x change to default to virtio video driver
- Works around RHBZ#2063156 and RHBZ#2071226
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild