From: Anthony PERARD <anthony.perard@vates.tech>
To: xen-devel@lists.xenproject.org
Cc: Anthony PERARD <anthony.perard@vates.tech>,
Jason Andryuk <jason.andryuk@amd.com>,
Juergen Gross <jgross@suse.com>
Subject: [XEN PATCH v2 2/2] libxl: Probe QEMU for -run-with user=user and use it
Date: Fri, 30 Aug 2024 09:49:40 +0000 [thread overview]
Message-ID: <20240830094937.40476-3-anthony.perard@vates.tech> (raw)
In-Reply-To: <20240830094937.40476-1-anthony.perard@vates.tech>
"-runas" is deprecated since QEMU 9.1 and will be remove in a future
release.
Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
Notes:
v2:
- rename "qemu_cmdline" to "qemu_opts" in struct field and func
parameters.
tools/libs/light/libxl_dm.c | 12 ++++++++++--
tools/libs/light/libxl_internal.h | 1 +
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 15b157060f..1f2f5bd97a 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2052,8 +2052,13 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
}
if (state->dm_runas) {
- flexarray_append(dm_args, "-runas");
- flexarray_append(dm_args, state->dm_runas);
+ if (qemu_opts->have_runwith_user) {
+ flexarray_append_pair(dm_args, "-run-with",
+ GCSPRINTF("user=%s", state->dm_runas));
+ } else {
+ flexarray_append(dm_args, "-runas");
+ flexarray_append(dm_args, state->dm_runas);
+ }
}
}
flexarray_append(dm_args, NULL);
@@ -3073,6 +3078,9 @@ static void device_model_probe_cmdline(libxl__egc *egc,
if (!strcmp("chroot", libxl__json_object_get_string(o))) {
dmss->qemu_opts.have_runwith_chroot = true;
}
+ else if (!strcmp("user", libxl__json_object_get_string(o))) {
+ dmss->qemu_opts.have_runwith_user = true;
+ }
}
/*
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 0133c57e01..089a2f949c 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -4145,6 +4145,7 @@ typedef struct libxl__dm_spawn_state libxl__dm_spawn_state;
typedef struct libxl__qemu_available_opts libxl__qemu_available_opts;
struct libxl__qemu_available_opts {
bool have_runwith_chroot;
+ bool have_runwith_user;
};
typedef void libxl__dm_spawn_cb(libxl__egc *egc, libxl__dm_spawn_state*,
--
Anthony Perard | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
next prev parent reply other threads:[~2024-08-30 9:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 9:49 [XEN PATCH v2 0/2] libxl: Implement QEMU command line probe Anthony PERARD
2024-08-30 9:49 ` Anthony PERARD [this message]
2024-08-30 9:49 ` [XEN PATCH v2 1/2] libxl: Probe QEMU for -run-with chroot=dir and use it Anthony PERARD
2024-08-30 17:16 ` [XEN PATCH v2 0/2] libxl: Implement QEMU command line probe Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240830094937.40476-3-anthony.perard@vates.tech \
--to=anthony.perard@vates.tech \
--cc=jason.andryuk@amd.com \
--cc=jgross@suse.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.