mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-28 01:58:08 +03:00
virt-install: Warn if --osinfo detect=on,name=OSNAME
detection fails
Using `detect=on,name=OSNAME` is good for CI safety, incase a new distro tree has a regression with detection, or if testing against a new distro that osinfo-db doesn't know about. But virt-install should still try to inform the user that detection failed, and suggest filing a bug if the user expected it to work. Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
e3da4337f6
commit
e02607766c
@ -1020,8 +1020,10 @@ c.add_compare("--pxe --print-step all --os-variant none", "simple-pxe") # Diskl
|
||||
c.add_compare("--location ftp://example.com --os-variant auto", "fake-ftp") # fake ftp:// install using urlfetcher.py mocking
|
||||
c.add_compare("--location https://foobar.com --os-variant detect=no,require=no", "fake-http") # fake https:// install using urlfetcher.py mocking, but also hit --os-variant detect=no
|
||||
c.add_compare("--location https://foobar.com --os-variant detect=yes,name=win7", "os-detect-success-fallback") # os detection succeeds, so fallback should be ignored
|
||||
c.add_compare("--pxe --os-variant detect=yes,name=win7", "os-detect-fail-fallback") # os detection succeeds, so fallback should be ignored
|
||||
c.add_compare("--pxe --os-variant detect=yes,name=win7", "os-detect-fail-fallback") # os detection fails, so we use fallback name=
|
||||
c.add_compare("--connect %(URI-KVM-X86)s --install fedora26", "osinfo-url") # getting URL from osinfo
|
||||
c.add_valid("--location https://foobar.com --os-variant detect=yes,name=win7", nogrep="Please file a bug against virt-install") # os detection succeeds, the fallback warning shouldn't be printed
|
||||
c.add_valid("--pxe --os-variant detect=yes,name=win7", grep="Please file a bug against virt-install") # os detection fails, so fallback warning should be printed
|
||||
c.add_invalid("--pxe --os-variant detect=yes,require=yes", grep="--os-variant/--osinfo OS name is required") # No os-variant detected, but require=yes
|
||||
c.add_invalid("--pxe --osinfo detect=yes", grep="--os-variant/--osinfo OS name is required") # --osinfo detect=on failed, but with implied require=yes
|
||||
c.add_invalid("--pxe --virt-type foobar", grep="Host does not support domain type")
|
||||
|
@ -547,15 +547,25 @@ def installer_detect_distro(guest, installer, osdata):
|
||||
# OS name has to be set firstly whenever --osinfo is passed,
|
||||
# otherwise it won't be respected when the installer creates the
|
||||
# Distro Store.
|
||||
fallback_name = None
|
||||
if osdata.get_name():
|
||||
fallback_name = osdata.get_name()
|
||||
os_set = True
|
||||
guest.set_os_name(osdata.get_name())
|
||||
guest.set_os_name(fallback_name)
|
||||
|
||||
# This also validates the install location
|
||||
autodistro = installer.detect_distro(guest)
|
||||
if osdata.is_detect() and autodistro:
|
||||
os_set = True
|
||||
guest.set_os_name(autodistro)
|
||||
if osdata.is_detect():
|
||||
if autodistro:
|
||||
os_set = True
|
||||
guest.set_os_name(autodistro)
|
||||
elif fallback_name:
|
||||
msg = _(
|
||||
"Failed to detect osinfo OS name from install media."
|
||||
"Using fallback name=%s.") % fallback_name
|
||||
msg += _("\nPlease file a bug against virt-install if "
|
||||
"you expected detection to succeed.")
|
||||
log.warning(msg)
|
||||
except ValueError as e:
|
||||
fail(_("Error validating install location: %s") % str(e))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user