From 3ddb4d2b23e52b53561b8e5bc904c3fbf2b6f138 Mon Sep 17 00:00:00 2001 From: wescoeur Date: Wed, 23 Mar 2016 17:37:41 +0100 Subject: [PATCH] Log VM migrations (density mode). --- packages/xo-server-load-balancer/src/index.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/xo-server-load-balancer/src/index.js b/packages/xo-server-load-balancer/src/index.js index deadd6a40..19bb826a1 100644 --- a/packages/xo-server-load-balancer/src/index.js +++ b/packages/xo-server-load-balancer/src/index.js @@ -490,7 +490,7 @@ class PerformancePlan extends Plan { } await Promise.all(promises) - debug(`${optimizationsCount} optimizations for Host (${exceededHost.id}).`) + debug(`Performance mode: ${optimizationsCount} optimizations for Host (${exceededHost.id}).`) return } @@ -526,6 +526,7 @@ class DensityPlan extends Plan { } = results const pools = await this._getPlanPools() + let optimizationsCount = 0 for (const hostToOptimize of toOptimize) { const { @@ -588,8 +589,11 @@ class DensityPlan extends Plan { // Migrate. await this._migrate(simulResults.moves) + optimizationsCount++ } } + + debug(`Density mode: ${optimizationsCount} optimizations.`) } async _simulate ({ host, destinations, hostsAverages }) { @@ -677,7 +681,17 @@ class DensityPlan extends Plan { } async _migrate (moves) { - console.log(moves) + await Promise.all( + mapToArray(moves, move => { + const { + vm, + destination + } = move + const xapiSrc = this.xo.getXapi(destination) + debug(`Migrate VM (${vm.id}) to Host (${destination.id}) from Host (${vm.$container}).`) + // xapiSrc.migrateVm(vm._xapiId, this.xo.getXapi(destination), destination._xapiId) + }) + ) } }