fix(xo-server/{export,import}Vdi): dont pass host (#3355)

Relies on redirection handling in `xen-api`.

Fixes #3354
This commit is contained in:
Julien Fontanet 2018-08-27 11:03:08 +02:00 committed by GitHub
parent ce35bbaeb4
commit b09da76b04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 17 deletions

View File

@ -7,6 +7,7 @@
### Bug fixes ### 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)) - [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 ### Released packages

View File

@ -1940,9 +1940,6 @@ export default class Xapi extends XapiBase {
@concurrency(12, stream => stream.then(stream => fromEvent(stream, 'end'))) @concurrency(12, stream => stream.then(stream => fromEvent(stream, 'end')))
@cancelable @cancelable
_exportVdi ($cancelToken, vdi, base, format = VDI_FORMAT_VHD) { _exportVdi ($cancelToken, vdi, base, format = VDI_FORMAT_VHD) {
const sr = vdi.$SR
const host = sr.$PBDs[0].$host
const query = { const query = {
format, format,
vdi: vdi.$ref, vdi: vdi.$ref,
@ -1958,13 +1955,12 @@ export default class Xapi extends XapiBase {
) )
return this.getResource($cancelToken, '/export_raw_vdi/', { return this.getResource($cancelToken, '/export_raw_vdi/', {
host,
query, query,
task: this.createTask('VDI Export', vdi.name_label), task: this.createTask('VDI Export', vdi.name_label),
}).catch(error => { }).catch(error => {
// augment the error with as much relevant info as possible // augment the error with as much relevant info as possible
error.host = host error.pool_master = vdi.$pool.$master
error.SR = sr error.SR = vdi.$SR
error.VDI = vdi error.VDI = vdi
throw error throw error
@ -1979,19 +1975,10 @@ export default class Xapi extends XapiBase {
// ----------------------------------------------------------------- // -----------------------------------------------------------------
async _importVdiContent (vdi, body, format = VDI_FORMAT_VHD) { 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([ await Promise.all([
body.task, body.task,
body.checksumVerified, body.checksumVerified,
this.putResource(body, '/import_raw_vdi/', { this.putResource(body, '/import_raw_vdi/', {
host,
query: { query: {
format, format,
vdi: vdi.$ref, vdi: vdi.$ref,
@ -2000,8 +1987,8 @@ export default class Xapi extends XapiBase {
}), }),
]).catch(error => { ]).catch(error => {
// augment the error with as much relevant info as possible // augment the error with as much relevant info as possible
error.host = host error.pool_master = vdi.$pool.$master
error.SR = sr error.SR = vdi.$SR
error.VDI = vdi error.VDI = vdi
throw error throw error