Skip to content

Commit

Permalink
vng: arch: list supported arch in case of errors
Browse files Browse the repository at this point in the history
Instead of only listing the one passed by the user: most likely, the
user will want to know what to use.

While at it, add a comment at the end of ARCH_MAPPING to think about
updating get_host_arch() when adding a new arch.

Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe committed Feb 10, 2025
1 parent d8910f7 commit 1168b36
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion virtme_ng/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ def arg_fail(message, show_usage=True):
"kernel_target": "Image",
"kernel_image": "Image",
},
# adding a new arch? Please also update get_host_arch().
}

MAKE_COMMAND = "make LOCALVERSION=-virtme"
Expand Down Expand Up @@ -911,7 +912,11 @@ def _get_virtme_user(self, args):
def _get_virtme_arch(self, args):
if args.arch is not None:
if args.arch not in ARCH_MAPPING:
arg_fail(f"unsupported architecture: {args.arch}")
arg_fail(
f"unsupported architecture ({args.arch}), "
f"available: {' '.join(ARCH_MAPPING)}",
show_usage=False
)
if args.root is None and get_host_arch() != args.arch:
arg_fail("--arch used without --root")
if "max-cpus" in ARCH_MAPPING[args.arch]:
Expand Down

0 comments on commit 1168b36

Please sign in to comment.