Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install_vm: Add default osinfo for RHEL distro #12858

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions tests/install_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
"centos9",
"rhel8",
"rhel9",
"rhel10",
]

# put here any unreleased distro in development that needs to be tested
# and any working osinfo known to be used by default when installating it
UNRELEASED_DISTROS_AND_OSINFO = {
"rhel10": "rhel9-unknown"
}

DISTRO_URL = {
"fedora":
"https://download.fedoraproject.org/pub/fedora/linux/releases/41/Everything/x86_64/os",
Expand All @@ -34,8 +39,14 @@ def path_from_tests(path):


def parse_args():
import textwrap
osinfo_epilog = textwrap.dedent(r"""
--osinfo details: 'For unreleased distros, these are the following default data used as input
{}.
""".format(UNRELEASED_DISTROS_AND_OSINFO))
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
formatter_class=argparse.RawTextHelpFormatter,
epilog=osinfo_epilog,
)

parser.add_argument(
Expand All @@ -54,7 +65,7 @@ def parse_args():
"--distro",
dest="distro",
required=True,
choices=KNOWN_DISTROS,
choices=KNOWN_DISTROS + list(UNRELEASED_DISTROS_AND_OSINFO.keys()),
help="What distribution to install.",
)
parser.add_argument(
Expand Down Expand Up @@ -154,7 +165,7 @@ def parse_args():
"--osinfo",
dest="osinfo",
default=None,
help="Specify OSInfo for virt-install command.",
help="Specify OSInfo for virt-install command",
)

return parser.parse_args()
Expand Down Expand Up @@ -327,6 +338,10 @@ def get_virt_install_command(data):

if data.osinfo:
command.append(f'--osinfo={data.osinfo}')
else:
if data.distro in UNRELEASED_DISTROS_AND_OSINFO.keys():
command.append("--osinfo={}".format(UNRELEASED_DISTROS_AND_OSINFO.get(data.distro, "rhel9-unknown")))


command.extend(join_extented_opt("--boot", ",", boot_opts))
command.extend(join_extented_opt("--extra-args", " ", extra_args_opts))
Expand Down
Loading