Skip to content

Commit

Permalink
fix(xapi): VDI_destroyCloudInitConfig wait 5 minutes before removing …
Browse files Browse the repository at this point in the history
…the VDI (#8247)
  • Loading branch information
MathieuRA authored Jan 23, 2025
1 parent 9af5818 commit 3e615f7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions @xen-orchestra/xapi/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import assert from 'assert'
import pRetry from 'promise-toolbox/retry'
import { parseDuration } from '@vates/parse-duration'
import { utcFormat, utcParse } from 'd3-time-format'
import { Xapi as Base } from 'xen-api'
import { createLogger } from '@xen-orchestra/log'
Expand Down Expand Up @@ -151,6 +152,7 @@ export class Xapi extends Base {
syncHookSecret,
syncHookTimeout,
vdiDestroyRetryWhenInUse = { delay: 5e3, tries: 10 },
vdiDelayBeforeRemovingCloudConfigDrive = '5 min',
...opts
}) {
super(opts)
Expand All @@ -169,6 +171,7 @@ export class Xapi extends Base {
onRetry: disconnectBeforeRetry,
when: { code: 'VDI_IN_USE' },
}
this._vdiDelayBeforeRemovingCloudConfigDrive = parseDuration(vdiDelayBeforeRemovingCloudConfigDrive)

const genericWatchers = (this._genericWatchers = new Set())
const objectWatchers = (this._objectWatchers = { __proto__: null })
Expand Down
1 change: 1 addition & 0 deletions @xen-orchestra/xapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@vates/async-each": "^1.0.0",
"@vates/decorate-with": "^2.1.0",
"@vates/nbd-client": "^3.1.2",
"@vates/parse-duration": "^0.1.1",
"@vates/read-chunk": "^1.2.0",
"@vates/task": "^0.6.0",
"@xen-orchestra/async-map": "^0.1.2",
Expand Down
3 changes: 3 additions & 0 deletions @xen-orchestra/xapi/vdi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class Vdi {
})
})

// See https://github.com/vatesfr/xen-orchestra/issues/8219
await new Promise(resolve => setTimeout(resolve, this._vdiDelayBeforeRemovingCloudConfigDrive))

await this.VBD_unplug(vbdRef)
await this.VDI_destroy(vdiRef)
}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- [Backups/Logs] Display mirror backup transfer size (PR [#8224](https://github.com/vatesfr/xen-orchestra/pull/8224))
- [Settings/Remotes] Only allow using encryption when using data block storage to prevent errors during backups (PR [#8244](https://github.com/vatesfr/xen-orchestra/pull/8244))
- Fix _Rolling Pool Update_ and _Install Patches_ for XenServer >= 8.4 [Forum#9550](https://xcp-ng.org/forum/topic/9550/xenserver-8-patching/27?_=1736774010376) (PR [#8241](https://github.com/vatesfr/xen-orchestra/pull/8241))
- [New/VM] Fix premature destruction of the cloudConfig VDI when using the option _destroyCloudConfigVdiAfterBoot_ [#8219](https://github.com/vatesfr/xen-orchestra/issues/8219) (PR [#8247](https://github.com/vatesfr/xen-orchestra/pull/8247))

### Packages to release

Expand Down
1 change: 1 addition & 0 deletions packages/xo-server/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ vdiExportConcurrency = 12
vmEvacuationConcurrency = 3
vmExportConcurrency = 2
vmSnapshotConcurrency = 2
vdiDelayBeforeRemovingCloudConfigDrive = '5 min'

poolMarkingInterval = '6 hours'
poolMarkingMaxAge = '48 hours'
Expand Down

0 comments on commit 3e615f7

Please sign in to comment.