Skip to content

Commit

Permalink
fix(xo-server): migration of vm with cbt enabled disk (#8017)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeauchamp authored Sep 30, 2024
1 parent 030b3ad commit ad8cd37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions packages/xo-server/src/xapi/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ad8cd37

Please sign in to comment.