2023-02-14 11:23:12 +01:00
|
|
|
|
/* Copyright (c) Cloud Software Group, Inc.
|
|
|
|
|
*
|
2023-01-23 14:59:22 +01:00
|
|
|
|
* Redistribution and use in source and binary forms,
|
|
|
|
|
* with or without modification, are permitted provided
|
|
|
|
|
* that the following conditions are met:
|
|
|
|
|
*
|
|
|
|
|
* * Redistributions of source code must retain the above
|
|
|
|
|
* copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer.
|
|
|
|
|
* * Redistributions in binary form must reproduce the above
|
|
|
|
|
* copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer in the documentation and/or other
|
|
|
|
|
* materials provided with the distribution.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
|
|
|
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
|
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
|
2023-02-14 11:16:01 +01:00
|
|
|
|
using System.Collections.Generic;
|
2023-01-23 14:59:22 +01:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using XenAdmin.Core;
|
2023-02-28 14:43:47 +01:00
|
|
|
|
using XenAdmin.Diagnostics.Hotfixing;
|
2023-01-23 14:59:22 +01:00
|
|
|
|
using XenAdmin.Diagnostics.Problems;
|
2023-02-28 14:43:47 +01:00
|
|
|
|
using XenAdmin.Diagnostics.Problems.HostProblem;
|
2023-01-23 14:59:22 +01:00
|
|
|
|
using XenAdmin.Diagnostics.Problems.PoolProblem;
|
2023-02-28 14:43:47 +01:00
|
|
|
|
using XenAPI;
|
2023-01-23 14:59:22 +01:00
|
|
|
|
|
|
|
|
|
namespace XenAdmin.Diagnostics.Checks
|
|
|
|
|
{
|
|
|
|
|
internal class PoolHasDeprecatedSrsCheck : HostPostLivenessCheck
|
|
|
|
|
{
|
2023-02-14 11:16:01 +01:00
|
|
|
|
private readonly Dictionary<string, string> _installMethodConfig;
|
|
|
|
|
private readonly bool _manualUpgrade;
|
|
|
|
|
|
2023-01-23 14:59:22 +01:00
|
|
|
|
public override string Description => string.Format(Messages.DEPRECATED_SRS_CHECK, Helpers.GetPoolOfOne(Host.Connection));
|
|
|
|
|
|
2023-02-14 11:16:01 +01:00
|
|
|
|
public PoolHasDeprecatedSrsCheck(Host host, Dictionary<string, string> installMethodConfig, bool manualUpgrade)
|
2023-01-23 14:59:22 +01:00
|
|
|
|
: base(host)
|
|
|
|
|
{
|
2023-02-14 11:16:01 +01:00
|
|
|
|
_installMethodConfig = installMethodConfig;
|
|
|
|
|
_manualUpgrade = manualUpgrade;
|
2023-01-23 14:59:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-02-08 14:57:13 +01:00
|
|
|
|
public override bool CanRun() => Host.Connection.Cache.SRs.Any(sr => sr.GetSRType(true) == SR.SRTypes.lvmofcoe);
|
2023-01-23 14:59:22 +01:00
|
|
|
|
|
|
|
|
|
protected override Problem RunHostCheck()
|
|
|
|
|
{
|
2023-02-28 14:43:47 +01:00
|
|
|
|
if (!_manualUpgrade)
|
|
|
|
|
{
|
|
|
|
|
var hotfix = HotfixFactory.Hotfix(Host);
|
|
|
|
|
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
|
|
|
|
|
return new HostDoesNotHaveHotfixWarning(this, Host);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-14 11:16:01 +01:00
|
|
|
|
string upgradePlatformVersion = null;
|
2023-02-28 14:43:47 +01:00
|
|
|
|
|
2023-02-14 11:16:01 +01:00
|
|
|
|
if (_installMethodConfig != null)
|
|
|
|
|
Host.TryGetUpgradeVersion(Host, _installMethodConfig, out upgradePlatformVersion, out _);
|
|
|
|
|
|
2023-02-28 14:43:47 +01:00
|
|
|
|
if (string.IsNullOrEmpty(upgradePlatformVersion))
|
|
|
|
|
return new PoolHasFCoESrWarning(this, Helpers.GetPoolOfOne(Host.Connection), false);
|
|
|
|
|
|
2023-04-11 13:59:33 +02:00
|
|
|
|
if (Helpers.CloudOrGreater(upgradePlatformVersion))
|
2023-02-28 14:43:47 +01:00
|
|
|
|
return new PoolHasFCoESrWarning(this, Helpers.GetPoolOfOne(Host.Connection), true);
|
|
|
|
|
|
|
|
|
|
return null;
|
2023-01-23 14:59:22 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|