diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index ae93cb47eb6..c08bd94d95f 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -15,6 +15,8 @@ > Users must be able to say: “I had this issue, happy to know it's fixed” +- [Migration/CBT] Fix an infinite loop when migrating a VM with CBT enabled (PR [#8017](https://github.com/vatesfr/xen-orchestra/pull/8017)) + ### Packages to release > When modifying a package, add it here with its release type. diff --git a/packages/xo-server/src/xapi/index.mjs b/packages/xo-server/src/xapi/index.mjs index b3d1beff03f..69e145b6a5d 100644 --- a/packages/xo-server/src/xapi/index.mjs +++ b/packages/xo-server/src/xapi/index.mjs @@ -614,16 +614,16 @@ export default class Xapi extends XapiBase { } } } - const loop = async () => { + const loop = async (_failOnCbtError = false) => { try { await this.callAsync('VM.migrate_send', ...params) } catch (err) { - if (err.code === 'VDI_CBT_ENABLED') { + if (err.code === 'VDI_CBT_ENABLED' && !_failOnCbtError) { // as of 20240619, CBT must be disabled on all disks to allow migration to go through // it will be re enabled if needed by backups // the next backup after a storage migration will be a full backup await this.VM_disableChangedBlockTracking(vm.$ref) - return loop() + return loop(true) } if (err.code === 'TOO_MANY_STORAGE_MIGRATES') { await pDelay(1e4)