fix(xo-server-load-balancer): error during optimize (#7362)

Introduced by d949112

Fixes #7359
This commit is contained in:
b-Nollet 2024-02-07 15:48:10 +01:00 committed by GitHub
parent 92fc19e2e3
commit 83a94eefd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,7 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [Import/VMWare] Fix `(Failure \"Expected string, got 'I(0)'\")` (PR [#7361](https://github.com/vatesfr/xen-orchestra/issues/7361))
- [Plugin/load-balancer] Fixing `TypeError: Cannot read properties of undefined (reading 'high')` happening when trying to optimize a host with performance plan [#7359](https://github.com/vatesfr/xen-orchestra/issues/7359) (PR [#7362](https://github.com/vatesfr/xen-orchestra/pull/7362))
### Packages to release
@ -30,5 +31,6 @@
<!--packages-start-->
- xo-server patch
- xo-server-load-balancer patch
<!--packages-end-->

View File

@ -178,7 +178,7 @@ export default class PerformancePlan extends Plan {
const state = this._getThresholdState(exceededAverages)
if (
destinationAverages.cpu + vmAverages.cpu >= this._thresholds.cpu.low ||
destinationAverages.memoryFree - vmAverages.memory <= this._thresholds.memory.high ||
destinationAverages.memoryFree - vmAverages.memory <= this._thresholds.memoryFree.high ||
(!state.cpu &&
!state.memory &&
(exceededAverages.cpu - vmAverages.cpu < destinationAverages.cpu + vmAverages.cpu ||