diff options
| author | Thomas Huth <thuth@redhat.com> | 2024-05-06 13:20:58 +0200 |
|---|---|---|
| committer | Thomas Huth <thuth@redhat.com> | 2024-05-10 08:34:29 +0200 |
| commit | 95e0fb0afac678b13a70b476b4ad564569d6df8c (patch) | |
| tree | d9b1bac73cbe56e71dcdd3c35578fa8b30f79af9 /system/vl.c | |
| parent | 6e55b32d45976a8e78cbd3bbdf6ed1148cb2662a (diff) | |
| download | focaccia-qemu-95e0fb0afac678b13a70b476b4ad564569d6df8c.tar.gz focaccia-qemu-95e0fb0afac678b13a70b476b4ad564569d6df8c.zip | |
qemu-options: Deprecate "-runas" and introduce "-run-with user=..." instead
The old "-runas" option has the disadvantage that it is not visible in the QAPI schema, so it is not available via the normal introspection mechanisms. We've recently introduced the "-run-with" option for exactly this purpose, which is meant to handle the options that affect the runtime behavior. Thus let's introduce a "user=..." parameter here now and deprecate the old "-runas" option. Message-ID: <20240506112058.51446-1-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'system/vl.c')
| -rw-r--r-- | system/vl.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/system/vl.c b/system/vl.c index 7756eac81e..b031427440 100644 --- a/system/vl.c +++ b/system/vl.c @@ -773,6 +773,10 @@ static QemuOptsList qemu_run_with_opts = { .name = "chroot", .type = QEMU_OPT_STRING, }, + { + .name = "user", + .type = QEMU_OPT_STRING, + }, { /* end of list */ } }, }; @@ -3586,6 +3590,7 @@ void qemu_init(int argc, char **argv) break; #if defined(CONFIG_POSIX) case QEMU_OPTION_runas: + warn_report("-runas is deprecated, use '-run-with user=...' instead"); if (!os_set_runas(optarg)) { error_report("User \"%s\" doesn't exist" " (and is not <uid>:<gid>)", @@ -3612,6 +3617,16 @@ void qemu_init(int argc, char **argv) if (str) { os_set_chroot(str); } + str = qemu_opt_get(opts, "user"); + if (str) { + if (!os_set_runas(str)) { + error_report("User \"%s\" doesn't exist" + " (and is not <uid>:<gid>)", + optarg); + exit(1); + } + } + break; } #endif /* CONFIG_POSIX */ |