From 8d7f8d156f128e7dce373ea49b690c072dbcf6a6 Mon Sep 17 00:00:00 2001 From: badrAZ Date: Thu, 10 Sep 2020 16:00:20 +0200 Subject: [PATCH] fix(xo-server,xo-web/orphan VDIs): ignore irrelevant VDI types (#5249) Fixes #5248 --- CHANGELOG.unreleased.md | 1 + packages/xo-server/src/xapi-object-to-xo.js | 1 + packages/xo-web/src/xo-app/dashboard/health/index.js | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 4df1a1997..7555b4307 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -14,6 +14,7 @@ > Users must be able to say: “I had this issue, happy to know it's fixed” - [New SR] Fix `Cannot read property 'trim' of undefined` error (PR [#5212](https://github.com/vatesfr/xen-orchestra/pull/5212)) +- [Dashboard/Health] Fix suspended VDIs considered as orphans [#5248](https://github.com/vatesfr/xen-orchestra/issues/5248) (PR [#5249](https://github.com/vatesfr/xen-orchestra/pull/5249)) ### Packages to release diff --git a/packages/xo-server/src/xapi-object-to-xo.js b/packages/xo-server/src/xapi-object-to-xo.js index 0b362cfcf..2b56535a0 100644 --- a/packages/xo-server/src/xapi-object-to-xo.js +++ b/packages/xo-server/src/xapi-object-to-xo.js @@ -608,6 +608,7 @@ const TRANSFORMS = { snapshots: link(obj, 'snapshots'), tags: obj.tags, usage: +obj.physical_utilisation, + VDI_type: obj.type, $SR: link(obj, 'SR'), $VBDs: link(obj, 'VBDs'), 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 37321955f..c951773ff 100644 --- a/packages/xo-web/src/xo-app/dashboard/health/index.js +++ b/packages/xo-web/src/xo-app/dashboard/health/index.js @@ -407,6 +407,8 @@ const ALARM_ACTIONS = [ }, ] +const HANDLED_VDI_TYPES = new Set(['system', 'user', 'ephemeral']) + @connectStore(() => { const getSrs = createGetObjectsOfType('SR') const getOrphanVdis = createSort( @@ -417,7 +419,7 @@ const ALARM_ACTIONS = [ (vdis, snapshotVdis) => Object.assign({}, vdis, snapshotVdis) ), createSelector(getSrs, srs => vdi => { - if (vdi.$VBDs.length !== 0) { + if (vdi.$VBDs.length !== 0 || !HANDLED_VDI_TYPES.has(vdi.VDI_type)) { return false }