Skip to contentSkip to conversation

tools/xl: Make extra= usable in combination with cmdline=

PATCH In review Andrew Cooper 3 participants 3 messages Aug 5, 2019 – Aug 6, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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=.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Anthony PERARD <[email protected]>

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\"

and

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

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(-)
docs/man/xl.cfg.5.pod.in +10 -4
index c99d40307e..ca34f3c623 100644
@@ -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
+specific).
+
+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).
 
tools/xl/xl_parse.c +8 -4
index e105bda2bb..2cad5c6e08 100644
@@ -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);
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Andrew Cooper

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=.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Anthony PERARD <[email protected]>

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

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

and

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

without needing to edit shim.cfg inbetween.

:(, this feels like the wrong approach. It is time to invent += ? So we can do cmdline+="x", disk+=['xvdz'], ... :-).

The cmdline' option have been there for sometime, so hopefully no one has both cmdline' and `extra' in there config file and changing the meaning of extra would be ok.

With that in mind, the patch looks fine,

Thanks,

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

Anthony PERARD writes ("Re: [PATCH] tools/xl: Make extra= usable in combination with cmdline="):

Quoted 7 lines · Andrew Cooper
Quoted 3 lines
 # xl create shim.cfg ramdisk=\"test-hvm64-example\" extra=\"dom0=pvh\ dom0-iommu=none\"

without needing to edit shim.cfg inbetween.

:(, this feels like the wrong approach. It is time to invent += ? So we can do cmdline+="x", disk+=['xvdz'], ... :-).

+1

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel