From 37fc360c503918dcb4842fc16e896f1103bc1960 Mon Sep 17 00:00:00 2001 From: mathieuRA Date: Fri, 7 Jan 2022 14:34:09 +0100 Subject: [PATCH 1/6] feat(Dashboard/Health): show pools with no default SR --- packages/xo-web/src/common/intl/messages.js | 1 + .../src/xo-app/dashboard/health/index.js | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/packages/xo-web/src/common/intl/messages.js b/packages/xo-web/src/common/intl/messages.js index 9234b1bd881..5884fce30cb 100644 --- a/packages/xo-web/src/common/intl/messages.js +++ b/packages/xo-web/src/common/intl/messages.js @@ -1396,6 +1396,7 @@ const messages = { orphanVdisTip: 'VDIs and VDI snapshots that are not attached to a VM', orphanedVms: 'Orphaned VMs snapshot', noOrphanedObject: 'No orphans', + poolsWithNoDefaultSr: 'Pools with no default SR', tooManySnapshots: 'Too many snapshots', tooManySnapshotsTip: 'VMs with more than the recommended amount of snapshots', noLocalDefaultSrs: 'No local default SRs', diff --git a/packages/xo-web/src/xo-app/dashboard/health/index.js b/packages/xo-web/src/xo-app/dashboard/health/index.js index 45ea5a318da..b1f6c177171 100644 --- a/packages/xo-web/src/xo-app/dashboard/health/index.js +++ b/packages/xo-web/src/xo-app/dashboard/health/index.js @@ -122,6 +122,14 @@ const LOCAL_DEFAULT_SRS_COLUMNS = [ }, ] +const POOLS_WITHOUT_DEFAULT_SR_COLUMNS = [ + { + name: _('pool'), + itemRenderer: pool => , + sortCriteria: 'name_label', + }, +] + const SR_COLUMNS = [ { name: _('srName'), @@ -620,6 +628,15 @@ export default class Health extends Component { ) ) + _getPoolsWithNoDefaultSr = createCollectionWrapper( + createSelector( + () => this.props.pools, + () => this._getPoolIds(), + (pools, poolIds) => + filter(isEmpty(poolIds) ? pools : pick(pools, poolIds), ({ default_SR }) => default_SR === undefined) + ) + ) + _getPoolIds = createCollectionWrapper(createSelector(() => this.state.pools, resolveIds)) _getPoolPredicate = createSelector(this._getPoolIds, poolIds => @@ -654,6 +671,7 @@ export default class Health extends Component { const localDefaultSrs = this._getLocalDefaultSrs() const userSrs = this._getUserSrs() const orphanVdis = this._getOrphanVdis() + const poolsWithNoDefaultSr = this._getPoolsWithNoDefaultSr() return ( @@ -721,6 +739,35 @@ export default class Health extends Component { )} + {poolsWithNoDefaultSr.length > 0 && ( + + + + + {_('poolsWithNoDefaultSr')} + + + + {() => ( + + + + + + )} + + + + + + )} From 2f875476c9503381fcbb80009f6ee74a40c7e4f7 Mon Sep 17 00:00:00 2001 From: mathieuRA Date: Fri, 7 Jan 2022 14:58:43 +0100 Subject: [PATCH 2/6] create selector for pools --- packages/xo-web/src/xo-app/dashboard/health/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/xo-web/src/xo-app/dashboard/health/index.js b/packages/xo-web/src/xo-app/dashboard/health/index.js index b1f6c177171..76f14b12bc2 100644 --- a/packages/xo-web/src/xo-app/dashboard/health/index.js +++ b/packages/xo-web/src/xo-app/dashboard/health/index.js @@ -628,12 +628,18 @@ export default class Health extends Component { ) ) - _getPoolsWithNoDefaultSr = createCollectionWrapper( + _getPools = createCollectionWrapper( createSelector( () => this.props.pools, () => this._getPoolIds(), - (pools, poolIds) => - filter(isEmpty(poolIds) ? pools : pick(pools, poolIds), ({ default_SR }) => default_SR === undefined) + (pools, poolIds) => (isEmpty(poolIds) ? pools : pick(pools, poolIds)) + ) + ) + + _getPoolsWithNoDefaultSr = createCollectionWrapper( + createSelector( + () => this._getPools(), + pools => filter(pools, ({ default_SR }) => default_SR === undefined) ) ) From 488f7667efb2bff7578905d510ae37bbd67992dc Mon Sep 17 00:00:00 2001 From: mathieuRA Date: Fri, 7 Jan 2022 15:01:29 +0100 Subject: [PATCH 3/6] CHANGELOG --- CHANGELOG.unreleased.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index b5bcaaf4fe9..0d41f30994a 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -9,6 +9,7 @@ - Limit number of concurrent VM migrations per pool to `3` [#6065](https://github.com/vatesfr/xen-orchestra/issues/6065) (PR [#6076](https://github.com/vatesfr/xen-orchestra/pull/6076)) Can be changed in `xo-server`'s configuration file: `xapiOptions.vmMigrationConcurrency` +- [Health] Display pools with no default SR (PR [#6083](https://github.com/vatesfr/xen-orchestra/pull/6083)) ### Bug fixes @@ -30,3 +31,5 @@ > - major: if the change breaks compatibility > > In case of conflict, the highest (lowest in previous list) `$version` wins. + +- xo-web minor From f10fadb3a59c9e5b5912d4e9cf88426184b993eb Mon Sep 17 00:00:00 2001 From: mathieuRA Date: Fri, 7 Jan 2022 15:15:04 +0100 Subject: [PATCH 4/6] mutualize code --- packages/xo-web/src/xo-app/dashboard/health/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/xo-web/src/xo-app/dashboard/health/index.js b/packages/xo-web/src/xo-app/dashboard/health/index.js index 76f14b12bc2..5f2eb3aabd5 100644 --- a/packages/xo-web/src/xo-app/dashboard/health/index.js +++ b/packages/xo-web/src/xo-app/dashboard/health/index.js @@ -615,12 +615,11 @@ export default class Health extends Component { _getLocalDefaultSrs = createCollectionWrapper( createSelector( () => this.props.hosts, - () => this.props.pools, + () => this._getPools(), () => this.props.userSrs, - () => this._getPoolIds(), - (hosts, pools, userSrs, poolIds) => { + (hosts, pools, userSrs) => { const nbHostsPerPool = countBy(hosts, host => host.$pool) - return filter(isEmpty(poolIds) ? pools : pick(pools, poolIds), pool => { + return filter(pools, pool => { const { default_SR } = pool return default_SR !== undefined && !userSrs[default_SR].shared && nbHostsPerPool[pool.id] > 1 }) From f47e1650af5116a9d0073a268217eb409d4cf578 Mon Sep 17 00:00:00 2001 From: mathieuRA Date: Mon, 24 Jan 2022 14:42:53 +0100 Subject: [PATCH 5/6] reorders code --- .../src/xo-app/dashboard/health/index.js | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/packages/xo-web/src/xo-app/dashboard/health/index.js b/packages/xo-web/src/xo-app/dashboard/health/index.js index 5f2eb3aabd5..8aacc0f2657 100644 --- a/packages/xo-web/src/xo-app/dashboard/health/index.js +++ b/packages/xo-web/src/xo-app/dashboard/health/index.js @@ -612,14 +612,24 @@ export default class Health extends Component { ) ) + _getPoolIds = createCollectionWrapper(createSelector(() => this.state.pools, resolveIds)) + + _getSelectedPools = createCollectionWrapper( + createSelector( + () => this.props.pools, + this._getPoolIds, + (pools, poolIds) => (isEmpty(poolIds) ? pools : pick(pools, poolIds)) + ) + ) + _getLocalDefaultSrs = createCollectionWrapper( createSelector( () => this.props.hosts, - () => this._getPools(), () => this.props.userSrs, - (hosts, pools, userSrs) => { + this._getSelectedPools, + (hosts, userSrs, selectedPools) => { const nbHostsPerPool = countBy(hosts, host => host.$pool) - return filter(pools, pool => { + return filter(selectedPools, pool => { const { default_SR } = pool return default_SR !== undefined && !userSrs[default_SR].shared && nbHostsPerPool[pool.id] > 1 }) @@ -627,23 +637,12 @@ export default class Health extends Component { ) ) - _getPools = createCollectionWrapper( - createSelector( - () => this.props.pools, - () => this._getPoolIds(), - (pools, poolIds) => (isEmpty(poolIds) ? pools : pick(pools, poolIds)) - ) - ) - _getPoolsWithNoDefaultSr = createCollectionWrapper( - createSelector( - () => this._getPools(), - pools => filter(pools, ({ default_SR }) => default_SR === undefined) + createSelector(this._getSelectedPools, selectedPools => + filter(selectedPools, ({ default_SR }) => default_SR === undefined) ) ) - _getPoolIds = createCollectionWrapper(createSelector(() => this.state.pools, resolveIds)) - _getPoolPredicate = createSelector(this._getPoolIds, poolIds => isEmpty(poolIds) ? undefined : item => includes(poolIds, item.$pool) ) From 715211822cff1e6ccb3e9e944b807f0fe1e34b62 Mon Sep 17 00:00:00 2001 From: mathieuRA Date: Tue, 25 Jan 2022 14:31:53 +0100 Subject: [PATCH 6/6] enable shortcuts --- packages/xo-web/src/xo-app/dashboard/health/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/xo-web/src/xo-app/dashboard/health/index.js b/packages/xo-web/src/xo-app/dashboard/health/index.js index 8aacc0f2657..3420bbc7ee8 100644 --- a/packages/xo-web/src/xo-app/dashboard/health/index.js +++ b/packages/xo-web/src/xo-app/dashboard/health/index.js @@ -753,14 +753,14 @@ export default class Health extends Component { {() => ( - +