From 4dc7575d5bed3851a800840897f1ae3e19f224b8 Mon Sep 17 00:00:00 2001 From: Mathieu <70369997+MathieuRA@users.noreply.github.com> Date: Mon, 29 Aug 2022 17:02:50 +0200 Subject: [PATCH] feat(xo-web/storage): display SR used for the HA state files (#6384) Fixes #6339 --- CHANGELOG.unreleased.md | 4 +++- packages/xo-server/src/xapi-object-to-xo.mjs | 1 + packages/xo-web/src/common/intl/messages.js | 1 + packages/xo-web/src/xo-app/home/sr-item.js | 12 +++++++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 7db890cee41..ddc79acc0d4 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -7,6 +7,8 @@ > Users must be able to say: “Nice enhancement, I'm eager to test it” +- [Home/Storage] Show which SRs are used for HA state files [#6339](https://github.com/vatesfr/xen-orchestra/issues/6339) (PR [#6384](https://github.com/vatesfr/xen-orchestra/pull/6384)) + ### Bug fixes > Users must be able to say: “I had this issue, happy to know it's fixed” @@ -37,6 +39,6 @@ - xen-api patch - xo-vmdk-to-vhd patch - xo-server minor -- xo-web patch +- xo-web minor diff --git a/packages/xo-server/src/xapi-object-to-xo.mjs b/packages/xo-server/src/xapi-object-to-xo.mjs index 3df1b713b16..8d536d4a6f1 100644 --- a/packages/xo-server/src/xapi-object-to-xo.mjs +++ b/packages/xo-server/src/xapi-object-to-xo.mjs @@ -107,6 +107,7 @@ const TRANSFORMS = { current_operations: obj.current_operations, default_SR: link(obj, 'default_SR'), HA_enabled: Boolean(obj.ha_enabled), + haSrs: obj.$ha_statefiles.map(vdi => link(vdi, 'SR')), master: link(obj, 'master'), tags: obj.tags, name_description: obj.name_description, diff --git a/packages/xo-web/src/common/intl/messages.js b/packages/xo-web/src/common/intl/messages.js index bced73ddd09..92233f37e2e 100644 --- a/packages/xo-web/src/common/intl/messages.js +++ b/packages/xo-web/src/common/intl/messages.js @@ -1280,6 +1280,7 @@ const messages = { protectFromDeletion: 'Protect from accidental deletion', protectFromShutdown: 'Protect from accidental shutdown', ha: 'HA', + srHaTooltip: 'SR used for High Availability', nestedVirt: 'Nested virtualization', vmAffinityHost: 'Affinity host', vmVga: 'VGA', diff --git a/packages/xo-web/src/xo-app/home/sr-item.js b/packages/xo-web/src/xo-app/home/sr-item.js index efd69b51d53..6857d2991ee 100644 --- a/packages/xo-web/src/xo-app/home/sr-item.js +++ b/packages/xo-web/src/xo-app/home/sr-item.js @@ -18,6 +18,11 @@ import styles from './index.css' @connectStore({ container: createGetObject((_, props) => props.item.$container), + isHa: createSelector( + (_, props) => props.item, + createGetObject((_, props) => props.item.$poolId), + (sr, pool) => pool.haSrs.includes(sr.id) + ), isDefaultSr: createSelector( createGetObjectsOfType('pool').find((_, props) => pool => props.item.$pool === pool.id), (_, props) => props.item, @@ -97,7 +102,7 @@ export default class SrItem extends Component { } render() { - const { container, expandAll, isDefaultSr, isShared, item: sr, selected } = this.props + const { container, expandAll, isDefaultSr, isHa, isShared, item: sr, selected } = this.props return (
@@ -113,6 +118,11 @@ export default class SrItem extends Component { {isDefaultSr && {_('defaultSr')}} + {isHa && ( + + {_('ha')} + + )} {sr.inMaintenanceMode && {_('maintenanceMode')}}