Patchwork [RFC,10/10] vl.c: Handle legacy "-numa node, cpus=A, B, C, D" format

login
register
mail settings
Submitter Eduardo Habkost
Date Jan. 11, 2013, 6:15 p.m.
Message ID <1357928108-21066-11-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/211410/
State New
Headers show

Comments

Eduardo Habkost - Jan. 11, 2013, 6:15 p.m.
As libvirt already uses this format and expects it to work, add a small
hack to the legacy -numa option parsing code to make the "cpus=A,B,C,D"
format work.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch

diff --git a/vl.c b/vl.c
index 14bf9b6..cf30d44 100644
--- a/vl.c
+++ b/vl.c
@@ -1194,6 +1194,17 @@  static void parse_legacy_numa_node(const char *optarg)
             p++;
         }
         qemu_opt_set(opts, option, value);
+
+        /* special case for "cpus", as it can contain "," */
+        if (!strcmp(option, "cpus")) {
+            while (isdigit(*p)) {
+                p = get_opt_value(value, 128, p);
+                if (*p == ',') {
+                    p++;
+                }
+                qemu_opt_set(opts, "cpus", value);
+            }
+        }
     }
 }