Skip to content

Commit

Permalink
feat(backups/CBT): retry data_destroy when error is VDI_IN USE (#7960)
Browse files Browse the repository at this point in the history
Fixes #7826

Sometimes XAPI takes too long to detach the VDI,
in this case, the timeout is fixed at 4s, non modifiable
when the timeout is reached the xapi raise a VDI_IN_USE error

This commit adds a retry on XO side to give more room for XAPI
to work through this process, as XO already does it on VDI destroy
  • Loading branch information
fbeauchamp committed Sep 10, 2024
1 parent fc67abd commit 9504132
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
for (const vdiRef of vdiRefs) {
try {
// data_destroy will fail with a VDI_NO_CBT_METADATA error if CBT is not enabled on this VDI
await this._xapi.call('VDI.data_destroy', vdiRef)
await this._xapi.VDI_dataDestroy(vdiRef)
Task.info(`Snapshot data has been deleted`, { vdiRef })
} catch (error) {
Task.warning(`Couldn't deleted snapshot data`, { error, vdiRef })
Expand Down
11 changes: 11 additions & 0 deletions @xen-orchestra/xapi/vdi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class Vdi {
)
}

async dataDestroy(vdiRef) {
await this.callAsync('VDI.data_destroy', vdiRef)
}

async create(
{
name_description,
Expand Down Expand Up @@ -290,5 +294,12 @@ decorateClass(Vdi, {
return this._vdiDestroyRetryWhenInUse
},
],
// same condition when destroying data of a VDI
dataDestroy: [
pRetry.wrap,
function () {
return this._vdiDestroyRetryWhenInUse
},
],
exportContent: defer,
})
4 changes: 4 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

> Users must be able to say: “I had this issue, happy to know it's fixed”
- [Incremental Backup & Replication] Remove most of `Couldn't delete snapshot data` errors when using _Purge snapshot data when using CBT_ [#7826](https://github.com/vatesfr/xen-orchestra/pull/7826) (PR [#7960](https://github.com/vatesfr/xen-orchestra/pull/7960))

### Packages to release

> When modifying a package, add it here with its release type.
Expand All @@ -41,9 +43,11 @@
<!--packages-start-->

- @xen-orchestra/backups patch
- @xen-orchestra/lite minor
- @xen-orchestra/web minor
- @xen-orchestra/web-core minor
- @xen-orchestra/xapi minor
- xo-server minor
- xo-server-perf-alert minor
- xo-server-sdn-controller patch
Expand Down

0 comments on commit 9504132

Please sign in to comment.