diff --git a/org.jdrupes.vmoperator.vmconlet/resources/org/jdrupes/vmoperator/vmconlet/VmConlet-view.ftl.html b/org.jdrupes.vmoperator.vmconlet/resources/org/jdrupes/vmoperator/vmconlet/VmConlet-view.ftl.html index 0e4bb26..913f45d 100644 --- a/org.jdrupes.vmoperator.vmconlet/resources/org/jdrupes/vmoperator/vmconlet/VmConlet-view.ftl.html +++ b/org.jdrupes.vmoperator.vmconlet/resources/org/jdrupes/vmoperator/vmconlet/VmConlet-view.ftl.html @@ -70,7 +70,7 @@
| {{ localize("maximumCpus") }} | -{{ entry.spec.vm.maximumCpus }} | +{{ maximumCpus(entry) }} |
| {{ localize("requestedCpus") }} | diff --git a/org.jdrupes.vmoperator.vmconlet/src/org/jdrupes/vmoperator/vmconlet/browser/VmConlet-functions.ts b/org.jdrupes.vmoperator.vmconlet/src/org/jdrupes/vmoperator/vmconlet/browser/VmConlet-functions.ts index cf4740a..44d6471 100644 --- a/org.jdrupes.vmoperator.vmconlet/src/org/jdrupes/vmoperator/vmconlet/browser/VmConlet-functions.ts +++ b/org.jdrupes.vmoperator.vmconlet/src/org/jdrupes/vmoperator/vmconlet/browser/VmConlet-functions.ts @@ -147,9 +147,22 @@ window.orgJDrupesVmOperatorVmConlet.initView = (viewDom: HTMLElement, const cic = new ConditionlInputController(submitCallback); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const maximumCpus = (vmDef: any) => { + if (vmDef.spec.vm["maximumCpus"]) { + return vmDef.spec.vm.maximumCpus; + } + const topo = vmDef.spec.vm.cpuTopology; + return Math.max(1, topo.coresPerDie) + * Math.max(1, topo.diesPerSocket) + * Math.max(1, topo.sockets) + * Math.max(1, topo.threadsPerCore); + } + return { controller, vmInfos, filteredData, detailsByName, localize, shortDateTime, formatMemory, vmAction, cic, parseMemory, + maximumCpus, scopedId: (id: string) => { return idScope.scopedId(id); } }; }