xl: recognize the "extra" entry in the domain config file
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 19 May 2010 07:18:51 +0000 (08:18 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 19 May 2010 07:18:51 +0000 (08:18 +0100)
"extra" defines extra parameters to be added to the kernel command
line, so append it accordingly.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
tools/libxl/xl_cmdimpl.c

index 9c37d43e84fa0ab7c733898734a1d3f2ad78aa13..768547e4dde55d812af9b30a610d7314cf7554d7 100644 (file)
@@ -507,14 +507,25 @@ static void parse_config_data(const char *configfile_filename_report,
         if (!xlu_cfg_get_long (config, "viridian", &l))
             b_info->u.hvm.viridian = l;
     } else {
-        char *cmdline;
-        if (!xlu_cfg_get_string (config, "root", &buf)) {
-            if (asprintf(&cmdline, "root=%s", buf) < 0) {
-                fprintf(stderr, "Failed to allocate memory in asprintf\n");
-                exit(1);
-            }
-            b_info->u.pv.cmdline = cmdline;
+        char *cmdline = NULL;
+        const char *root = NULL, *extra = "";
+
+        xlu_cfg_get_string (config, "root", &root);
+        xlu_cfg_get_string (config, "extra", &extra);
+
+        if (root) {
+            if (asprintf(&cmdline, "root=%s %s", root, extra) == -1)
+                cmdline = NULL;
+        } else {
+            cmdline = strdup(extra);
         }
+
+        if ((root || extra) && !cmdline) {
+            fprintf(stderr, "Failed to allocate memory for cmdline\n");
+            exit(1);
+        }
+
+        b_info->u.pv.cmdline = cmdline;
         if (!xlu_cfg_get_string (config, "ramdisk", &buf))
             b_info->u.pv.ramdisk = strdup(buf);
     }