diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index e968e473112..6c050ab636e 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -35,6 +35,7 @@ - [File restore] Fix potential race condition in partition mount/unmount (PR [#7312](https://github.com/vatesfr/xen-orchestra/pull/7312)) - [Modal] Fix opened modal not closing when navigating to another route/URL (PR [#7301](https://github.com/vatesfr/xen-orchestra/pull/7301)) - [Backup/Restore] Don't count memory as a key (i.e. complete) disk [Forum#8212](https://xcp-ng.org/forum/post/69591) (PR [#7315](https://github.com/vatesfr/xen-orchestra/pull/7315)) +- [Pool/patches] Disable Rolling Pool Update button if host is alone in its pool [#6415](https://github.com/vatesfr/xen-orchestra/issues/6415) (PR [#7286](https://github.com/vatesfr/xen-orchestra/pull/7286)) ### Packages to release diff --git a/packages/xo-web/src/common/intl/messages.js b/packages/xo-web/src/common/intl/messages.js index 85012742ae5..da6d3ae9c2a 100644 --- a/packages/xo-web/src/common/intl/messages.js +++ b/packages/xo-web/src/common/intl/messages.js @@ -938,6 +938,8 @@ const messages = { noNbdConnection: 'No NBD Connection', nbdConnection: 'NBD Connection', insecureNbdConnection: 'Insecure NBD Connection (not allowed through XO)', + // ----- Pool patches tab ----- + multiHostPoolUpdate: "Rolling pool update can only work when there's multiple hosts in a pool with a shared storage", // ----- Pool stats tab ----- poolNoStats: 'No stats', poolAllHosts: 'All hosts', diff --git a/packages/xo-web/src/xo-app/pool/tab-patches.js b/packages/xo-web/src/xo-app/pool/tab-patches.js index fcec1b767ba..f386d51a430 100644 --- a/packages/xo-web/src/xo-app/pool/tab-patches.js +++ b/packages/xo-web/src/xo-app/pool/tab-patches.js @@ -6,7 +6,7 @@ import Upgrade from 'xoa-upgrade' import { addSubscriptions, connectStore, formatSize } from 'utils' import { alert } from 'modal' import { Col, Container, Row } from 'grid' -import { createGetObjectsOfType } from 'selectors' +import { createGetObjectsOfType, createSelector } from 'selectors' import { FormattedRelative, FormattedTime } from 'react-intl' import { getXoaPlan, ENTERPRISE } from 'xoa-plans' import { @@ -17,6 +17,7 @@ import { subscribeHostMissingPatches, } from 'xo' import isEmpty from 'lodash/isEmpty.js' +import size from 'lodash/size.js' const ROLLING_POOL_UPDATES_AVAILABLE = getXoaPlan().value >= ENTERPRISE.value @@ -166,6 +167,12 @@ const INSTALLED_PATCH_COLUMNS = [ })) @connectStore({ hostPatches: createGetObjectsOfType('patch').pick((_, { master }) => master.patches), + poolHosts: createGetObjectsOfType('host').filter( + createSelector( + (_, props) => props.pool.id, + poolId => host => host.$pool === poolId + ) + ), }) export default class TabPatches extends Component { render() { @@ -174,11 +181,14 @@ export default class TabPatches extends Component { master: { productBrand }, missingPatches = [], pool, + poolHosts, userPreferences, } = this.props const needsCredentials = productBrand !== 'XCP-ng' && userPreferences.xsCredentials === undefined + const isSingleHost = size(poolHosts) < 2 + return ( @@ -187,11 +197,12 @@ export default class TabPatches extends Component { {ROLLING_POOL_UPDATES_AVAILABLE && ( )}