fix(xo-server/moveVdi): wait deletion before creating new VBD

Fixes #3426
This commit is contained in:
Julien Fontanet
2019-01-22 16:44:41 +01:00
parent 36102e0dff
commit 0a78c2bb94

View File

@@ -1862,15 +1862,13 @@ export default class Xapi extends XapiBase {
const newVdi = await this.barrier(
await this.call('VDI.copy', vdi.$ref, sr.$ref)
)
await asyncMap(vdi.$VBDs, vbd =>
Promise.all([
this.call('VBD.destroy', vbd.$ref),
this.createVbd({
...vbd,
vdi: newVdi,
}),
])
)
await asyncMap(vdi.$VBDs, async vbd => {
await this.call('VBD.destroy', vbd.$ref)
await this.createVbd({
...vbd,
vdi: newVdi,
})
})
await this._deleteVdi(vdi)
}
}