Handle maximum CPUs properly.
This commit is contained in:
parent
91a9c8605c
commit
4122fa25d2
2 changed files with 14 additions and 1 deletions
|
|
@ -70,7 +70,7 @@
|
|||
<table class="table--basic table--basic--autoStriped">
|
||||
<tr>
|
||||
<td>{{ localize("maximumCpus") }}</td>
|
||||
<td>{{ entry.spec.vm.maximumCpus }}</td>
|
||||
<td>{{ maximumCpus(entry) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ localize("requestedCpus") }}</td>
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue