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
---
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 =<=> displayName =
""
def->mem.max_balloon = <=> memsize = ""
# must be a multiple of 4, defaults to 32
def->mem.cur_balloon = <=> sched.mem.max = "" # defaults to "unlimited" -> def->mem.cur_balloon =
def->mem.max_balloon
def->mem.min_guarantee = <=> sched.mem.minsize = "" # defaults to 0
-def->maxvcpus =<=> numvcpus = ""
# must be 1 or a multiple of 2, defaults to 1
+def->maxvcpus =<=> numvcpus = ""
# must be greater than 0, defaults to 1
def->cpumask = <=> sched.cpu.affinity = ""
def->cputune.shares = <=> sched.cpu.shares = ""
# with handling for special values
# "high", "normal", "low"
@@ -1452,10 +1452,10 @@ virVMXParseConfig(virVMXContext *ctx,
if (virVMXGetConfigLong(conf, "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