[libvirt] [PATCH] vmx: allow an odd number of vCPUs

Pino Toscano posted 1 patch 5 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180614133425.14552-1-ptoscano@redhat.com
Test syntax-check passed
src/vmx/vmx.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
[libvirt] [PATCH] vmx: allow an odd number of vCPUs
Posted by Pino Toscano 5 years, 10 months ago
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=1584091

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
---
 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 = <value>               <=>   displayName = "<value>"
 def->mem.max_balloon = <value kilobyte>    <=>   memsize = "<value megabyte>"            # must be a multiple of 4, defaults to 32
 def->mem.cur_balloon = <value kilobyte>    <=>   sched.mem.max = "<value megabyte>"      # defaults to "unlimited" -> def->mem.cur_balloon = def->mem.max_balloon
 def->mem.min_guarantee = <value kilobyte>  <=>   sched.mem.minsize = "<value megabyte>"  # defaults to 0
-def->maxvcpus = <value>           <=>   numvcpus = "<value>"                    # must be 1 or a multiple of 2, defaults to 1
+def->maxvcpus = <value>           <=>   numvcpus = "<value>"                    # must be greater than 0, defaults to 1
 def->cpumask = <uint list>        <=>   sched.cpu.affinity = "<uint list>"
 def->cputune.shares = <value>     <=>   sched.cpu.shares = "<value>"            # 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;
 
-    if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) {
+    if (numvcpus <= 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"), numvcpus);
         goto cleanup;
     }
 
@@ -3183,11 +3183,10 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
         goto cleanup;
     }
     maxvcpus = virDomainDefGetVcpusMax(def);
-    if (maxvcpus == 0 || (maxvcpus % 2 != 0 && maxvcpus != 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 == 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("Expecting domain XML entry 'vcpu' to be greater "
+                         "than 0"));
         goto cleanup;
     }
 
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] vmx: allow an odd number of vCPUs
Posted by Pino Toscano 5 years, 10 months ago
On Thursday, 14 June 2018 15:34:25 CEST Pino Toscano wrote:
> 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=1584091
> 
> Signed-off-by: Pino Toscano <ptoscano@redhat.com>
> ---

Polite ping.

Thanks,
-- 
Pino Toscano--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] vmx: allow an odd number of vCPUs
Posted by Jiri Denemark 5 years, 10 months ago
On Thu, Jun 14, 2018 at 15:34:25 +0200, Pino Toscano wrote:
> 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=1584091
> 
> Signed-off-by: Pino Toscano <ptoscano@redhat.com>
> ---
>  src/vmx/vmx.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)

Polite

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list