]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
conf: numa: Improve error message in case a numa node doesn't have cpus
authorPeter Krempa <pkrempa@redhat.com>
Wed, 11 Feb 2015 16:38:29 +0000 (17:38 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 20 Feb 2015 16:43:04 +0000 (17:43 +0100)
Currently the code would exit without reporting an error as
virBitmapParse reports one only if it fails to parse the bitmap, whereas
the code was jumping to the error label even in case 0 cpus were
correctly parsed in the map.

src/conf/numa_conf.c

index d21d62e74573e9c1c5ed6fe3844854fff9610021..39061adc86690260dd156479bcc6def861b64ed8 100644 (file)
@@ -749,9 +749,14 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def,
         }
 
         if (virBitmapParse(tmp, 0, &def->cells[cur_cell].cpumask,
-                           VIR_DOMAIN_CPUMASK_LEN) <= 0)
+                           VIR_DOMAIN_CPUMASK_LEN) < 0)
             goto cleanup;
 
+        if (virBitmapIsAllClear(def->cells[cur_cell].cpumask)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                          _("NUMA cell %d has no vCPUs assigned"), cur_cell);
+            goto cleanup;
+        }
         VIR_FREE(tmp);
 
         ctxt->node = nodes[i];