From: Martin Kletzander Date: Thu, 12 Jan 2012 10:11:33 +0000 (+0100) Subject: Added check for maximum number of vcpus exceeding topology limit X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b54de0830a1bd236c07f729a4592d77251c1b5a3;p=libvirt.git Added check for maximum number of vcpus exceeding topology limit Earlier, when the number of vcpus was greater than the topology allowed, libvirt didn't raise an error and continued, resulting in running qemu with parameters making no sense. Even though qemu did not report any error itself, the number of vcpus was set to maximum allowed by the topology. --- diff --git a/AUTHORS b/AUTHORS index b681424bcb..74f3157746 100644 --- a/AUTHORS +++ b/AUTHORS @@ -215,6 +215,7 @@ Patches have also been contributed by: Rommer Yuri Chornoivan Deepak C Shetty + Martin Kletzander [....send patches to get your name here....] diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 180dd2bf9d..5e36270613 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8010,6 +8010,14 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (def->cpu == NULL) goto error; + if (def->cpu->sockets && + def->maxvcpus > + def->cpu->sockets * def->cpu->cores * def->cpu->threads) { + virDomainReportError(VIR_ERR_XML_DETAIL, "%s", + _("Maximum CPUs greater than topology limit")); + goto error; + } + if (def->cpu->cells_cpus > def->maxvcpus) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Number of CPUs in exceeds the"