Blame SOURCES/virt-manager-virtinstall-fix-regression-with-boot-and-no-install-method.patch

588c1d
From afb42b86ad8bd72930859968c92c084134e6d114 Mon Sep 17 00:00:00 2001
588c1d
From: Cole Robinson <crobinso@redhat.com>
588c1d
Date: Sat, 20 Aug 2022 09:54:01 -0400
588c1d
Subject: [PATCH] virtinstall: fix regression with --boot and no install method
588c1d
588c1d
Anything passed to --boot should imply --install no_install=yes
588c1d
in the absence of other --install options. This is historically
588c1d
what we've done but we regressed in 4.1.0
588c1d
588c1d
Resolves: https://github.com/virt-manager/virt-manager/issues/426
588c1d
588c1d
Signed-off-by: Cole Robinson <crobinso@redhat.com>
588c1d
588c1d
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2144885
588c1d
588c1d
(cherry picked from commit e94786c066696781a821f5a4bcef3c377e4bc5e5)
588c1d
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
588c1d
---
588c1d
 tests/test_cli.py       | 1 +
588c1d
 virtinst/virtinstall.py | 3 ++-
588c1d
 2 files changed, 3 insertions(+), 1 deletion(-)
588c1d
588c1d
diff --git a/tests/test_cli.py b/tests/test_cli.py
588c1d
index 774db098f..ca8d2340a 100644
588c1d
--- a/tests/test_cli.py
588c1d
+++ b/tests/test_cli.py
588c1d
@@ -966,6 +966,7 @@ c.add_valid("--os-variant generic --pxe --ram 16", grep="Requested memory 16 MiB
588c1d
 c.add_valid("--os-variant winxp --ram 32 --cdrom %(EXISTIMG1)s", grep="32 MiB is less than the recommended 64 MiB")  # Windows. Catch memory warning
588c1d
 c.add_valid("--osinfo generic --pxe --autostart")  # --autostart flag
588c1d
 c.add_valid("--cdrom %(EXISTIMG2)s --os-variant win2k3 --print-step 2")  # HVM windows install, print 3rd stage XML
588c1d
+c.add_valid("--memory 512 --osinfo generic --boot cdrom")  # --boot XXX should imply --install no_install
588c1d
 c.add_compare("--location location=%(TREEDIR)s --initrd-inject virt-install --extra-args ks=file:/virt-install", "initrd-inject")  # initrd-inject
588c1d
 c.add_compare("--cdrom http://example.com/path/to/some.iso --os-variant detect=yes,require=no", "cdrom-url")
588c1d
 c.add_compare("--pxe --print-step all --os-variant none", "simple-pxe")  # Diskless PXE install
588c1d
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
588c1d
index 6d7f56b8d..20b901813 100644
588c1d
--- a/virtinst/virtinstall.py
588c1d
+++ b/virtinst/virtinstall.py
588c1d
@@ -431,7 +431,7 @@ def build_installer(options, guest, installdata):
588c1d
         pass
588c1d
     elif (options.import_install or
588c1d
           options.xmlonly or
588c1d
-          options.boot or
588c1d
+          options.boot_was_set or
588c1d
           options.cloud_init or
588c1d
           options.unattended):
588c1d
         no_install = True
588c1d
@@ -641,6 +641,7 @@ def _build_options_guest(conn, options):
588c1d
 def build_guest_instance(conn, options):
588c1d
     installdata = cli.parse_install(options.install)
588c1d
     osdata = cli.parse_os_variant(options.os_variant or installdata.os)
588c1d
+    options.boot_was_set = bool(options.boot)
588c1d
 
588c1d
     if options.reinstall:
588c1d
         dummy1, guest, dummy2 = cli.get_domain_and_guest(conn, options.reinstall)
588c1d
-- 
588c1d
2.38.1
588c1d