fix(xo-server,xo-web): fix total number of VDIs to coalesce (#7098)
Fixes #7016 Summing all chains does take not common chains into account, the total must be computed on the server side.
This commit is contained in:
parent
00a1778a6d
commit
a3b8553cec
@ -19,6 +19,7 @@
|
|||||||
- [RPU] Fix "XenServer credentials not found" when running a Rolling Pool Update on a XenServer pool (PR [#7089](https://github.com/vatesfr/xen-orchestra/pull/7089))
|
- [RPU] Fix "XenServer credentials not found" when running a Rolling Pool Update on a XenServer pool (PR [#7089](https://github.com/vatesfr/xen-orchestra/pull/7089))
|
||||||
- [Usage report] Fix "Converting circular structure to JSON" error
|
- [Usage report] Fix "Converting circular structure to JSON" error
|
||||||
- [Home] Fix OS icons alignment (PR [#7090](https://github.com/vatesfr/xen-orchestra/pull/7090))
|
- [Home] Fix OS icons alignment (PR [#7090](https://github.com/vatesfr/xen-orchestra/pull/7090))
|
||||||
|
- [SR/Advanced] Fix the total number of VDIs to coalesce by taking into account common chains [#7016](https://github.com/vatesfr/xen-orchestra/issues/7016) (PR [#7098](https://github.com/vatesfr/xen-orchestra/pull/7098))
|
||||||
|
|
||||||
### Packages to release
|
### Packages to release
|
||||||
|
|
||||||
|
@ -49,18 +49,19 @@ export default {
|
|||||||
await this._unplugPbd(this.getObject(id))
|
await this._unplugPbd(this.getObject(id))
|
||||||
},
|
},
|
||||||
|
|
||||||
_getVdiChainsInfo(uuid, childrenMap, cache) {
|
_getVdiChainsInfo(uuid, childrenMap, cache, resultContainer) {
|
||||||
let info = cache[uuid]
|
let info = cache[uuid]
|
||||||
if (info === undefined) {
|
if (info === undefined) {
|
||||||
const children = childrenMap[uuid]
|
const children = childrenMap[uuid]
|
||||||
const unhealthyLength = children !== undefined && children.length === 1 ? 1 : 0
|
const unhealthyLength = children !== undefined && children.length === 1 ? 1 : 0
|
||||||
|
resultContainer.nUnhealthyVdis += unhealthyLength
|
||||||
const vdi = this.getObjectByUuid(uuid, undefined)
|
const vdi = this.getObjectByUuid(uuid, undefined)
|
||||||
if (vdi === undefined) {
|
if (vdi === undefined) {
|
||||||
info = { unhealthyLength, missingParent: uuid }
|
info = { unhealthyLength, missingParent: uuid }
|
||||||
} else {
|
} else {
|
||||||
const parent = vdi.sm_config['vhd-parent']
|
const parent = vdi.sm_config['vhd-parent']
|
||||||
if (parent !== undefined) {
|
if (parent !== undefined) {
|
||||||
info = this._getVdiChainsInfo(parent, childrenMap, cache)
|
info = this._getVdiChainsInfo(parent, childrenMap, cache, resultContainer)
|
||||||
info.unhealthyLength += unhealthyLength
|
info.unhealthyLength += unhealthyLength
|
||||||
} else {
|
} else {
|
||||||
info = { unhealthyLength }
|
info = { unhealthyLength }
|
||||||
@ -76,12 +77,13 @@ export default {
|
|||||||
const unhealthyVdis = { __proto__: null }
|
const unhealthyVdis = { __proto__: null }
|
||||||
const children = groupBy(vdis, 'sm_config.vhd-parent')
|
const children = groupBy(vdis, 'sm_config.vhd-parent')
|
||||||
const vdisWithUnknownVhdParent = { __proto__: null }
|
const vdisWithUnknownVhdParent = { __proto__: null }
|
||||||
|
const resultContainer = { nUnhealthyVdis: 0 }
|
||||||
|
|
||||||
const cache = { __proto__: null }
|
const cache = { __proto__: null }
|
||||||
forEach(vdis, vdi => {
|
forEach(vdis, vdi => {
|
||||||
if (vdi.managed && !vdi.is_a_snapshot) {
|
if (vdi.managed && !vdi.is_a_snapshot) {
|
||||||
const { uuid } = vdi
|
const { uuid } = vdi
|
||||||
const { unhealthyLength, missingParent } = this._getVdiChainsInfo(uuid, children, cache)
|
const { unhealthyLength, missingParent } = this._getVdiChainsInfo(uuid, children, cache, resultContainer)
|
||||||
|
|
||||||
if (unhealthyLength !== 0) {
|
if (unhealthyLength !== 0) {
|
||||||
unhealthyVdis[uuid] = unhealthyLength
|
unhealthyVdis[uuid] = unhealthyLength
|
||||||
@ -95,6 +97,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
vdisWithUnknownVhdParent,
|
vdisWithUnknownVhdParent,
|
||||||
unhealthyVdis,
|
unhealthyVdis,
|
||||||
|
...resultContainer,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import { CustomFields } from 'custom-fields'
|
|||||||
import { createGetObjectsOfType } from 'selectors'
|
import { createGetObjectsOfType } from 'selectors'
|
||||||
import { createSelector } from 'reselect'
|
import { createSelector } from 'reselect'
|
||||||
import { createSrUnhealthyVdiChainsLengthSubscription, deleteSr, reclaimSrSpace, toggleSrMaintenanceMode } from 'xo'
|
import { createSrUnhealthyVdiChainsLengthSubscription, deleteSr, reclaimSrSpace, toggleSrMaintenanceMode } from 'xo'
|
||||||
import { flowRight, isEmpty, keys, sum, values } from 'lodash'
|
import { flowRight, isEmpty, keys } from 'lodash'
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
@ -44,11 +44,11 @@ const UnhealthyVdiChains = flowRight(
|
|||||||
connectStore(() => ({
|
connectStore(() => ({
|
||||||
vdis: createGetObjectsOfType('VDI').pick(createSelector((_, props) => props.chains?.unhealthyVdis, keys)),
|
vdis: createGetObjectsOfType('VDI').pick(createSelector((_, props) => props.chains?.unhealthyVdis, keys)),
|
||||||
}))
|
}))
|
||||||
)(({ chains: { unhealthyVdis } = {}, vdis }) =>
|
)(({ chains: { nUnhealthyVdis, unhealthyVdis } = {}, vdis }) =>
|
||||||
isEmpty(vdis) ? null : (
|
isEmpty(vdis) ? null : (
|
||||||
<div>
|
<div>
|
||||||
<hr />
|
<hr />
|
||||||
<h3>{_('srUnhealthyVdiTitle', { total: sum(values(unhealthyVdis)) })}</h3>
|
<h3>{_('srUnhealthyVdiTitle', { total: nUnhealthyVdis })}</h3>
|
||||||
<SortedTable collection={vdis} columns={COLUMNS} stateUrlParam='s_unhealthy_vdis' userData={unhealthyVdis} />
|
<SortedTable collection={vdis} columns={COLUMNS} stateUrlParam='s_unhealthy_vdis' userData={unhealthyVdis} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user