Skip to content

Commit

Permalink
vng: warn if --arch is used without --root
Browse files Browse the repository at this point in the history
Because it doesn't make sense to run on a different architecture, but
with the host's root FS.

Print a warning, not to block weird use-cases, or if the same arch as
the host is passed to --arch.

Link: #233
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe committed Feb 9, 2025
1 parent 2dcde98 commit d4bb1e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion virtme_ng/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def make_parser():
"--arch",
action="store",
help="Generate and test a kernel for a specific architecture "
"(default is host architecture)",
"(default is host architecture ; if set, to be used with --root)",
)

parser.add_argument(
Expand Down Expand Up @@ -912,6 +912,8 @@ 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}")
if args.root is None:
sys.stderr.write("WARNING: --arch used without --root." + "\n")
if "max-cpus" in ARCH_MAPPING[args.arch]:
self.cpus = ARCH_MAPPING[args.arch]["max-cpus"]
self.virtme_param["arch"] = "--arch " + ARCH_MAPPING[args.arch]["qemu_name"]
Expand Down

0 comments on commit d4bb1e0

Please sign in to comment.