
On 11/20/2015 10:22 AM, Peter Krempa wrote:
--- src/conf/domain_conf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d8c1068..3062b3a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1461,6 +1461,13 @@ int virDomainDefSetVCpus(virDomainDefPtr def, unsigned int vcpus) { + if (vcpus > def->maxvcpus) {
Use accessor (virDomainDefGetVCpusMax) FWIW: Just thinking about patch 12 where the code is reading off the command line and setting counts, but not checking that vcpus <= maxvcpus in qemuParseCommandLineSmp... Although I suspect that won't be a problem since that code is reading qemu command line and I would hope we could assume (haha) that qemu would have failed if vcpus > maxvcpus and of course if cores/threads/sockets didn't add up properly as well. ACK with the accessor change. John
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("maxvcpus must not be less than current vcpus (%u < %u)"), + vcpus, def->maxvcpus); + return -1; + } + def->vcpus = vcpus;
return 0; @@ -14723,13 +14730,6 @@ virDomainVcpuParse(virDomainDefPtr def, if (virDomainDefSetVCpus(def, vcpus) < 0) goto cleanup;
- if (maxvcpus < def->vcpus) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("maxvcpus must not be less than current vcpus " - "(%u < %u)"), maxvcpus, def->vcpus); - goto cleanup; - } - tmp = virXPathString("string(./vcpu[1]/@placement)", ctxt); if (tmp) { if ((def->placement_mode =