virt-manager-5.1.0-2.el10

- virtinst: interface: add support for backend.hostname and backend.fqdn (RHEL-95370)
- maint: use constants instead of strings for boot devices (RHEL-71842)
- virtinst: rework get_boot_order (RHEL-71842)
- virtinst: guest: introduce can_use_device_boot_order (RHEL-71842)
- virtinst: remove legacy attribute from set_boot_order/get_boot_order (RHEL-71842)
- installer: add support to use device boot order (RHEL-71842)

Resolves: RHEL-71842, RHEL-95370
This commit is contained in:
Pavel Hrdina 2025-12-04 19:19:39 +01:00
parent f580cee75e
commit e349f3e9b2
7 changed files with 3036 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,139 @@
From 43951a5a6fd9fd50f063915f1e4d6d2fe72a86ec Mon Sep 17 00:00:00 2001
Message-ID: <43951a5a6fd9fd50f063915f1e4d6d2fe72a86ec.1764872379.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 17 Oct 2025 16:32:33 +0200
Subject: [PATCH] maint: use constants instead of strings for boot devices
From: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 161fb1baaff45f260b278e9df900293ab12da820)
https://issues.redhat.com/browse/RHEL-71842
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtManager/details/details.py | 20 ++++++++++++++++----
virtinst/cli.py | 9 +++++----
virtinst/guest.py | 8 ++++----
virtinst/install/installer.py | 4 ++--
virtinst/virtinstall.py | 2 +-
5 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/virtManager/details/details.py b/virtManager/details/details.py
index a256820ea..94ba83abf 100644
--- a/virtManager/details/details.py
+++ b/virtManager/details/details.py
@@ -2271,10 +2271,22 @@ class vmmDetails(vmmGObjectUI):
def _make_boot_rows(self):
if not self.vm.can_use_device_boot_order():
return [
- ["hd", _("Hard Disk"), "drive-harddisk", False, True],
- ["cdrom", _("CDROM"), "media-optical", False, True],
- ["network", _("Network (PXE)"), "network-idle", False, True],
- ["fd", _("Floppy"), "media-floppy", False, True],
+ [
+ virtinst.DomainOs.BOOT_DEVICE_HARDDISK,
+ _("Hard Disk"),
+ "drive-harddisk",
+ False,
+ True,
+ ],
+ [virtinst.DomainOs.BOOT_DEVICE_CDROM, _("CDROM"), "media-optical", False, True],
+ [
+ virtinst.DomainOs.BOOT_DEVICE_NETWORK,
+ _("Network (PXE)"),
+ "network-idle",
+ False,
+ True,
+ ],
+ [virtinst.DomainOs.BOOT_DEVICE_FLOPPY, _("Floppy"), "media-floppy", False, True],
]
ret = []
diff --git a/virtinst/cli.py b/virtinst/cli.py
index ed97e8809..315b5b8e9 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -29,6 +29,7 @@ from .devices import (
DeviceHostdev,
DeviceInterface,
)
+from .domain import DomainOs
from .guest import Guest
from .logger import log, reset_logging
from .nodedev import NodeDevice
@@ -3214,10 +3215,10 @@ class ParserBoot(VirtCLIParser):
# This is simply so the boot options are advertised with --boot help,
# actual processing is handled by _parse
- cls.add_arg("hd", None, lookup_cb=None, cb=cls.noset_cb)
- cls.add_arg("cdrom", None, lookup_cb=None, cb=cls.noset_cb)
- cls.add_arg("fd", None, lookup_cb=None, cb=cls.noset_cb)
- cls.add_arg("network", None, lookup_cb=None, cb=cls.noset_cb)
+ cls.add_arg(DomainOs.BOOT_DEVICE_HARDDISK, None, lookup_cb=None, cb=cls.noset_cb)
+ cls.add_arg(DomainOs.BOOT_DEVICE_CDROM, None, lookup_cb=None, cb=cls.noset_cb)
+ cls.add_arg(DomainOs.BOOT_DEVICE_FLOPPY, None, lookup_cb=None, cb=cls.noset_cb)
+ cls.add_arg(DomainOs.BOOT_DEVICE_NETWORK, None, lookup_cb=None, cb=cls.noset_cb)
cls.add_arg(
"refresh-machine-type",
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 54754d49a..b790a9c8d 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -469,13 +469,13 @@ class Guest(XMLBuilder):
break
for b in boot_order:
- if b == "network" and net:
+ if b == DomainOs.BOOT_DEVICE_NETWORK and net:
ret.append(net.get_xml_id())
- elif b == "hd" and disk:
+ elif b == DomainOs.BOOT_DEVICE_HARDDISK and disk:
ret.append(disk.get_xml_id())
- elif b == "cdrom" and cdrom:
+ elif b == DomainOs.BOOT_DEVICE_CDROM and cdrom:
ret.append(cdrom.get_xml_id())
- elif b == "fd" and floppy:
+ elif b == DomainOs.BOOT_DEVICE_FLOPPY and floppy:
ret.append(floppy.get_xml_id())
return ret
diff --git a/virtinst/install/installer.py b/virtinst/install/installer.py
index 96250f61b..a507c3c7c 100644
--- a/virtinst/install/installer.py
+++ b/virtinst/install/installer.py
@@ -87,7 +87,7 @@ class Installer:
if cdrom:
cdrom = InstallerTreeMedia.validate_path(self.conn, cdrom)
self._cdrom = cdrom
- self._install_bootdev = "cdrom"
+ self._install_bootdev = DomainOs.BOOT_DEVICE_CDROM
elif location or location_kernel or location_initrd or install_kernel or install_initrd:
self._treemedia = InstallerTreeMedia(
self.conn,
@@ -226,7 +226,7 @@ class Installer:
# windows virtio installs, and booting local disk from PXE)
for disk in guest.devices.disk:
if disk.device == disk.DEVICE_DISK:
- bootdev = "hd"
+ bootdev = DomainOs.BOOT_DEVICE_HARDDISK
if bootdev not in bootorder:
bootorder.append(bootdev)
break
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
index 612f19a52..5e22931de 100644
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -439,7 +439,7 @@ def build_installer(options, guest, installdata):
if options.livecd:
no_install = True
elif options.pxe:
- install_bootdev = "network"
+ install_bootdev = virtinst.DomainOs.BOOT_DEVICE_NETWORK
elif installdata.is_set:
pass
elif options.xmlonly:
--
2.52.0

View File

@ -0,0 +1,48 @@
From e9265288cb16fd35c81267d4abc635f67af281d7 Mon Sep 17 00:00:00 2001
Message-ID: <e9265288cb16fd35c81267d4abc635f67af281d7.1764872379.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 2 Dec 2025 21:39:14 +0100
Subject: [PATCH] virtinst: guest: introduce can_use_device_boot_order
From: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 3a25792d90d53ad81bfb4835a146d047a39ef1e5)
https://issues.redhat.com/browse/RHEL-71842
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtManager/object/domain.py | 2 +-
virtinst/guest.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
index 6fc4f45ce..b8273ba7d 100644
--- a/virtManager/object/domain.py
+++ b/virtManager/object/domain.py
@@ -1396,7 +1396,7 @@ class vmmDomain(vmmLibvirtObject):
def can_use_device_boot_order(self):
# Return 'True' if guest can use new style boot device ordering
- return self.conn.support.conn_device_boot_order()
+ return self.get_xmlobj().can_use_device_boot_order()
def get_bootable_devices(self):
# redirdev can also be marked bootable, but it should be rarely
diff --git a/virtinst/guest.py b/virtinst/guest.py
index a9fbecaec..d13049be0 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -475,6 +475,9 @@ class Guest(XMLBuilder):
ret.append(floppy.get_xml_id())
return ret
+ def can_use_device_boot_order(self):
+ return self.conn.support.conn_device_boot_order()
+
def _get_device_boot_order(self):
order = []
for dev in self.get_bootable_devices():
--
2.52.0

View File

@ -0,0 +1,78 @@
From 936016b96d195eb07e730f90caa1084e62edd208 Mon Sep 17 00:00:00 2001
Message-ID: <936016b96d195eb07e730f90caa1084e62edd208.1764872379.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 21 Nov 2025 10:11:34 +0100
Subject: [PATCH] virtinst: interface: add support for backend.hostname and
backend.fqdn
From: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit d57e2e738f37444a48c1e762ee63114583d6348f)
Resolves: https://issues.redhat.com/browse/RHEL-95370
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
tests/data/cli/compare/virt-install-many-devices.xml | 5 +++++
tests/test_cli.py | 1 +
virtinst/cli.py | 2 ++
virtinst/devices/interface.py | 2 ++
4 files changed, 10 insertions(+)
diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml
index 9b8b3c6ba..5edca096d 100644
--- a/tests/data/cli/compare/virt-install-many-devices.xml
+++ b/tests/data/cli/compare/virt-install-many-devices.xml
@@ -680,6 +680,11 @@
<range start="5000" end="6000" to="5"/>
</portForward>
</interface>
+ <interface type="user">
+ <backend type="passt" hostname="test" fqdn="test.example.com"/>
+ <mac address="00:11:22:33:44:55"/>
+ <model type="virtio"/>
+ </interface>
<interface type="hostdev">
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index daf6e2a80..90f6ab983 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -675,6 +675,7 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
--network passt,portForward=8080
--network passt,portForward0=7000-8000/udp,portForward1=127.0.0.1:2222:22
--network passt,portForward0=2001:db8:ac10:fd01::1:10:3000-4000:30,portForward1=127.0.0.1:5000-6000:5
+--network passt,backend.hostname=test,backend.fqdn=test.example.com
--network type=hostdev,source.address.type=pci,source.address.domain=0x0,source.address.bus=0x00,source.address.slot=0x07,source.address.function=0x0
--network hostdev=pci_0000_00_09_0
--network hostdev=0:0:4.0
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 1203b0c8d..ed97e8809 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -4272,6 +4272,8 @@ class ParserNetwork(VirtCLIParser):
# Standard XML options
cls.add_arg("type", "type", cb=cls.set_type_cb)
cls.add_arg("backend.type", "backend.type")
+ cls.add_arg("backend.hostname", "backend.hostname")
+ cls.add_arg("backend.fqdn", "backend.fqdn")
cls.add_arg("backend.logFile", "backend.logFile")
cls.add_arg("trustGuestRxFilters", "trustGuestRxFilters", is_onoff=True)
diff --git a/virtinst/devices/interface.py b/virtinst/devices/interface.py
index 333b92eca..9d82ab586 100644
--- a/virtinst/devices/interface.py
+++ b/virtinst/devices/interface.py
@@ -132,6 +132,8 @@ class _Backend(XMLBuilder):
XML_NAME = "backend"
type = XMLProperty("./@type")
+ hostname = XMLProperty("./@hostname")
+ fqdn = XMLProperty("./@fqdn")
logFile = XMLProperty("./@logFile", do_abspath=True)
--
2.52.0

View File

@ -0,0 +1,131 @@
From 04ea39c21ac551cdfc1a00f456d65a5b775ef6bc Mon Sep 17 00:00:00 2001
Message-ID: <04ea39c21ac551cdfc1a00f456d65a5b775ef6bc.1764872379.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 3 Dec 2025 15:30:49 +0100
Subject: [PATCH] virtinst: remove legacy attribute from
set_boot_order/get_boot_order
From: Pavel Hrdina <phrdina@redhat.com>
Only tests used manual value for the attribute, otherwise we always used
what was detected by conn_device_boot_order() function.
Remove that attribute and update tests to use unittest.mock.patch where
needed.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 3985b0746f79d108bab66a21b28e1ecf6e4c415f)
https://issues.redhat.com/browse/RHEL-71842
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
tests/test_xmlparse.py | 13 +++++++++----
virtManager/object/domain.py | 6 ++----
virtinst/guest.py | 16 ++++++++--------
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/tests/test_xmlparse.py b/tests/test_xmlparse.py
index 7f150f918..18f124d53 100644
--- a/tests/test_xmlparse.py
+++ b/tests/test_xmlparse.py
@@ -3,6 +3,8 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
+import unittest
+
import pytest
import virtinst
@@ -652,7 +654,8 @@ def testGuestBootorder():
guest, outfile = _get_test_content(kvmconn, "bootorder")
assert guest.get_boot_order() == ["./devices/disk[1]"]
- assert guest.get_boot_order(legacy=True) == ["hd"]
+ with unittest.mock.patch("virtinst.Guest.can_use_device_boot_order", return_value=False):
+ assert guest.get_boot_order() == ["hd"]
legacy_order = ["hd", "fd", "cdrom", "network"]
dev_order = [
@@ -661,13 +664,15 @@ def testGuestBootorder():
"./devices/disk[2]",
"./devices/interface[1]",
]
- guest.set_boot_order(legacy_order, legacy=True)
+ with unittest.mock.patch("virtinst.Guest.can_use_device_boot_order", return_value=False):
+ guest.set_boot_order(legacy_order)
+ assert guest.get_boot_order() == legacy_order
assert guest.get_boot_order() == dev_order
- assert guest.get_boot_order(legacy=True) == legacy_order
guest.set_boot_order(dev_order)
assert guest.get_boot_order() == dev_order
- assert guest.get_boot_order(legacy=True) == []
+ with unittest.mock.patch("virtinst.Guest.can_use_device_boot_order", return_value=False):
+ assert guest.get_boot_order() == []
_alter_compare(kvmconn, guest.get_xml(), outfile)
diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
index b8273ba7d..3e005c0f6 100644
--- a/virtManager/object/domain.py
+++ b/virtManager/object/domain.py
@@ -762,8 +762,7 @@ class vmmDomain(vmmLibvirtObject):
guest = self._make_xmlobj_to_define()
if boot_order != _SENTINEL:
- legacy = not self.can_use_device_boot_order()
- guest.set_boot_order(boot_order, legacy=legacy)
+ guest.set_boot_order(boot_order)
if boot_menu != _SENTINEL:
guest.os.bootmenu_enable = bool(boot_menu)
@@ -1372,8 +1371,7 @@ class vmmDomain(vmmLibvirtObject):
return self.get_xmlobj().description
def get_boot_order(self):
- legacy = not self.can_use_device_boot_order()
- return self.xmlobj.get_boot_order(legacy=legacy)
+ return self.xmlobj.get_boot_order()
def get_boot_menu(self):
guest = self.get_xmlobj()
diff --git a/virtinst/guest.py b/virtinst/guest.py
index d13049be0..3f9eb0079 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -488,10 +488,10 @@ class Guest(XMLBuilder):
order.sort(key=lambda p: p[1])
return [p[0] for p in order]
- def get_boot_order(self, legacy=False):
- if legacy:
- return self.os.bootorder
- return self._get_device_boot_order() or self._convert_old_boot_order(self.os.bootorder)
+ def get_boot_order(self):
+ if self.can_use_device_boot_order():
+ return self._get_device_boot_order() or self._convert_old_boot_order(self.os.bootorder)
+ return self.os.bootorder
def _set_device_boot_order(self, boot_order):
"""Sets the new device boot order for the domain"""
@@ -506,12 +506,12 @@ class Guest(XMLBuilder):
for boot_idx, dev_xml_id in enumerate(boot_order, 1):
dev_map[dev_xml_id].boot.order = boot_idx
- def set_boot_order(self, boot_order, legacy=False):
+ def set_boot_order(self, boot_order):
"""Modifies the boot order"""
- if legacy:
- self.os.bootorder = boot_order
- else:
+ if self.can_use_device_boot_order():
self._set_device_boot_order(boot_order)
+ else:
+ self.os.bootorder = boot_order
def reorder_boot_order(self, dev, boot_index):
"""Sets boot order of `dev` to `boot_index`
--
2.52.0

View File

@ -0,0 +1,62 @@
From 1b9a11574c1f613d706a610dfa81ef511b65e4ed Mon Sep 17 00:00:00 2001
Message-ID: <1b9a11574c1f613d706a610dfa81ef511b65e4ed.1764872379.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 30 Oct 2025 15:38:26 +0100
Subject: [PATCH] virtinst: rework get_boot_order
From: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 25670b2ee8a31f4d66c75a5bd7f27bc742d1e545)
https://issues.redhat.com/browse/RHEL-71842
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/guest.py | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/virtinst/guest.py b/virtinst/guest.py
index b790a9c8d..a9fbecaec 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -439,15 +439,11 @@ class Guest(XMLBuilder):
# Bootorder helpers #
#####################
- def _get_old_boot_order(self):
- return self.os.bootorder
-
- def _convert_old_boot_order(self):
+ def _convert_old_boot_order(self, boot_order):
"""Converts the old boot order (e.g. <boot dev='hd'/>) into the
per-device boot order format.
"""
- boot_order = self._get_old_boot_order()
ret = []
disk = None
cdrom = None
@@ -486,18 +482,13 @@ class Guest(XMLBuilder):
continue
order.append((dev.get_xml_id(), dev.boot.order))
- if not order:
- # No devices individually marked bootable, convert traditional
- # boot XML to fine grained
- return self._convert_old_boot_order()
-
order.sort(key=lambda p: p[1])
return [p[0] for p in order]
def get_boot_order(self, legacy=False):
if legacy:
- return self._get_old_boot_order()
- return self._get_device_boot_order()
+ return self.os.bootorder
+ return self._get_device_boot_order() or self._convert_old_boot_order(self.os.bootorder)
def _set_device_boot_order(self, boot_order):
"""Sets the new device boot order for the domain"""
--
2.52.0

View File

@ -9,7 +9,7 @@
Name: virt-manager
Version: 5.1.0
Release: 1%{?dist}%{?extra_release}
Release: 2%{?dist}%{?extra_release}
%global verrel %{version}-%{release}
Summary: Desktop tool for managing virtual machines via libvirt
@ -20,6 +20,12 @@ Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.xz
Source1: symlinks
Patch1: virt-manager-virtinst-cloudinit-include-empty-meta-data-file.patch
Patch2: virt-manager-virtinst-interface-add-support-for-backend.hostname-and-backend.fqdn.patch
Patch3: virt-manager-maint-use-constants-instead-of-strings-for-boot-devices.patch
Patch4: virt-manager-virtinst-rework-get_boot_order.patch
Patch5: virt-manager-virtinst-guest-introduce-can_use_device_boot_order.patch
Patch6: virt-manager-virtinst-remove-legacy-attribute-from-set_boot_order-get_boot_order.patch
Patch7: virt-manager-installer-add-support-to-use-device-boot-order.patch
Requires: virt-manager-common = %{verrel}
@ -194,6 +200,14 @@ git commit -q -a --allow-empty --author 'rpm-build <rpm-build>' -m symlinks
%changelog
* Thu Dec 4 2025 Pavel Hrdina <phrdina@redhat.com> - 5.1.0-2
- virtinst: interface: add support for backend.hostname and backend.fqdn (RHEL-95370)
- maint: use constants instead of strings for boot devices (RHEL-71842)
- virtinst: rework get_boot_order (RHEL-71842)
- virtinst: guest: introduce can_use_device_boot_order (RHEL-71842)
- virtinst: remove legacy attribute from set_boot_order/get_boot_order (RHEL-71842)
- installer: add support to use device boot order (RHEL-71842)
* Sat Nov 15 2025 Pavel Hrdina <phrdina@redhat.com> - 5.1.0-1
- Rebased to virt-manager-5.1.0 (RHEL-119228)
- The rebase also fixes the following bugs: