fix(load-balancer): bad comparison to evaluate migration in perf plan (#7288)

Memory is compared to CPU usage to migrate VM in performance plan context.

This condition can cause unwanted migrations.
This commit is contained in:
Ronan Abhamon 2024-01-08 11:25:40 +01:00 committed by GitHub
parent bb19afc45c
commit d949112921
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -17,6 +17,7 @@
- [Settings/Logs] Fix `sr.getAllUnhealthyVdiChainsLength: not enough permissions` error with non-admin users (PR [#7265](https://github.com/vatesfr/xen-orchestra/pull/7265))
- [Settings/Logs] Fix `proxy.getAll: not enough permissions` error with non-admin users (PR [#7249](https://github.com/vatesfr/xen-orchestra/pull/7249))
- [Replication/Health Check] Fix `healthCheckVm.add_tag is not a function` error [Forum#69156](https://xcp-ng.org/forum/post/69156)
- [Plugin/load-balancer] Prevent unwanted migrations to hosts with low free memory (PR [#7288](https://github.com/vatesfr/xen-orchestra/pull/7288))
### Packages to release
@ -35,6 +36,7 @@
<!--packages-start-->
- @xen-orchestra/backups patch
- xo-server-load-balancer patch
- xo-cli patch
- xo-server patch
- xo-web minor

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.cpu.high ||
destinationAverages.memoryFree - vmAverages.memory <= this._thresholds.memory.high ||
(!state.cpu &&
!state.memory &&
(exceededAverages.cpu - vmAverages.cpu < destinationAverages.cpu + vmAverages.cpu ||