From: Jason Andryuk <jandryuk@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: "Anthony PERARD" <anthony.perard@citrix.com>,
"Ian Jackson" <ian.jackson@citrix.com>,
"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
"Wei Liu" <wl@xen.org>, "Jason Andryuk" <jandryuk@gmail.com>
Subject: [PATCH v7 07/19] libxl: write qemu arguments into separate xenstore keys
Date: Mon, 18 May 2020 21:54:51 -0400 [thread overview]
Message-ID: <20200519015503.115236-8-jandryuk@gmail.com> (raw)
In-Reply-To: <20200519015503.115236-1-jandryuk@gmail.com>
From: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
This allows using arguments with spaces, like -append, without
nominating any special "separator" character.
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
Write arguments in dm-argv directory instead of overloading mini-os's
dmargs string.
Make libxl__write_stub_dmargs vary behaviour based on the
is_linux_stubdom flag.
Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
Changes in v3:
- previous version of this patch "libxl: use \x1b to separate qemu
arguments for linux stubdomain" used specific non-printable
separator, but it was rejected as xenstore doesn't cope well with
non-printable chars
Changes in v6:
- Re-work to use libxl__xs_ functions in a loop.
- Drop rtc/timeoffset
Changes in v7:
- Use a single function with an is_linux_stubdom flag.
Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
tools/libxl/libxl_dm.c | 77 +++++++++++++++++++++++++++---------------
1 file changed, 49 insertions(+), 28 deletions(-)
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 8e57cd8c1f..23b13f84d2 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -2068,13 +2068,11 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc,
static int libxl__write_stub_dmargs(libxl__gc *gc,
int dm_domid, int guest_domid,
- char **args)
+ char **args, bool is_linux_stubdom)
{
- int i;
- char *dmargs;
- int dmargs_size;
struct xs_permissions roperm[2];
xs_transaction_t t = XBT_NULL;
+ char *dmargs;
int rc;
roperm[0].id = 0;
@@ -2082,22 +2080,27 @@ static int libxl__write_stub_dmargs(libxl__gc *gc,
roperm[1].id = dm_domid;
roperm[1].perms = XS_PERM_READ;
- i = 0;
- dmargs_size = 0;
- while (args[i] != NULL) {
- dmargs_size = dmargs_size + strlen(args[i]) + 1;
- i++;
- }
- dmargs_size++;
- dmargs = (char *) libxl__malloc(gc, dmargs_size);
- i = 1;
- dmargs[0] = '\0';
- while (args[i] != NULL) {
- if (strcmp(args[i], "-sdl") && strcmp(args[i], "-M") && strcmp(args[i], "xenfv")) {
- strcat(dmargs, " ");
- strcat(dmargs, args[i]);
+ if (!is_linux_stubdom) {
+ int dmargs_size = 0;
+ int i = 0;
+
+ while (args[i] != NULL) {
+ dmargs_size = dmargs_size + strlen(args[i]) + 1;
+ i++;
+ }
+
+ dmargs_size++;
+ dmargs = (char *) libxl__malloc(gc, dmargs_size);
+
+ i = 1;
+ dmargs[0] = '\0';
+ while (args[i] != NULL) {
+ if (strcmp(args[i], "-sdl") && strcmp(args[i], "-M") && strcmp(args[i], "xenfv")) {
+ strcat(dmargs, " ");
+ strcat(dmargs, args[i]);
+ }
+ i++;
}
- i++;
}
for (;;) {
@@ -2113,17 +2116,33 @@ static int libxl__write_stub_dmargs(libxl__gc *gc,
&vm_path);
if (rc) goto out;
- path = GCSPRINTF("%s/image/dmargs", vm_path);
+ if (is_linux_stubdom) {
+ int i;
- rc = libxl__xs_mknod(gc, t, path, roperm, ARRAY_SIZE(roperm));
- if (rc) goto out;
+ path = GCSPRINTF("%s/image/dm-argv", vm_path);
- rc = libxl__xs_write_checked(gc, t, path, dmargs);
- if (rc) goto out;
+ rc = libxl__xs_mknod(gc, t, path, roperm, ARRAY_SIZE(roperm));
+ if (rc) goto out;
- rc = libxl__xs_mknod(gc, t, GCSPRINTF("%s/rtc/timeoffset", vm_path),
- roperm, ARRAY_SIZE(roperm));
- if (rc) goto out;
+ for (i=1; args[i] != NULL; i++) {
+ rc = libxl__xs_write_checked(gc, t,
+ GCSPRINTF("%s/%03d", path, i),
+ args[i]);
+ if (rc) goto out;
+ }
+ } else {
+ path = GCSPRINTF("%s/image/dmargs", vm_path);
+
+ rc = libxl__xs_mknod(gc, t, path, roperm, ARRAY_SIZE(roperm));
+ if (rc) goto out;
+
+ rc = libxl__xs_write_checked(gc, t, path, dmargs);
+ if (rc) goto out;
+
+ rc = libxl__xs_mknod(gc, t, GCSPRINTF("%s/rtc/timeoffset", vm_path),
+ roperm, ARRAY_SIZE(roperm));
+ if (rc) goto out;
+ }
rc = libxl__xs_transaction_commit(gc, &t);
if (!rc) break;
@@ -2298,7 +2317,9 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
libxl__store_libxl_entry(gc, guest_domid, "dm-version",
libxl_device_model_version_to_string(dm_config->b_info.device_model_version));
- libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args);
+
+ libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args,
+ libxl__stubdomain_is_linux(&guest_config->b_info));
libxl__xs_printf(gc, XBT_NULL,
GCSPRINTF("%s/image/device-model-domid",
libxl__xs_get_dompath(gc, guest_domid)),
--
2.25.1
next prev parent reply other threads:[~2020-05-19 1:56 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 1:54 [PATCH v7 00/19] Add support for qemu-xen runnning in a Linux-based stubdomain Jason Andryuk
2020-05-18 22:24 ` Wei Liu
2020-05-19 1:54 ` [PATCH v7 01/19] Document ioemu MiniOS stubdomain protocol Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 02/19] Document ioemu Linux " Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 03/19] libxl: fix qemu-trad cmdline for no sdl/vnc case Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 04/19] libxl: Allow running qemu-xen in stubdomain Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 05/19] libxl: Handle Linux stubdomain specific QEMU options Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 06/19] libxl: Use libxl__xs_* in libxl__write_stub_dmargs Jason Andryuk
2020-05-19 15:09 ` Ian Jackson
2020-05-19 1:54 ` Jason Andryuk [this message]
2020-05-19 15:10 ` [PATCH v7 07/19] libxl: write qemu arguments into separate xenstore keys Ian Jackson
2020-05-19 15:21 ` Wei Liu
2020-05-19 15:33 ` Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 08/19] xl: add stubdomain related options to xl config parser Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 09/19] tools/libvchan: notify server when client is connected Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 10/19] libxl: add save/restore support for qemu-xen in stubdomain Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 11/19] tools: add missing libxenvchan cflags Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 12/19] tools: add simple vchan-socket-proxy Jason Andryuk
2020-05-21 11:09 ` Andrew Cooper
2020-05-21 13:12 ` Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 13/19] libxl: Refactor kill_device_model to libxl__kill_xs_path Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 14/19] libxl: use vchan for QMP access with Linux stubdomain Jason Andryuk
2020-05-19 1:54 ` [PATCH v7 15/19] libxl: require qemu in dom0 for multiple stubdomain consoles Jason Andryuk
2020-05-19 1:55 ` [PATCH v7 16/19] libxl: ignore emulated IDE disks beyond the first 4 Jason Andryuk
2020-05-19 1:55 ` [PATCH v7 17/19] libxl: consider also qemu in stubdomain in libxl__dm_active check Jason Andryuk
2020-05-19 1:55 ` [PATCH v7 18/19] docs: Add device-model-domid to xenstore-paths Jason Andryuk
2020-05-19 1:55 ` [PATCH v7 19/19] libxl: Check stubdomain kernel & ramdisk presence Jason Andryuk
2020-05-22 9:10 ` [PATCH v7 00/19] Add support for qemu-xen runnning in a Linux-based stubdomain George Dunlap
2020-05-22 9:54 ` Paul Durrant
2020-05-22 13:30 ` Jason Andryuk
2020-05-22 13:37 ` Ian Jackson
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=20200519015503.115236-8-jandryuk@gmail.com \
--to=jandryuk@gmail.com \
--cc=anthony.perard@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=marmarek@invisiblethingslab.com \
--cc=wl@xen.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).