From 5c9fffa9d9bbe4ff57726634ae8f6d4196a5ebd6 Mon Sep 17 00:00:00 2001 From: Florent Beauchamp Date: Tue, 3 Sep 2024 16:14:11 +0000 Subject: [PATCH 1/4] feat(backups/CBT): retry data_destroy when error is VDI_IN USE 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 --- .../backups/_runners/_vmRunners/_AbstractXapi.mjs | 2 +- @xen-orchestra/xapi/vdi.mjs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/@xen-orchestra/backups/_runners/_vmRunners/_AbstractXapi.mjs b/@xen-orchestra/backups/_runners/_vmRunners/_AbstractXapi.mjs index 8151cd251ce..a7dcc6340a0 100644 --- a/@xen-orchestra/backups/_runners/_vmRunners/_AbstractXapi.mjs +++ b/@xen-orchestra/backups/_runners/_vmRunners/_AbstractXapi.mjs @@ -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 }) diff --git a/@xen-orchestra/xapi/vdi.mjs b/@xen-orchestra/xapi/vdi.mjs index c32191cda9a..37e816e11de 100644 --- a/@xen-orchestra/xapi/vdi.mjs +++ b/@xen-orchestra/xapi/vdi.mjs @@ -27,6 +27,9 @@ class Vdi { noop ) } + async dataDestroy(vdiRef) { + return await this.callAsync('VDI.data_destroy', vdiRef) + } async create( { @@ -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, }) From 9c8756adbeae95e862894c3998fa5904c2fd9ef9 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Tue, 10 Sep 2024 11:32:46 +0200 Subject: [PATCH 2/4] Update @xen-orchestra/xapi/vdi.mjs --- @xen-orchestra/xapi/vdi.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/@xen-orchestra/xapi/vdi.mjs b/@xen-orchestra/xapi/vdi.mjs index 37e816e11de..67b682c0b03 100644 --- a/@xen-orchestra/xapi/vdi.mjs +++ b/@xen-orchestra/xapi/vdi.mjs @@ -27,6 +27,7 @@ class Vdi { noop ) } + async dataDestroy(vdiRef) { return await this.callAsync('VDI.data_destroy', vdiRef) } From e72db7d7037334a0df0d806227baa7014cc0ec49 Mon Sep 17 00:00:00 2001 From: Florent BEAUCHAMP Date: Tue, 10 Sep 2024 11:41:38 +0200 Subject: [PATCH 3/4] Update @xen-orchestra/xapi/vdi.mjs Co-authored-by: Julien Fontanet --- @xen-orchestra/xapi/vdi.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/@xen-orchestra/xapi/vdi.mjs b/@xen-orchestra/xapi/vdi.mjs index 67b682c0b03..c65b9f39985 100644 --- a/@xen-orchestra/xapi/vdi.mjs +++ b/@xen-orchestra/xapi/vdi.mjs @@ -29,7 +29,7 @@ class Vdi { } async dataDestroy(vdiRef) { - return await this.callAsync('VDI.data_destroy', vdiRef) + await this.callAsync('VDI.data_destroy', vdiRef) } async create( From 67a9dfad3aca6b19018cc85494e61ad2f1812c0f Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Tue, 10 Sep 2024 12:15:21 +0200 Subject: [PATCH 4/4] changelog --- CHANGELOG.unreleased.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index b05bcc316ba..77f2951d05f 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -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. @@ -41,9 +43,11 @@ +- @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