From nobody Mon May 6 01:17:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528983273966779.2674832055376; Thu, 14 Jun 2018 06:34:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B39CC049D5C; Thu, 14 Jun 2018 13:34:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 147388E7A8; Thu, 14 Jun 2018 13:34:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B63394CA80; Thu, 14 Jun 2018 13:34:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5EDYSxj017750 for ; Thu, 14 Jun 2018 09:34:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id CF228210C6D1; Thu, 14 Jun 2018 13:34:28 +0000 (UTC) Received: from thyrus.usersys.redhat.com (unknown [10.34.245.101]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72FC22017D10 for ; Thu, 14 Jun 2018 13:34:28 +0000 (UTC) From: Pino Toscano To: libvir-list@redhat.com Date: Thu, 14 Jun 2018 15:34:25 +0200 Message-Id: <20180614133425.14552-1-ptoscano@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] vmx: allow an odd number of vCPUs X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 14 Jun 2018 13:34:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Most probably this was a limitation in older ESX versions, and it seems it does not exist anymore in more recent versions; see the following thread: https://www.redhat.com/archives/libvir-list/2018-May/msg02159.html https://www.redhat.com/archives/libvir-list/2018-June/msg00043.html Hence, allow an odd number (greater than 1) of vCPUs, since most probably older versions of ESXi will error out anyway. https://bugzilla.redhat.com/show_bug.cgi?id=3D1584091 Signed-off-by: Pino Toscano Reviewed-by: Jiri Denemark --- src/vmx/vmx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 35b4807d22..fe24b060d7 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -59,7 +59,7 @@ def->name =3D <=3D> displayName = =3D "" def->mem.max_balloon =3D <=3D> memsize =3D "" # must be a multiple of 4, defaults to 32 def->mem.cur_balloon =3D <=3D> sched.mem.max =3D "" # defaults to "unlimited" -> def->mem.cur_balloon =3D = def->mem.max_balloon def->mem.min_guarantee =3D <=3D> sched.mem.minsize =3D= "" # defaults to 0 -def->maxvcpus =3D <=3D> numvcpus =3D "" = # must be 1 or a multiple of 2, defaults to 1 +def->maxvcpus =3D <=3D> numvcpus =3D "" = # must be greater than 0, defaults to 1 def->cpumask =3D <=3D> sched.cpu.affinity =3D "" def->cputune.shares =3D <=3D> sched.cpu.shares =3D ""= # with handling for special values = # "high", "normal", "low" @@ -1452,10 +1452,10 @@ virVMXParseConfig(virVMXContext *ctx, if (virVMXGetConfigLong(conf, "numvcpus", &numvcpus, 1, true) < 0) goto cleanup; =20 - if (numvcpus <=3D 0 || (numvcpus % 2 !=3D 0 && numvcpus !=3D 1)) { + if (numvcpus <=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Expecting VMX entry 'numvcpus' to be an unsigned= " - "integer (1 or a multiple of 2) but found %lld"),= numvcpus); + "integer greater than 0 but found %lld"), numvcpu= s); goto cleanup; } =20 @@ -3183,11 +3183,10 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXML= OptionPtr xmlopt, virDomainDe goto cleanup; } maxvcpus =3D virDomainDefGetVcpusMax(def); - if (maxvcpus =3D=3D 0 || (maxvcpus % 2 !=3D 0 && maxvcpus !=3D 1)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML entry 'vcpu' to be 1 or a " - "multiple of 2 but found %d"), - maxvcpus); + if (maxvcpus =3D=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Expecting domain XML entry 'vcpu' to be greater " + "than 0")); goto cleanup; } =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list