Skip to content

Commit

Permalink
fix(xo-server/createVm): fix OTHER_OPERATION_IN_PROGRESS (#8399)
Browse files Browse the repository at this point in the history
Introduced by 04dd9e9
  • Loading branch information
MathieuRA authored Mar 7, 2025
1 parent 5a501d9 commit f310575
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

> Users must be able to say: “I had this issue, happy to know it's fixed”
- [VM/New] Fix _OTHER_OPERATION_IN_PROGRESS_ when creating a VM that requires a VDI migration (PR [#8399](https://github.com/vatesfr/xen-orchestra/pull/8399))
- [REST API] Fix _Internal Error_ when importing a VM without default SR on the pool (PR [#8409](https://github.com/vatesfr/xen-orchestra/pull/8409))
- [REST API] Fix the SR ID ignored when importing a VM (PR [#8409](https://github.com/vatesfr/xen-orchestra/pull/8409))

Expand Down
21 changes: 13 additions & 8 deletions packages/xo-server/src/xapi/mixins/vm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ const methods = {
}

// TODO: set vm.suspend_SR
await Promise.all([
// Creates the user defined VDIs.
..._vdisToCreate.map(async (vdi, i) => {
// Creates the user defined VDIs.
await Promise.all(
_vdisToCreate.map(async (vdi, i) => {
const vdiRef = await this.VDI_create({
name_description: vdi.name_description,
name_label: vdi.name_label,
Expand All @@ -232,9 +232,14 @@ const methods = {
VDI: vdiRef,
VM: vm.$ref,
})
}),
// Modify existing (previous template) disks if necessary
..._vdisToUpdate.map(async ({ $ref, sr, size, userdevice, ...properties }) => {
})
)

// Modify existing (previous template) disks if necessary
// Wait until all VDIs are created, otherwise VBD_create may throw an OTHER_OPERATION_IN_PROGRESS error
// in case a VDI is migrating
await Promise.all(
_vdisToUpdate.map(async ({ $ref, sr, size, userdevice, ...properties }) => {
await this._setObjectProperties({ $ref, $type: 'VDI' }, properties)

let _vdi = this.getObject($ref)
Expand All @@ -252,8 +257,8 @@ const methods = {
}
await this.resizeVdi(_vdi.$id, size)
}
}),
])
})
)
}

if (destroyAllVifs) {
Expand Down

0 comments on commit f310575

Please sign in to comment.