From 363fca413cae336a0ca86cbdcbb2f65fead948ee Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 20 Feb 2022 11:40:35 -0500 Subject: [PATCH] virt-install: Require --osinfo for non-x86 HVM case too It's generally not as valuable for non-x86 where we don't have the history of supporting non-virtio OSes, but as time goes on it will likely become more relevant for non-x86 arches, so let's make this change now to get ahead of it. Signed-off-by: Cole Robinson --- man/virt-install.rst | 4 ++-- tests/test_cli.py | 1 + virtinst/virtinstall.py | 10 +++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/man/virt-install.rst b/man/virt-install.rst index e43ffff63..2b4f4e16d 100644 --- a/man/virt-install.rst +++ b/man/virt-install.rst @@ -1016,8 +1016,8 @@ all other settings off or unset. By default, virt-install will always attempt ``--osinfo detect=on`` for appropriate install media. If no OS is detected, we will fail -in certain common cases (x86 KVM for example). This fatal error was -added in 2022. You can work around this by using the fallback example +in most common cases. This fatal error was added in 2022. You can +work around this by using the fallback example above, or disabling the ``require`` option. If you just need to get back to the old non-fatal behavior ASAP, set the environment variable VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1. diff --git a/tests/test_cli.py b/tests/test_cli.py index 826fbde8b..a73d75f4f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1146,6 +1146,7 @@ c.add_compare("--connect %(URI-KVM-ARMV7L)s --disk %(EXISTIMG1)s --import --os-v ################# c.add_valid("--arch aarch64 --osinfo fedora19 --nodisks --pxe --connect " + utils.URIs.kvm_x86_nodomcaps, grep="Libvirt version does not support UEFI") # attempt to default to aarch64 UEFI, but it fails, but should only print warnings +c.add_invalid("--arch aarch64 --nodisks --pxe --connect " + utils.URIs.kvm_x86, grep="OS name is required") # catch missing osinfo for non-x86 c.add_compare("--arch aarch64 --osinfo fedora19 --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s", "aarch64-machvirt") c.add_compare("--arch aarch64 --osinfo fedora19 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s", "aarch64-machdefault") c.add_compare("--arch aarch64 --cdrom %(ISO-F26-NETINST)s --boot loader=CODE.fd,nvram.template=VARS.fd --disk %(EXISTIMG1)s --cpu none --events on_crash=preserve,on_reboot=destroy,on_poweroff=restart", "aarch64-cdrom") # cdrom test, but also --cpu none override, --events override, and headless diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py index de1945b63..b0dc48910 100644 --- a/virtinst/virtinstall.py +++ b/virtinst/virtinstall.py @@ -355,9 +355,13 @@ def _show_memory_warnings(guest): def _needs_accurate_osinfo(guest): - # Limit it to hvm x86 guests which presently our defaults - # only really matter for - return guest.os.is_x86() and guest.os.is_hvm() + # HVM is really the only case where OS impacts what we set for defaults, + # so far. + # + # Historically we would only warn about missing osinfo on x86, but + # with the change to make osinfo mandatory we relaxed the arch check, + # so virt-install behavior is more consistent. + return guest.os.is_hvm() def show_guest_warnings(options, guest):