From 18473e6819b5d55386850bdf728ef3bcce48dc9e Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Tue, 30 Jun 2015 13:05:30 +0200 Subject: [PATCH] Fix inter pool migration. --- src/api/vm.coffee | 30 +++++++++++++----------------- src/xapi-objects-to-xo.js | 2 +- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/api/vm.coffee b/src/api/vm.coffee index d6c7014ea..b00de0a56 100644 --- a/src/api/vm.coffee +++ b/src/api/vm.coffee @@ -196,26 +196,22 @@ migratePool = $coroutine ({ network migrationNetwork }) -> - try - # TODO: map multiple VDI and VIF + # TODO: map multiple VDI and VIF - # Optional parameters - # if no network given, try to use the management network - unless network - PIF = $findWhere (@getObjects host.$PIFs), management: true - network = @getObject PIF.$network, 'network' + # Optional parameters + # if no network given, try to use the management network + unless network + PIF = $findWhere (@getObjects host.$PIFs), management: true + network = @getObject PIF.$network, 'network' - # if no migrationNetwork, use the network - migrationNetwork ?= network + # if no migrationNetwork, use the network + migrationNetwork ?= network - # if no sr is given, try to find the default Pool SR - unless SR - pool = @getObject host.poolRef, 'pool' - target_sr_id = pool.default_SR - SR = @getObject target_sr_id, 'SR' - - catch - @throw 'NO_SUCH_OBJECT' + # if no sr is given, try to find the default Pool SR + unless SR + pool = @getObject host.poolRef, 'pool' + target_sr_id = pool.default_SR + SR = @getObject target_sr_id, 'SR' unless $isVMRunning VM @throw 'INVALID_PARAMS', 'The VM can only be migrated when running' diff --git a/src/xapi-objects-to-xo.js b/src/xapi-objects-to-xo.js index 5fda053a1..c55ce143c 100644 --- a/src/xapi-objects-to-xo.js +++ b/src/xapi-objects-to-xo.js @@ -322,7 +322,7 @@ export function pif (obj) { device: obj.device, IP: obj.IP, MAC: obj.MAC, - management: obj.management, // TODO: find a better name. + management: Boolean(obj.management), // TODO: find a better name. mode: obj.ip_configuration_mode, MTU: +obj.MTU, netmask: obj.netmask,