Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(xo-web/dashboard/health): show pools with no default SR #6083

Merged
merged 7 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
1 change: 1 addition & 0 deletions packages/xo-web/src/common/intl/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
60 changes: 56 additions & 4 deletions packages/xo-web/src/xo-app/dashboard/health/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ const LOCAL_DEFAULT_SRS_COLUMNS = [
},
]

const POOLS_WITHOUT_DEFAULT_SR_COLUMNS = [
{
name: _('pool'),
itemRenderer: pool => <Pool id={pool.id} link />,
sortCriteria: 'name_label',
},
]

const SR_COLUMNS = [
{
name: _('srName'),
Expand Down Expand Up @@ -607,19 +615,33 @@ export default class Health extends Component {
_getLocalDefaultSrs = createCollectionWrapper(
createSelector(
() => this.props.hosts,
() => this.props.pools,
() => this._getPools(),
pdonias marked this conversation as resolved.
Show resolved Hide resolved
() => 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
})
}
)
)

_getPools = createCollectionWrapper(
pdonias marked this conversation as resolved.
Show resolved Hide resolved
createSelector(
() => this.props.pools,
() => this._getPoolIds(),
pdonias marked this conversation as resolved.
Show resolved Hide resolved
(pools, poolIds) => (isEmpty(poolIds) ? pools : pick(pools, poolIds))
)
)
julien-f marked this conversation as resolved.
Show resolved Hide resolved

_getPoolsWithNoDefaultSr = createCollectionWrapper(
createSelector(
() => this._getPools(),
pdonias marked this conversation as resolved.
Show resolved Hide resolved
pools => filter(pools, ({ default_SR }) => default_SR === undefined)
)
)

_getPoolIds = createCollectionWrapper(createSelector(() => this.state.pools, resolveIds))

_getPoolPredicate = createSelector(this._getPoolIds, poolIds =>
Expand Down Expand Up @@ -654,6 +676,7 @@ export default class Health extends Component {
const localDefaultSrs = this._getLocalDefaultSrs()
const userSrs = this._getUserSrs()
const orphanVdis = this._getOrphanVdis()
const poolsWithNoDefaultSr = this._getPoolsWithNoDefaultSr()

return (
<Container>
Expand Down Expand Up @@ -721,6 +744,35 @@ export default class Health extends Component {
</Col>
</Row>
)}
{poolsWithNoDefaultSr.length > 0 && (
<Row>
<Col>
<Card>
<CardHeader>
<Icon icon='pool' /> {_('poolsWithNoDefaultSr')}
</CardHeader>
<CardBlock>
<NoObjects collection={props.areObjectsFetched ? poolsWithNoDefaultSr : null}>
{() => (
<Row>
<Col>
<SortedTable
collection={poolsWithNoDefaultSr}
columns={POOLS_WITHOUT_DEFAULT_SR_COLUMNS}
data-hosts={props.hosts}
data-srs={userSrs}
shortcutsTarget='body'
pdonias marked this conversation as resolved.
Show resolved Hide resolved
stateUrlParam='s_no_default_sr'
/>
</Col>
</Row>
)}
</NoObjects>
</CardBlock>
</Card>
</Col>
</Row>
)}
<Row>
<Col>
<Card>
Expand Down