diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f536630d72..a2dd7d649f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18030,6 +18030,7 @@ virDomainVcpuParse(virDomainDef *def, unsigned int vcpus; g_autofree char *tmp = NULL; g_autofree xmlNodePtr *nodes = NULL; + int rc; vcpus = maxvcpus = 1; @@ -18044,10 +18045,11 @@ virDomainVcpuParse(virDomainDef *def, } VIR_FREE(tmp); - vcpus = maxvcpus; - - if (virXMLPropUInt(vcpuNode, "current", 10, VIR_XML_PROP_NONE, &vcpus) < 0) + if ((rc = virXMLPropUInt(vcpuNode, "current", 10, VIR_XML_PROP_NONE, &vcpus)) < 0) { return -1; + } else if (rc == 0) { + vcpus = maxvcpus; + } def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC; if (virXMLPropEnum(vcpuNode, "placement",