From ad8cd3791b9459b06d754defa657c97b66261eb3 Mon Sep 17 00:00:00 2001 From: Florent BEAUCHAMP Date: Mon, 30 Sep 2024 09:04:33 +0200 Subject: [PATCH] fix(xo-server): migration of vm with cbt enabled disk (#8017) --- CHANGELOG.unreleased.md | 2 ++ packages/xo-server/src/xapi/index.mjs | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) 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)