fix(xo-server/deleteVm): build disks list before deleting VM (#3465)

Otherwise there is a race condition and VBD records might have been removed from cache before listing the VM disks due to destroying the VM.
This commit is contained in:
Julien Fontanet 2018-09-28 16:48:21 +02:00 committed by Pierre Donias
parent 3f1fb7092b
commit ac5741a341
2 changed files with 10 additions and 6 deletions

View File

@ -6,11 +6,12 @@
### Bug fixes
[OVA Import] Allow import of files bigger than 127GB (PR [#3451](https://github.com/vatesfr/xen-orchestra/pull/3451))
[File restore] Fix a path issue when going back to the parent folder (PR [#3446](https://github.com/vatesfr/xen-orchestra/pull/3446))
[File restore] Fix a minor issue when showing which selected files are redundant (PR [#3447](https://github.com/vatesfr/xen-orchestra/pull/3447))
[Memory] Fix a major leak [#2580](https://github.com/vatesfr/xen-orchestra/issues/2580) [#2820](https://github.com/vatesfr/xen-orchestra/issues/2820) (PR [#3453](https://github.com/vatesfr/xen-orchestra/pull/3453))
[NFS Remotes] Fix `already mounted` race condition [#3380](https://github.com/vatesfr/xen-orchestra/issues/3380) (PR [#3460](https://github.com/vatesfr/xen-orchestra/pull/3460))
- [OVA Import] Allow import of files bigger than 127GB (PR [#3451](https://github.com/vatesfr/xen-orchestra/pull/3451))
- [File restore] Fix a path issue when going back to the parent folder (PR [#3446](https://github.com/vatesfr/xen-orchestra/pull/3446))
- [File restore] Fix a minor issue when showing which selected files are redundant (PR [#3447](https://github.com/vatesfr/xen-orchestra/pull/3447))
- [Memory] Fix a major leak [#2580](https://github.com/vatesfr/xen-orchestra/issues/2580) [#2820](https://github.com/vatesfr/xen-orchestra/issues/2820) (PR [#3453](https://github.com/vatesfr/xen-orchestra/pull/3453))
- [NFS Remotes] Fix `already mounted` race condition [#3380](https://github.com/vatesfr/xen-orchestra/issues/3380) (PR [#3460](https://github.com/vatesfr/xen-orchestra/pull/3460))
- Fix `Cannot read property 'type' of undefined` when deleting a VM (PR [#3465](https://github.com/vatesfr/xen-orchestra/pull/3465))
### Released packages

View File

@ -674,6 +674,9 @@ export default class Xapi extends XapiBase {
})
}
// must be done before destroying the VM
const disks = getVmDisks(vm)
// this cannot be done in parallel, otherwise disks and snapshots will be
// destroyed even if this fails
await this.call('VM.destroy', $ref)
@ -684,7 +687,7 @@ export default class Xapi extends XapiBase {
)::ignoreErrors(),
deleteDisks &&
asyncMap(getVmDisks(vm), ({ $ref: vdiRef }) => {
asyncMap(disks, ({ $ref: vdiRef }) => {
let onFailure = () => {
onFailure = vdi => {
console.error(