From: Cole Robinson Date: Mon, 22 Nov 2010 16:34:27 +0000 (-0500) Subject: conf: domain: Improve vcpus validation reporting X-Git-Tag: v0.8.6~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81e6f68d0eb7c3a35f0583411200151d50e3203d;p=thirdparty%2Flibvirt.git conf: domain: Improve vcpus validation reporting --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1ae4840012..e8d030dbe0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4569,7 +4569,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, def->maxvcpus = 1; } else { def->maxvcpus = count; - if (def->maxvcpus != count || count == 0) { + if (count == 0) { virDomainReportError(VIR_ERR_XML_ERROR, _("invalid maxvcpus %lu"), count); goto error; @@ -4585,11 +4585,18 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, def->vcpus = def->maxvcpus; } else { def->vcpus = count; - if (def->vcpus != count || count == 0 || def->maxvcpus < count) { + if (count == 0) { virDomainReportError(VIR_ERR_XML_ERROR, _("invalid current vcpus %lu"), count); goto error; } + + if (def->maxvcpus < count) { + virDomainReportError(VIR_ERR_INTERNAL_ERROR, + _("maxvcpus must not be less than current vcpus (%d < %lu)"), + def->maxvcpus, count); + goto error; + } } tmp = virXPathString("string(./vcpu[1]/@cpuset)", ctxt);