fix(xo-server/{export,import}Vdi): dont pass host (#3355)
Relies on redirection handling in `xen-api`. Fixes #3354
This commit is contained in:
parent
ce35bbaeb4
commit
b09da76b04
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user