[libvirt] [PATCH] conf: fix starting a domain with cpuset=""

Yi Wang wang.yi59 at zte.com.cn
Sat Sep 15 08:29:24 UTC 2018


Domain fails to start when its config xml including:
  <vcpu cpuset="" current="8">64</vcpu>

  # virsh create vm.xml
  error: Failed to create domain from vm.xml
  error: invalid argument: Failed to parse bitmap ''

This patch fixes this.

Signed-off-by: Yi Wang <wang.yi59 at zte.com.cn>
Reviewed-by: Xi Xu <xu.xi8 at zte.com.cn>
---
 src/conf/domain_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8619962..bacafb2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18553,7 +18553,7 @@ virDomainVcpuParse(virDomainDefPtr def,
 
         if (def->placement_mode != VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
             tmp = virXMLPropString(vcpuNode, "cpuset");
-            if (tmp) {
+            if (tmp && strlen(tmp) != 0) {
                 if (virBitmapParse(tmp, &def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
                     goto cleanup;
 
-- 
1.8.3.1




More information about the libvir-list mailing list