feat(xo-server/Xapi#_assertHealthyVdiChains): configurable tolerance (#4651)
Fixes #4124 Related to xoa-support#1921 Only configurable globally (not per backup job) for the moment with the `xapiOptions.maxUncoalescedVdis` setting.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
> Users must be able to say: “Nice enhancement, I'm eager to test it”
|
||||
|
||||
- [Logs] Ability to report a bug with attached log (PR [#4201](https://github.com/vatesfr/xen-orchestra/pull/4201))
|
||||
- [Backup] Reduce _VDI chain protection error_ occurrence by being more tolerant (configurable via `xo-server`'s `xapiOptions.maxUncoalescedVdis` setting) [#4124](https://github.com/vatesfr/xen-orchestra/issues/4124) (PR [#4651](https://github.com/vatesfr/xen-orchestra/pull/4651))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
||||
@@ -94,3 +94,6 @@ timeout = 600e3
|
||||
|
||||
# see https:#github.com/vatesfr/xen-orchestra/issues/3419
|
||||
# useSudo = false
|
||||
|
||||
[xapiOptions]
|
||||
maxUncoalescedVdis = 1
|
||||
|
||||
@@ -94,10 +94,11 @@ export const IPV6_CONFIG_MODES = ['None', 'DHCP', 'Static', 'Autoconf']
|
||||
|
||||
@mixin(mapToArray(mixins))
|
||||
export default class Xapi extends XapiBase {
|
||||
constructor({ guessVhdSizeOnImport, ...opts }) {
|
||||
constructor({ guessVhdSizeOnImport, maxUncoalescedVdis, ...opts }) {
|
||||
super(opts)
|
||||
|
||||
this._guessVhdSizeOnImport = guessVhdSizeOnImport
|
||||
this._maxUncoalescedVdis = maxUncoalescedVdis
|
||||
|
||||
// Patch getObject to resolve _xapiId property.
|
||||
this.getObject = (getObject => (...args) => {
|
||||
@@ -724,7 +725,7 @@ export default class Xapi extends XapiBase {
|
||||
return promise
|
||||
}
|
||||
|
||||
_assertHealthyVdiChain(vdi, cache) {
|
||||
_assertHealthyVdiChain(vdi, cache, tolerance) {
|
||||
if (vdi == null) {
|
||||
return
|
||||
}
|
||||
@@ -754,7 +755,8 @@ export default class Xapi extends XapiBase {
|
||||
const children = childrenMap[vdi.uuid]
|
||||
if (
|
||||
children.length === 1 &&
|
||||
!children[0].managed // some SRs do not coalesce the leaf
|
||||
!children[0].managed && // some SRs do not coalesce the leaf
|
||||
tolerance-- <= 0
|
||||
) {
|
||||
throw new Error('unhealthy VDI chain')
|
||||
}
|
||||
@@ -762,15 +764,16 @@ export default class Xapi extends XapiBase {
|
||||
|
||||
this._assertHealthyVdiChain(
|
||||
this.getObjectByUuid(vdi.sm_config['vhd-parent'], null),
|
||||
cache
|
||||
cache,
|
||||
tolerance
|
||||
)
|
||||
}
|
||||
|
||||
_assertHealthyVdiChains(vm) {
|
||||
_assertHealthyVdiChains(vm, tolerance = this._maxUncoalescedVdis) {
|
||||
const cache = { __proto__: null }
|
||||
forEach(vm.$VBDs, ({ $VDI }) => {
|
||||
try {
|
||||
this._assertHealthyVdiChain($VDI, cache)
|
||||
this._assertHealthyVdiChain($VDI, cache, tolerance)
|
||||
} catch (error) {
|
||||
error.VDI = $VDI
|
||||
error.VM = vm
|
||||
|
||||
Reference in New Issue
Block a user