mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
osdict: Choose the most appropriate tree when a profile is set
As some OSes, as Fedora, have variants (which we rely to be standardised on osinfo-db side), let's select the most appropriate variant according to the selected profile of the unattended installation. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
parent
0f1acc9f8f
commit
d6d97c6587
@ -61,6 +61,10 @@ class TestOSDB(unittest.TestCase):
|
|||||||
# Most generic tree URL
|
# Most generic tree URL
|
||||||
assert "Everything" in f29.get_location("x86_64")
|
assert "Everything" in f29.get_location("x86_64")
|
||||||
|
|
||||||
|
# Specific tree
|
||||||
|
assert "Server" in f29.get_location("x86_64", "jeos")
|
||||||
|
assert "Workstation" in f29.get_location("x86_64", "desktop")
|
||||||
|
|
||||||
# Has tree URLs, but none for arch
|
# Has tree URLs, but none for arch
|
||||||
try:
|
try:
|
||||||
f26.get_location("ia64")
|
f26.get_location("ia64")
|
||||||
|
14
virt-install
14
virt-install
@ -386,9 +386,9 @@ def show_warnings(options, guest, installer, osdata):
|
|||||||
# Guest building helpers #
|
# Guest building helpers #
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
def get_location_for_os(guest, osname):
|
def get_location_for_os(guest, osname, profile=None):
|
||||||
osinfo = virtinst.OSDB.lookup_os(osname, raise_error=True)
|
osinfo = virtinst.OSDB.lookup_os(osname, raise_error=True)
|
||||||
location = osinfo.get_location(guest.os.arch)
|
location = osinfo.get_location(guest.os.arch, profile)
|
||||||
print_stdout(_("Using {osname} --location {url}").format(
|
print_stdout(_("Using {osname} --location {url}").format(
|
||||||
osname=osname, url=location))
|
osname=osname, url=location))
|
||||||
return location
|
return location
|
||||||
@ -399,6 +399,7 @@ def build_installer(options, guest, installdata):
|
|||||||
location = None
|
location = None
|
||||||
location_kernel = None
|
location_kernel = None
|
||||||
location_initrd = None
|
location_initrd = None
|
||||||
|
unattended_data = None
|
||||||
extra_args = options.extra_args
|
extra_args = options.extra_args
|
||||||
|
|
||||||
install_bootdev = installdata.bootdev
|
install_bootdev = installdata.bootdev
|
||||||
@ -413,8 +414,12 @@ def build_installer(options, guest, installdata):
|
|||||||
else:
|
else:
|
||||||
extra_args = [installdata.kernel_args]
|
extra_args = [installdata.kernel_args]
|
||||||
|
|
||||||
|
if options.unattended:
|
||||||
|
unattended_data = cli.parse_unattended(options.unattended)
|
||||||
|
|
||||||
if install_os:
|
if install_os:
|
||||||
location = get_location_for_os(guest, install_os)
|
profile = unattended_data.profile if unattended_data else None
|
||||||
|
location = get_location_for_os(guest, install_os, profile)
|
||||||
elif options.location:
|
elif options.location:
|
||||||
(location,
|
(location,
|
||||||
location_kernel,
|
location_kernel,
|
||||||
@ -443,8 +448,7 @@ def build_installer(options, guest, installdata):
|
|||||||
install_kernel_args=install_kernel_args,
|
install_kernel_args=install_kernel_args,
|
||||||
no_install=no_install)
|
no_install=no_install)
|
||||||
|
|
||||||
if options.unattended:
|
if unattended_data:
|
||||||
unattended_data = cli.parse_unattended(options.unattended)
|
|
||||||
installer.set_unattended_data(unattended_data)
|
installer.set_unattended_data(unattended_data)
|
||||||
if extra_args:
|
if extra_args:
|
||||||
installer.set_extra_args(extra_args)
|
installer.set_extra_args(extra_args)
|
||||||
|
@ -628,7 +628,11 @@ class _OsVariant(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
fallback_tree = None
|
fallback_tree = None
|
||||||
if not profile:
|
if profile == "jeos":
|
||||||
|
profile = "Server"
|
||||||
|
elif profile == "desktop":
|
||||||
|
profile = "Workstation"
|
||||||
|
elif not profile:
|
||||||
profile = "Everything"
|
profile = "Everything"
|
||||||
|
|
||||||
for tree in treelist:
|
for tree in treelist:
|
||||||
|
Loading…
Reference in New Issue
Block a user