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.
This commit is contained in:
Martin Kletzander 2012-01-12 11:11:33 +01:00 committed by Eric Blake
parent 29db7a0072
commit b54de0830a
2 changed files with 9 additions and 0 deletions

View File

@ -215,6 +215,7 @@ Patches have also been contributed by:
Rommer <rommer@active.by>
Yuri Chornoivan <yurchor@ukr.net>
Deepak C Shetty <deepakcs@linux.vnet.ibm.com>
Martin Kletzander <mkletzan@redhat.com>
[....send patches to get your name here....]

View File

@ -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 <numa> exceeds the"