Skip to content

Commit

Permalink
fix(xo-server/createVm): fix OTHER_OPERATION_IN_PROGRESS
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuRA committed Mar 3, 2025
1 parent 2a2c966 commit ac55baf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
- **XO6**:
- [Pool/Network]: Display networks and host internal networks information in side panel (PR [#8286](https://github.com/vatesfr/xen-orchestra/pull/8286))
- [Changed Block Tracking] Disabling CBT now cleanup the full disk and snapshot chains (PR [#8313](https://github.com/vatesfr/xen-orchestra/pull/8313))
> Users must be able to say: “Nice enhancement, I'm eager to test it”
> Users must be able to say: “Nice enhancement, I'm eager to test it”
### Bug fixes

> 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

### Packages to release

> When modifying a package, add it here with its release type.
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 ac55baf

Please sign in to comment.