mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CP-35838: Add health check precheck into RPU wizard (#2778)
* CP-35838: Add health check precheck into RPU wizard * CP-35838: Add disable Health Check in RPU precheck warning Signed-off-by: Ji Jiang <ji.jiang@citrix.com>
This commit is contained in:
parent
72c6191b1c
commit
5a29a8fd9b
@ -180,4 +180,7 @@
|
||||
<data name="PRODUCT_VERSION_8_2" xml:space="preserve">
|
||||
<value>8.2</value>
|
||||
</data>
|
||||
<data name="PRODUCT_VERSION_POST_8_2" xml:space="preserve">
|
||||
<value>Citrix Hypervisor 8.2.50</value>
|
||||
</data>
|
||||
</root>
|
80
XenAdmin/Diagnostics/Checks/HealthCheckServiceCheck.cs
Normal file
80
XenAdmin/Diagnostics/Checks/HealthCheckServiceCheck.cs
Normal file
@ -0,0 +1,80 @@
|
||||
/* Copyright (c) Citrix Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Diagnostics.Problems;
|
||||
using XenAdmin.Diagnostics.Problems.PoolProblem;
|
||||
using XenAdmin.Model;
|
||||
using XenAPI;
|
||||
|
||||
namespace XenAdmin.Diagnostics.Checks
|
||||
{
|
||||
class HealthCheckServiceCheck : PoolCheck
|
||||
{
|
||||
private readonly Dictionary<string, string> _installMethodConfig;
|
||||
|
||||
public HealthCheckServiceCheck(Pool pool, Dictionary<string, string> installMethodConfig)
|
||||
: base(pool)
|
||||
{
|
||||
_installMethodConfig = installMethodConfig;
|
||||
}
|
||||
|
||||
public override string Description => Messages.CHECKING_HEALTH_CHECK_SERVICE;
|
||||
|
||||
public override bool CanRun()
|
||||
{
|
||||
if (Helpers.PostStockholm(Pool.Connection))
|
||||
return false;
|
||||
|
||||
if (Pool.HealthCheckSettings().Status != HealthCheckStatus.Enabled)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override Problem RunCheck()
|
||||
{
|
||||
string upgradePlatformVersion = null;
|
||||
|
||||
if (_installMethodConfig != null)
|
||||
Host.TryGetUpgradeVersion(Helpers.GetMaster(Pool.Connection), _installMethodConfig, out upgradePlatformVersion, out _);
|
||||
|
||||
if (Helpers.PostStockholm(upgradePlatformVersion))
|
||||
return new HealthCheckServiceProblem(this, Pool);
|
||||
|
||||
if (string.IsNullOrEmpty(upgradePlatformVersion))
|
||||
return new HealthCheckServiceWarning(this, Pool);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
/* Copyright (c) Citrix Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Actions;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Diagnostics.Checks;
|
||||
using XenAdmin.Dialogs;
|
||||
using XenAdmin.Model;
|
||||
using XenAPI;
|
||||
|
||||
|
||||
namespace XenAdmin.Diagnostics.Problems.PoolProblem
|
||||
{
|
||||
class HealthCheckServiceProblem : PoolProblem
|
||||
{
|
||||
private Pool _pool;
|
||||
|
||||
public HealthCheckServiceProblem(Check check, Pool pool)
|
||||
: base(check, pool)
|
||||
{
|
||||
_pool = pool;
|
||||
}
|
||||
|
||||
protected override AsyncAction CreateAction(out bool cancelled)
|
||||
{
|
||||
cancelled = false;
|
||||
var healthCheckSettings = _pool.HealthCheckSettings();
|
||||
healthCheckSettings.Status = HealthCheckStatus.Disabled;
|
||||
return new SaveHealthCheckSettingsAction(_pool, healthCheckSettings, null, null, null, null, false);
|
||||
}
|
||||
|
||||
public override string Description =>
|
||||
string.Format(Messages.PROBLEM_HEALTH_CHECK_SERVICE_DESCRIPTION, _pool, BrandManager.ProductVersionPost82);
|
||||
|
||||
public override string HelpMessage => Messages.PROBLEM_HEALTH_CHECK_HELP;
|
||||
}
|
||||
|
||||
class HealthCheckServiceWarning : WarningWithMoreInfo
|
||||
{
|
||||
private readonly Pool pool;
|
||||
|
||||
public HealthCheckServiceWarning(Check check, Pool pool)
|
||||
: base(check)
|
||||
{
|
||||
this.pool = pool;
|
||||
}
|
||||
|
||||
public override string Title => Check.Description;
|
||||
|
||||
public override string Description =>
|
||||
string.Format(Messages.PROBLEM_HEALTH_CHECK_SERVICE_DESCRIPTION, pool, BrandManager.ProductVersionPost82);
|
||||
|
||||
public override string Message =>
|
||||
string.Format(Messages.WARNING_HEALTH_CHECK_SERVICE_INFO, BrandManager.ProductVersionPost82);
|
||||
|
||||
protected override AsyncAction CreateAction(out bool cancelled)
|
||||
{
|
||||
AsyncAction action = null;
|
||||
Program.Invoke(Program.MainWindow, () =>
|
||||
{
|
||||
using (var dlg = new WarningDialog(Message,
|
||||
new ThreeButtonDialog.TBDButton(Messages.PROBLEM_HEALTH_CHECK_HELP, DialogResult.Yes),
|
||||
new ThreeButtonDialog.TBDButton(Messages.CANCEL, DialogResult.No)))
|
||||
{
|
||||
if (dlg.ShowDialog() == DialogResult.Yes)
|
||||
{
|
||||
var healthCheckSettings = pool.HealthCheckSettings();
|
||||
healthCheckSettings.Status = HealthCheckStatus.Disabled;
|
||||
action = new SaveHealthCheckSettingsAction(pool, healthCheckSettings, null, null, null, null, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
cancelled = action == null;
|
||||
return action;
|
||||
}
|
||||
}
|
||||
}
|
@ -208,6 +208,15 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard
|
||||
if (vSwitchChecks.Count > 0)
|
||||
groups.Add(new CheckGroup(Messages.CHECKING_VSWITCH_CONTROLLER_GROUP, vSwitchChecks));
|
||||
|
||||
//Health Check check - for each pool
|
||||
var hcChecks = (from Pool pool in SelectedPools
|
||||
let check = new HealthCheckServiceCheck(pool, InstallMethodConfig)
|
||||
where check.CanRun()
|
||||
select check as Check).ToList();
|
||||
|
||||
if (hcChecks.Count > 0)
|
||||
groups.Add(new CheckGroup(Messages.CHECKING_HEALTH_CHECK_SERVICE, hcChecks));
|
||||
|
||||
//protocol check - for each pool
|
||||
var sslChecks = (from Host server in SelectedMasters
|
||||
let check = new PoolLegacySslCheck(server, InstallMethodConfig, ManualUpgrade)
|
||||
|
@ -235,6 +235,7 @@
|
||||
<Compile Include="Diagnostics\Checks\CfuAvailabilityCheck.cs" />
|
||||
<Compile Include="Diagnostics\Checks\AutomatedUpdatesLicenseCheck.cs" />
|
||||
<Compile Include="Diagnostics\Checks\DiskSpaceForBatchUpdatesCheck.cs" />
|
||||
<Compile Include="Diagnostics\Checks\HealthCheckServiceCheck.cs" />
|
||||
<Compile Include="Diagnostics\Checks\PowerOniLoCheck.cs" />
|
||||
<Compile Include="Diagnostics\Checks\PoolLegacySslCheck.cs" />
|
||||
<Compile Include="Diagnostics\Checks\PrepareToUpgradeCheck.cs" />
|
||||
@ -248,6 +249,7 @@
|
||||
<Compile Include="Diagnostics\Checks\HostMemoryPostUpgradeCheck.cs" />
|
||||
<Compile Include="Diagnostics\Problems\HostProblem\BrokenSR.cs" />
|
||||
<Compile Include="Diagnostics\Problems\HostProblem\PowerOniLoProblem.cs" />
|
||||
<Compile Include="Diagnostics\Problems\PoolProblem\HealthCheckServiceProblem.cs" />
|
||||
<Compile Include="Diagnostics\Problems\PoolProblem\LegacySslProblem.cs" />
|
||||
<Compile Include="Diagnostics\Problems\PoolProblem\PoolHasPVGuestWarningUrl.cs" />
|
||||
<Compile Include="Diagnostics\Problems\HostProblem\HostMemoryPostUpgradeWarning.cs" />
|
||||
|
@ -65,6 +65,8 @@ namespace XenAdmin.Core
|
||||
|
||||
public static string ProductVersion82 => Get("PRODUCT_VERSION_8_2");
|
||||
|
||||
public static string ProductVersionPost82 => Get("PRODUCT_VERSION_POST_8_2");
|
||||
|
||||
|
||||
public const string PRODUCT_BRAND = "[XenServer product]";
|
||||
public const string COMPANY_NAME_SHORT = "[Citrix]";
|
||||
|
36
XenModel/Messages.Designer.cs
generated
36
XenModel/Messages.Designer.cs
generated
@ -7340,6 +7340,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Checking pool enrollment to the Health Check service.
|
||||
/// </summary>
|
||||
public static string CHECKING_HEALTH_CHECK_SERVICE {
|
||||
get {
|
||||
return ResourceManager.GetString("CHECKING_HEALTH_CHECK_SERVICE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Checking host liveness status.
|
||||
/// </summary>
|
||||
@ -30774,6 +30783,24 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Disable Health Check.
|
||||
/// </summary>
|
||||
public static string PROBLEM_HEALTH_CHECK_HELP {
|
||||
get {
|
||||
return ResourceManager.GetString("PROBLEM_HEALTH_CHECK_HELP", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0}: The Health Check service has been removed in {1}..
|
||||
/// </summary>
|
||||
public static string PROBLEM_HEALTH_CHECK_SERVICE_DESCRIPTION {
|
||||
get {
|
||||
return ResourceManager.GetString("PROBLEM_HEALTH_CHECK_SERVICE_DESCRIPTION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Server '{0}'.
|
||||
/// </summary>
|
||||
@ -40052,6 +40079,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The Health Check service has been removed in {0}. If you are going to upgrade the pool to this version, you must disable Health Check first..
|
||||
/// </summary>
|
||||
public static string WARNING_HEALTH_CHECK_SERVICE_INFO {
|
||||
get {
|
||||
return ResourceManager.GetString("WARNING_HEALTH_CHECK_SERVICE_INFO", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cannot find '{0}'..
|
||||
/// </summary>
|
||||
|
@ -2654,6 +2654,9 @@ Do you want to assign it to the schedule '{2}' instead?</value>
|
||||
<data name="CHECKING_HA_STATUS" xml:space="preserve">
|
||||
<value>Checking HA and WLB status</value>
|
||||
</data>
|
||||
<data name="CHECKING_HEALTH_CHECK_SERVICE" xml:space="preserve">
|
||||
<value>Checking pool enrollment to the Health Check service</value>
|
||||
</data>
|
||||
<data name="CHECKING_HOST_LIVENESS_STATUS" xml:space="preserve">
|
||||
<value>Checking host liveness status</value>
|
||||
</data>
|
||||
@ -10672,6 +10675,12 @@ Please reconnect the host and try again</value>
|
||||
<data name="PROBING_HBA_TITLE" xml:space="preserve">
|
||||
<value>Probing for LUNs on {0}</value>
|
||||
</data>
|
||||
<data name="PROBLEM_HEALTH_CHECK_SERVICE_DESCRIPTION" xml:space="preserve">
|
||||
<value>{0}: The Health Check service has been removed in {1}.</value>
|
||||
</data>
|
||||
<data name="PROBLEM_HEALTH_CHECK_HELP" xml:space="preserve">
|
||||
<value>Disable Health Check</value>
|
||||
</data>
|
||||
<data name="PROBLEM_HOSTPROBLEM_TITLE" xml:space="preserve">
|
||||
<value>Server '{0}'</value>
|
||||
</data>
|
||||
@ -13821,6 +13830,9 @@ Schedule:
|
||||
<data name="WARNING_DELETE_VD_MULTIPLE" xml:space="preserve">
|
||||
<value>This will delete these virtual disks permanently, destroying any data on them.</value>
|
||||
</data>
|
||||
<data name="WARNING_HEALTH_CHECK_SERVICE_INFO" xml:space="preserve">
|
||||
<value>The Health Check service has been removed in {0}. If you are going to upgrade the pool to this version, you must disable Health Check first.</value>
|
||||
</data>
|
||||
<data name="WEB_BROWSER_FAILED" xml:space="preserve">
|
||||
<value>Cannot find '{0}'.</value>
|
||||
</data>
|
||||
|
@ -495,6 +495,23 @@ namespace XenAdmin.Core
|
||||
return platformVersion != null && productVersionCompare(platformVersion, "3.1.50") >= 0;
|
||||
}
|
||||
|
||||
/// <param name="conn">May be null, in which case true is returned.</param>
|
||||
public static bool PostStockholm(IXenConnection conn)
|
||||
{
|
||||
return conn == null || PostStockholm(Helpers.GetMaster(conn));
|
||||
}
|
||||
|
||||
/// <param name="host">May be null, in which case true is returned.</param>
|
||||
public static bool PostStockholm(Host host)
|
||||
{
|
||||
return host == null || PostStockholm(HostPlatformVersion(host));
|
||||
}
|
||||
|
||||
public static bool PostStockholm(string platformVersion)
|
||||
{
|
||||
return platformVersion != null && productVersionCompare(platformVersion, "3.2.50") >= 0;
|
||||
}
|
||||
|
||||
// CP-3435: Disable Check for Updates in Common Criteria Certification project
|
||||
public static bool CommonCriteriaCertificationRelease
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user