libxl: Probe QEMU for -run-with user=user and use it

"-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>
This commit is contained in:
Anthony PERARD authored and Andrew Cooper committed 2024-08-30 18:14:11 +01:00
1 parent 82335a8cc5
commit 1436593d5f
2 files changed
+9

No files matched your search

+8
View File
@@ -2052,10 +2052,15 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
}
if (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);
*args = (char **) flexarray_contents(dm_args);
flexarray_append(dm_envs, 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;
}
}
/*
+1
View File
@@ -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*,
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.