[libvirt] [PATCH] Fix xend XML generation when CPU pinning is used

john.levon at sun.com john.levon at sun.com
Thu Jan 29 04:28:26 UTC 2009


# HG changeset patch
# User john.levon at sun.com
# Date 1233203295 28800
# Node ID 9aac8028d5f266023c85338afe71ecabe26079f7
# Parent  add5d46423d8cc24ac922373ba5cd1b3ea2e6f9f
Fix xend XML generation when CPU pinning is used

Signed-off-by: John Levon <john.levon at sun.com>

diff --git a/src/xend_internal.c b/src/xend_internal.c
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -2227,11 +2227,21 @@ xenDaemonParseSxpr(virConnectPtr conn,
         def->maxmem = def->memory;
 
     if (cpus != NULL) {
+        def->cpumasklen = VIR_DOMAIN_CPUMASK_LEN;
+        if (VIR_ALLOC_N(def->cpumask, def->cpumasklen) < 0) {
+            virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
+            goto error;
+        }
+
         if (virDomainCpuSetParse(conn, &cpus,
                                  0, def->cpumask,
-                                 def->cpumasklen) < 0)
+                                 def->cpumasklen) < 0) {
+            virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                         _("invalid CPU mask %s"), cpus);
             goto error;
-    }
+        }
+    }
+
     def->vcpus = sexpr_int(root, "domain/vcpus");
 
     tmp = sexpr_node(root, "domain/on_poweroff");




More information about the libvir-list mailing list