CP-41737: Update CanRun override logic in PoolHasDeprecatedSrsCheck

Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
This commit is contained in:
Danilo Del Busso 2023-02-08 13:57:13 +00:00 committed by Danilo Del Busso
parent 727612b68b
commit 7fa8731c59
No known key found for this signature in database
2 changed files with 4 additions and 10 deletions

View File

@ -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));
}
}
}

View File

@ -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;
}