From 7fa8731c599c3556e061e5426e195577be3f22c0 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Wed, 8 Feb 2023 13:57:13 +0000 Subject: [PATCH] CP-41737: Update `CanRun` override logic in `PoolHasDeprecatedSrsCheck` Signed-off-by: Danilo Del Busso --- XenAdmin/Diagnostics/Checks/PoolHasDeprecatedSrsCheck.cs | 6 ++---- .../Problems/PoolProblem/PoolHasFCoESrWarning.cs | 8 ++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/XenAdmin/Diagnostics/Checks/PoolHasDeprecatedSrsCheck.cs b/XenAdmin/Diagnostics/Checks/PoolHasDeprecatedSrsCheck.cs index f21601218..a1d25d043 100644 --- a/XenAdmin/Diagnostics/Checks/PoolHasDeprecatedSrsCheck.cs +++ b/XenAdmin/Diagnostics/Checks/PoolHasDeprecatedSrsCheck.cs @@ -46,13 +46,11 @@ namespace XenAdmin.Diagnostics.Checks { } - public override bool CanRun() => !Helpers.Post82X(Host.Connection); + public override bool CanRun() => Host.Connection.Cache.SRs.Any(sr => sr.GetSRType(true) == SR.SRTypes.lvmofcoe); protected override Problem RunHostCheck() { - var hasFCoESr = Host.Connection.Cache.SRs.Any(sr => sr.GetSRType(true) == SR.SRTypes.lvmofcoe); - return !hasFCoESr ? null : new PoolHasFCoESrWarning(this, Helpers.GetPoolOfOne(Host.Connection), true); + return new PoolHasFCoESrWarning(this, Helpers.GetPoolOfOne(Host.Connection)); } - } } diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasFCoESrWarning.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasFCoESrWarning.cs index f68e51d44..4c26d2f86 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasFCoESrWarning.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasFCoESrWarning.cs @@ -43,19 +43,15 @@ namespace XenAdmin.Diagnostics.Problems.PoolProblem internal class PoolHasFCoESrWarning : WarningWithMoreInfo { private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod()?.DeclaringType); - - private readonly bool _hasFCoESr; - private readonly Pool _pool; public override string HelpMessage => "Details..."; public override string Message => string.Empty; public override string Title => string.Empty; - public override string Description => _hasFCoESr ? string.Format(Messages.POOL_HAS_DEPRECATED_FCOE_WARNING, _pool) : null; + public override string Description => string.Format(Messages.POOL_HAS_DEPRECATED_FCOE_WARNING, _pool); - public PoolHasFCoESrWarning(Check check, Pool pool, bool hasFCoESr) : base(check) + public PoolHasFCoESrWarning(Check check, Pool pool) : base(check) { - _hasFCoESr = hasFCoESr; _pool = pool; }