Skip to content

Commit

Permalink
feat(backups/CBT): retry data_destroy when error is VDI_IN USE
Browse files Browse the repository at this point in the history
sometimes the capi take 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 is an internal process of the xapi

This commit add a retry on XO side to give more room for the xapi
to work through this process, as XO already do it one vdi destroying

fix #7826
  • Loading branch information
fbeauchamp authored and julien-f committed Sep 10, 2024
1 parent af17f4a commit a7b44a7
Show file tree
Hide file tree
Showing 2 changed files with 11 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
10 changes: 10 additions & 0 deletions @xen-orchestra/xapi/vdi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class Vdi {
noop
)
}
async dataDestroy(vdiRef) {
return await this.callAsync('VDI.data_destroy', vdiRef)
}

async create(
{
Expand Down Expand Up @@ -290,5 +293,12 @@ decorateClass(Vdi, {
return this._vdiDestroyRetryWhenInUse
},
],
// same condition when destroying data of a VDI
dataDestroy: [
pRetry.wrap,
function () {
return this._vdiDestroyRetryWhenInUse
},
],
exportContent: defer,
})

0 comments on commit a7b44a7

Please sign in to comment.