- 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
140 lines
5.6 KiB
Diff
140 lines
5.6 KiB
Diff
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
|