From b09da76b04c7ae54b1b5ad9a90fc814c6c35a523 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Mon, 27 Aug 2018 11:03:08 +0200 Subject: [PATCH] fix(xo-server/{export,import}Vdi): dont pass host (#3355) Relies on redirection handling in `xen-api`. Fixes #3354 --- CHANGELOG.md | 1 + packages/xo-server/src/xapi/index.js | 21 ++++----------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41dffc268..0b981c193 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Bug fixes - [Remotes] Fix "undefined" mount option issue [#3361](https://github.com/vatesfr/xen-orchestra/issues/3361) (PR [#3363](https://github.com/vatesfr/xen-orchestra/pull/3363)) +- [Continuous Replication] Don't try to import on halted host [#3354](https://github.com/vatesfr/xen-orchestra/issues/3354) (PR [#3355](https://github.com/vatesfr/xen-orchestra/pull/3355)) ### Released packages diff --git a/packages/xo-server/src/xapi/index.js b/packages/xo-server/src/xapi/index.js index e3be0c4a6..cd0d823d1 100644 --- a/packages/xo-server/src/xapi/index.js +++ b/packages/xo-server/src/xapi/index.js @@ -1940,9 +1940,6 @@ export default class Xapi extends XapiBase { @concurrency(12, stream => stream.then(stream => fromEvent(stream, 'end'))) @cancelable _exportVdi ($cancelToken, vdi, base, format = VDI_FORMAT_VHD) { - const sr = vdi.$SR - const host = sr.$PBDs[0].$host - const query = { format, vdi: vdi.$ref, @@ -1958,13 +1955,12 @@ export default class Xapi extends XapiBase { ) return this.getResource($cancelToken, '/export_raw_vdi/', { - host, query, task: this.createTask('VDI Export', vdi.name_label), }).catch(error => { // augment the error with as much relevant info as possible - error.host = host - error.SR = sr + error.pool_master = vdi.$pool.$master + error.SR = vdi.$SR error.VDI = vdi throw error @@ -1979,19 +1975,10 @@ export default class Xapi extends XapiBase { // ----------------------------------------------------------------- async _importVdiContent (vdi, body, format = VDI_FORMAT_VHD) { - const sr = vdi.$SR - const pbd = find(sr.$PBDs, 'currently_attached') - if (pbd === undefined) { - throw new Error('no valid PBDs found') - } - - const host = pbd.$host - await Promise.all([ body.task, body.checksumVerified, this.putResource(body, '/import_raw_vdi/', { - host, query: { format, vdi: vdi.$ref, @@ -2000,8 +1987,8 @@ export default class Xapi extends XapiBase { }), ]).catch(error => { // augment the error with as much relevant info as possible - error.host = host - error.SR = sr + error.pool_master = vdi.$pool.$master + error.SR = vdi.$SR error.VDI = vdi throw error