fix(Xapi#_assertHealthyVdiChain): fix for NFS SR prior XS 7.1 (#568)
Fixes vatesfr/xo-web#2207
This commit is contained in:
parent
51e09ecfcc
commit
fd75326bb8
@ -12,6 +12,7 @@ import {
|
|||||||
find,
|
find,
|
||||||
filter,
|
filter,
|
||||||
flatten,
|
flatten,
|
||||||
|
groupBy,
|
||||||
includes,
|
includes,
|
||||||
isEmpty,
|
isEmpty,
|
||||||
omit,
|
omit,
|
||||||
@ -777,26 +778,30 @@ export default class Xapi extends XapiBase {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
_assertHealthyVdiChain (vdi) {
|
_assertHealthyVdiChain (vdi, childrenMap) {
|
||||||
if (vdi == null) {
|
if (vdi == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vdi.managed) {
|
if (!vdi.managed) {
|
||||||
let n = 0
|
if (childrenMap === undefined) {
|
||||||
const { uuid } = vdi
|
childrenMap = groupBy(vdi.$SR.$VDIs, _ => _.sm_config['vhd-parent'])
|
||||||
forEach(vdi.$SR.$VDIs, vdi => {
|
}
|
||||||
if (vdi.sm_config['vhd-parent'] === uuid && ++n > 1) {
|
|
||||||
return false // no need to continue, more than 1 child
|
// an unmanaged VDI should not have exactly one child: they
|
||||||
}
|
// should coalesce
|
||||||
})
|
const children = childrenMap[vdi.uuid]
|
||||||
if (n === 1) {
|
if (
|
||||||
|
children.length === 1 &&
|
||||||
|
!children[0].managed // some SRs do not coalesce the leaf
|
||||||
|
) {
|
||||||
throw new Error('unhealthy VDI chain')
|
throw new Error('unhealthy VDI chain')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._assertHealthyVdiChain(
|
this._assertHealthyVdiChain(
|
||||||
this.getObjectByUuid(vdi.sm_config['vhd-parent'], null)
|
this.getObjectByUuid(vdi.sm_config['vhd-parent'], null),
|
||||||
|
childrenMap
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user