On Tue, 2014-06-17 at 16:24 +0100, Ian Campbell wrote:
+ if (xenXMConfigGetString(conf, "extra",
&extra, NULL) < 0)
This was subtly broken. The default needs to be "".
-----8<------
From 539412a6deac8b928c82945d692ef20a49535d65 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell(a)citrix.com>
Date: Tue, 17 Jun 2014 15:48:48 +0100
Subject: [PATCH] xen: handle root= in xen-xm configuration files.
In addition to extra= xm supported a root= option which was supposed
to be incorporated into the final command line. Handle that for "virsh
domxml-from-native xen-xm". Tested with the libxl backend.
Signed-off-by: Ian Campbell <ian.campbell(a)citrix.com>
---
v2: extra should default to "".
---
.gnulib | 2 +-
---> WTF. I stripped this out of the patch shown below...
src/xenxs/xen_xm.c | 14 +++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index b2db97d..745041b 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -339,6 +339,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
def->os.nBootDevs++;
}
} else {
+ const char *extra, *root;
+
if (xenXMConfigCopyStringOpt(conf, "bootloader",
&def->os.bootloader) < 0)
goto cleanup;
if (xenXMConfigCopyStringOpt(conf, "bootargs",
&def->os.bootloaderArgs) < 0)
@@ -348,8 +350,18 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto cleanup;
if (xenXMConfigCopyStringOpt(conf, "ramdisk", &def->os.initrd)
< 0)
goto cleanup;
- if (xenXMConfigCopyStringOpt(conf, "extra", &def->os.cmdline)
< 0)
+ if (xenXMConfigGetString(conf, "extra", &extra, "") <
0)
+ goto cleanup;
+ if (xenXMConfigGetString(conf, "root", &root, NULL) < 0)
goto cleanup;
+
+ if (root) {
+ if (virAsprintf(&def->os.cmdline, "root=%s %s", root, extra)
< 0)
+ goto cleanup;
+ } else {
+ if (VIR_STRDUP(def->os.cmdline, extra) < 0)
+ goto cleanup;
+ }
}
if (xenXMConfigGetULongLong(conf, "memory", &def->mem.cur_balloon,
--
1.7.10.4