Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(xo-server/createVm): fix OTHER_OPERATION_IN_PROGRESS #8399

Merged
merged 3 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

> 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))

### 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
Loading