[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] tools/xl: Make extra= usable in combination with cmdline=

c/s 986aea7fbe "xl.cfg: add 'cmdline' in config file" introduced cmdline= and
make extra= and root= unusable if cmdline= was present.

For the vm.cfg file itself, this makes sense.  However, for development
purposes it is very convenient to have a cmdline= in the cfg file, and specify
extra= on the `xl create` command line.

While updating the manpage, correct the entry for cmdline=.  There is never
any appending which goes on with this option, but after this change extra= may
be appended to cmdline=.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Anthony PERARD <anthony.perard@xxxxxxxxxx>

In particular, this is useful for testing Xen as a PVH guest, where switching
between a PV and PVH dom0 involves adding "dom0=pvh dom0-iommu=none" to
command line.  Now, given a single build of Xen under test, two tests can be
run with just

 # xl create shim.cfg ramdisk=\"test-pv64-example\"


 # xl create shim.cfg ramdisk=\"test-hvm64-example\" extra=\"dom0=pvh\ 

without needing to edit shim.cfg inbetween.
 docs/man/xl.cfg.5.pod.in | 14 ++++++++++----
 tools/xl/xl_parse.c      | 12 ++++++++----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index c99d40307e..ca34f3c623 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -431,18 +431,24 @@ Load the specified file as the ramdisk.
 =item B<cmdline="STRING">
-Append B<STRING> to the kernel command line. (Note: the meaning of
-this is guest specific). It can replace B<root="STRING">
-along with B<extra="STRING"> and is preferred. When B<cmdline="STRING"> is set,
-B<root="STRING"> and B<extra="STRING"> will be ignored.
+Use B<STRING> as the kernel command line. (Note: the meaning of this is guest
+When this option is specified, B<root="STRING"> will be ignored.
 =item B<root="STRING">
+This option is deprecated and its use is discouraged.  It will be ignored if
+B<cmdline=> is specified.
 Append B<root=STRING> to the kernel command line (Note: the meaning of this
 is guest specific).
 =item B<extra="STRING">
+This option is deprecated and its use in configuration files is discouraged.
+It may however be useful to use on the command line for B<xl create>.
 Append B<STRING> to the kernel command line. (Note: the meaning of this
 is guest specific).
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index e105bda2bb..2cad5c6e08 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -287,10 +287,14 @@ static char *parse_cmdline(XLU_Config *config)
     xlu_cfg_get_string (config, "extra", &extra, 0);
     if (buf) {
-        cmdline = strdup(buf);
-        if (root || extra)
-            fprintf(stderr, "Warning: ignoring root= and extra= "
-                    "in favour of cmdline=\n");
+        if (root)
+            fprintf(stderr, "Warning: ignoring root= in favour of cmdline=\n");
+        if (extra) {
+            xasprintf(&cmdline, "%s %s", buf, extra);
+        } else {
+            cmdline = strdup(buf);
+        }
     } else {
         if (root && extra) {
             xasprintf(&cmdline, "root=%s %s", root, extra);

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.