Skip to content

Commit

Permalink
vng: pass '--user root' to virtme-run
Browse files Browse the repository at this point in the history
But don't set virtme_user to root in virtme-run.

By doing that, it is possible, it is possible to use '--user' in other
context, e.g. with '--vsock-connect'

Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe committed Dec 6, 2024
1 parent 43aff7c commit e4651aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion virtme/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ def cleanup_vsock_script():
return 1
kernelargs.append("virtme_chdir=%s" % rel_cwd)

if args.user:
if args.user and args.user != "root":
kernelargs.append("virtme_user=%s" % args.user)

if args.nvgpu:
Expand Down
6 changes: 2 additions & 4 deletions virtme_ng/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,16 +852,14 @@ def _get_virtme_user(self, args):
# sessions is current user.
#
# NOTE: graphic sessions are considered interactive.
self.virtme_param["user"] = ""
if args.exec and not args.graphics:
self.virtme_param["user"] = ""
else:
self.virtme_param["user"] = "--user " + get_username()
# Override default user, if specified by the --user argument.
if args.user is not None:
if args.user != "root":
self.virtme_param["user"] = "--user " + args.user
else:
self.virtme_param["user"] = ""
self.virtme_param["user"] = "--user " + args.user

def _get_virtme_arch(self, args):
if args.arch is not None:
Expand Down

0 comments on commit e4651aa

Please sign in to comment.