Removed DMC deprecation banner and RPU precheck when upgrading a system with DMC VMs.

Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
Konstantina Chremmou 2023-05-05 13:45:34 +01:00
parent 0e0160645c
commit 09611a806e
11 changed files with 1 additions and 395 deletions

View File

@ -1,102 +0,0 @@
/* Copyright (c) Cloud Software Group, Inc.
*
* 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 System.Linq;
using System.Windows.Forms;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAdmin.Diagnostics.Problems.PoolProblem;
using XenAPI;
namespace XenAdmin.Diagnostics.Checks
{
internal class DmcCheck : PoolCheck
{
private readonly Pool _pool;
private readonly Dictionary<string, string> _installMethodConfig;
private readonly bool _manualUpgrade;
private readonly Control _control;
public DmcCheck(Control control, Pool pool, Dictionary<string, string> installMethodConfig, bool manualUpgrade)
: base(pool)
{
_control = control;
_pool = pool;
_installMethodConfig = installMethodConfig;
_manualUpgrade = manualUpgrade;
}
public override bool CanRun()
{
return !Helpers.Post82X(_pool.Connection) && !Helpers.FeatureForbidden(_pool.Connection, Host.RestrictDMC);
}
protected override Problem RunCheck()
{
var coordinator = Helpers.GetCoordinator(Pool.Connection);
if (!_manualUpgrade)
{
var hotfix = HotfixFactory.Hotfix(coordinator);
if (hotfix != null && hotfix.ShouldBeAppliedTo(coordinator))
return new HostDoesNotHaveHotfixWarning(this, coordinator);
}
var vms = _pool.Connection.Cache.VMs.Where(v =>
(v.power_state == vm_power_state.Running ||
v.power_state == vm_power_state.Paused ||
v.power_state == vm_power_state.Suspended) &&
(v.memory_static_min > v.memory_dynamic_min || //corner case, probably unlikely
v.memory_dynamic_min != v.memory_dynamic_max ||
v.memory_dynamic_max != v.memory_static_max)).ToList();
if (vms.Count == 0)
return null;
string upgradePlatformVersion = null;
if (_installMethodConfig != null)
Host.TryGetUpgradeVersion(coordinator, _installMethodConfig, out upgradePlatformVersion, out _);
if (string.IsNullOrEmpty(upgradePlatformVersion))
return new PoolHasVmsWithDmcWarning(_control, this, _pool, vms);
if (Helpers.Post82X(upgradePlatformVersion))
return new PoolHasVmsWithDmcProblem(_control, this, _pool, vms);
return null;
}
public override string Description => Messages.DMC_CHECK_ENABLED;
}
}

View File

@ -1,145 +0,0 @@
/* Copyright (c) Cloud Software Group, Inc.
*
* 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 System.Drawing;
using System.Linq;
using System.Windows.Forms;
using XenAdmin.Actions;
using XenAdmin.Commands;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Checks;
using XenAdmin.Dialogs;
using XenAPI;
namespace XenAdmin.Diagnostics.Problems.PoolProblem
{
internal class PoolHasVmsWithDmcProblem : ProblemWithMoreInfo
{
private readonly Pool _pool;
private readonly List<VM> _vms;
protected readonly Control Control;
public PoolHasVmsWithDmcProblem(Control control, Check check, Pool pool, List<VM> vms)
: base(check)
{
Control = control;
_pool = pool;
_vms = vms;
}
public override string Title => Description;
public override string Description =>
string.Format(Messages.DMC_REMOVAL_SHORT, _pool.Name(),
string.Format(Messages.STRING_SPACE_STRING, BrandManager.ProductBrand, BrandManager.ProductVersionPost82));
public override string Message =>
string.Format(Messages.DMC_REMOVAL_LONG_ERROR,
string.Format(Messages.STRING_SPACE_STRING, BrandManager.ProductBrand, BrandManager.ProductVersionPost82),
BrandManager.BrandConsole);
protected override AsyncAction CreateAction(out bool cancelled)
{
Program.Invoke(Control, delegate
{
using (var dlg = new ErrorDialog(Message,
new ThreeButtonDialog.TBDButton(Messages.DMC_DISABLE, DialogResult.OK, ThreeButtonDialog.ButtonType.ACCEPT),
new ThreeButtonDialog.TBDButton(Messages.CANCEL, DialogResult.Cancel, ThreeButtonDialog.ButtonType.CANCEL, true))
{
LinkText = Messages.LEARN_MORE,
LinkData = InvisibleMessages.DMC_REMOVAL_URL,
ShowLinkLabel = true
})
{
if (dlg.ShowDialog(Control) == DialogResult.OK)
DisableDmc();
}
});
cancelled = true;
return null;
}
protected void DisableDmc()
{
var subActions = _vms.Select(DisableDmcPerVm).ToList();
new ParallelAction(Messages.DMC_DISABLE_ACTION_TITLE, "", "",
subActions, suppressHistory: true, showSubActionsDetails: true).RunAsync();
}
private AsyncAction DisableDmcPerVm(VM vm)
{
return new ChangeMemorySettingsAction(vm,
string.Format(Messages.ACTION_CHANGE_MEMORY_SETTINGS, vm.Name()),
vm.memory_static_min, vm.memory_dynamic_max, vm.memory_dynamic_max, vm.memory_dynamic_max,
VMOperationCommand.WarningDialogHAInvalidConfig, VMOperationCommand.StartDiagnosisForm, false);
}
}
internal class PoolHasVmsWithDmcWarning : PoolHasVmsWithDmcProblem
{
public PoolHasVmsWithDmcWarning(Control control, Check check, Pool pool, List<VM> vms)
: base(control, check, pool, vms)
{
}
public override Image Image => Images.GetImage16For(Icons.Warning);
public override string Message =>
string.Format(Messages.DMC_REMOVAL_LONG_WARNING,
string.Format(Messages.STRING_SPACE_STRING, BrandManager.ProductBrand, BrandManager.ProductVersionPost82),
BrandManager.BrandConsole);
protected override AsyncAction CreateAction(out bool cancelled)
{
Program.Invoke(Control, delegate
{
using (var dlg = new WarningDialog(Message,
new ThreeButtonDialog.TBDButton(Messages.DMC_DISABLE, DialogResult.OK, ThreeButtonDialog.ButtonType.ACCEPT),
new ThreeButtonDialog.TBDButton(Messages.CANCEL, DialogResult.Cancel, ThreeButtonDialog.ButtonType.CANCEL, true))
{
LinkText = Messages.LEARN_MORE,
LinkData = InvisibleMessages.DMC_REMOVAL_URL,
ShowLinkLabel = true
})
{
if (dlg.ShowDialog(Control) == DialogResult.OK)
DisableDmc();
}
});
cancelled = true;
return null;
}
}
}

View File

@ -390,7 +390,7 @@ namespace XenAdmin.TabPages
pageContainerPanel.ResumeLayout();
ReLayout();
SetupDeprecationBanner();
Banner.Visible = false;
}
private void ReLayout()
@ -452,22 +452,6 @@ namespace XenAdmin.TabPages
{
row.Width = pageContainerPanel.Width - pageContainerPanel.Padding.Left - 25; // It won't drop below row.MinimumSize.Width though
}
private void SetupDeprecationBanner()
{
if (Helpers.QuebecOrGreater(xenObject.Connection) &&
vms.Any(vm => vm.SupportsBallooning() && vm.memory_dynamic_min != vm.memory_static_max))
{
Banner.AppliesToVersion = BrandManager.ProductVersion81;
Banner.BannerType = DeprecationBanner.Type.Deprecation;
Banner.FeatureName = Messages.DMC;
Banner.Visible = !HiddenFeatures.LinkLabelHidden;
}
else
{
Banner.Visible = false;
}
}
}
}

View File

@ -230,15 +230,6 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard
if (iloChecks.Count > 0)
groups.Add(new CheckGroup(Messages.CHECKING_POWER_ON_MODE_GROUP, iloChecks));
//Checking DMC
var dmcChecks = (from Pool pool in SelectedPools
let check = new DmcCheck(this, pool, InstallMethodConfig, ManualUpgrade)
where check.CanRun()
select check as Check).ToList();
if (dmcChecks.Count > 0)
groups.Add(new CheckGroup(Messages.DMC_CHECK_ENABLED, dmcChecks));
//Checking PV guests - for hosts that have any PV guests and warn the user before the upgrade.
var pvChecks = (from Host server in SelectedCoordinators
let check = new PVGuestsCheck(server, ManualUpgrade, InstallMethodConfig)

View File

@ -241,7 +241,6 @@
<Compile Include="Diagnostics\Checks\PoolLegacySslCheck.cs" />
<Compile Include="Diagnostics\Checks\PrepareToUpgradeCheck.cs" />
<Compile Include="Diagnostics\Checks\CertificateKeyLengthCheck.cs" />
<Compile Include="Diagnostics\Checks\DmcCheck.cs" />
<Compile Include="Diagnostics\Checks\PVGuestsCheck.cs" />
<Compile Include="Diagnostics\Checks\RebootPendingOnMasterCheck.cs" />
<Compile Include="Diagnostics\Checks\HostNeedsRebootCheck.cs" />
@ -256,7 +255,6 @@
<Compile Include="Diagnostics\Problems\PoolProblem\HealthCheckServiceProblem.cs" />
<Compile Include="Diagnostics\Problems\PoolProblem\LegacySslProblem.cs" />
<Compile Include="Diagnostics\Problems\PoolProblem\PoolHasFCoESrWarning.cs" />
<Compile Include="Diagnostics\Problems\PoolProblem\PoolHasVmsWithDmcProblem.cs" />
<Compile Include="Diagnostics\Problems\PoolProblem\PoolHasPVGuestWarningUrl.cs" />
<Compile Include="Diagnostics\Problems\HostProblem\HostMemoryPostUpgradeWarning.cs" />
<Compile Include="Diagnostics\Problems\HostProblem\HostPrepareToUpgradeProblem.cs" />

View File

@ -78,15 +78,6 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to https://docs.citrix.com/en-us/citrix-hypervisor/CH-0005.html.
/// </summary>
public static string DMC_REMOVAL_URL {
get {
return ResourceManager.GetString("DMC_REMOVAL_URL", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to http://docs.citrix.com/en-us/.
/// </summary>

View File

@ -120,9 +120,6 @@
<data name="DEPRECATION_URL" xml:space="preserve">
<value>http://docs.citrix.com/ja-jp/citrix-hypervisor/whats-new/removed-features.html</value>
</data>
<data name="DMC_REMOVAL_URL" xml:space="preserve">
<value>https://docs.citrix.com/ja-jp/citrix-hypervisor/CH-0005.html</value>
</data>
<data name="DOCS_URL" xml:space="preserve">
<value>http://docs.citrix.com/ja-jp/</value>
</data>

View File

@ -123,9 +123,6 @@
<data name="DEPRECATION_URL" xml:space="preserve">
<value>http://docs.citrix.com/en-us/citrix-hypervisor/whats-new/removed-features.html</value>
</data>
<data name="DMC_REMOVAL_URL" xml:space="preserve">
<value>https://docs.citrix.com/en-us/citrix-hypervisor/CH-0005.html</value>
</data>
<data name="DOCS_URL" xml:space="preserve">
<value>http://docs.citrix.com/en-us/</value>
</data>

View File

@ -120,9 +120,6 @@
<data name="DEPRECATION_URL" xml:space="preserve">
<value>http://docs.citrix.com/zh-cn/citrix-hypervisor/whats-new/removed-features.html</value>
</data>
<data name="DMC_REMOVAL_URL" xml:space="preserve">
<value>https://docs.citrix.com/zh-cn/citrix-hypervisor/CH-0005.html</value>
</data>
<data name="DOCS_URL" xml:space="preserve">
<value>http://docs.citrix.com/zh-cn/</value>
</data>

View File

@ -13322,78 +13322,6 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Dynamic Memory Control.
/// </summary>
public static string DMC {
get {
return ResourceManager.GetString("DMC", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Checking for VMs using Dynamic Memory Control (DMC).
/// </summary>
public static string DMC_CHECK_ENABLED {
get {
return ResourceManager.GetString("DMC_CHECK_ENABLED", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Shut Down VMs and &amp;Disable DMC.
/// </summary>
public static string DMC_DISABLE {
get {
return ResourceManager.GetString("DMC_DISABLE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Disabling Dynamic Memory Control....
/// </summary>
public static string DMC_DISABLE_ACTION_TITLE {
get {
return ResourceManager.GetString("DMC_DISABLE_ACTION_TITLE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to
///Your system has VMs that use DMC. Their memory settings must be reconfigured before you can upgrade to {0} because support for DMC has been removed in this release.
///
///Click Shut Down VMs and Disable DMC if you want {1} to reconfigure your VMs&apos; memory settings.
///
///Click Cancel if you prefer to reconfigure your VMs&apos; memory settings manually..
/// </summary>
public static string DMC_REMOVAL_LONG_ERROR {
get {
return ResourceManager.GetString("DMC_REMOVAL_LONG_ERROR", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Your system has VMs that use DMC. If you are upgrading to {0}, their memory settings must be reconfigured because support for DMC has been removed in this release.
///
///Click Shut Down VMs and Disable DMC if you want {1} to reconfigure your VMs&apos; memory settings.
///
///Click Cancel if you prefer to reconfigure your VMs&apos; memory settings manually..
/// </summary>
public static string DMC_REMOVAL_LONG_WARNING {
get {
return ResourceManager.GetString("DMC_REMOVAL_LONG_WARNING", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}: Support for Dynamic Memory Control (DMC) has been removed in {1}..
/// </summary>
public static string DMC_REMOVAL_SHORT {
get {
return ResourceManager.GetString("DMC_REMOVAL_SHORT", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The Dynamic Memory Control (DMC) is not available due to license restrictions on the server..
/// </summary>

View File

@ -4715,36 +4715,6 @@ Plugging in untrustworthy USB devices to your computer may put your computer at
<data name="DISPLAY_DETAILS" xml:space="preserve">
<value>Display options</value>
</data>
<data name="DMC" xml:space="preserve">
<value>Dynamic Memory Control</value>
</data>
<data name="DMC_CHECK_ENABLED" xml:space="preserve">
<value>Checking for VMs using Dynamic Memory Control (DMC)</value>
</data>
<data name="DMC_DISABLE" xml:space="preserve">
<value>Shut Down VMs and &amp;Disable DMC</value>
</data>
<data name="DMC_DISABLE_ACTION_TITLE" xml:space="preserve">
<value>Disabling Dynamic Memory Control...</value>
</data>
<data name="DMC_REMOVAL_LONG_ERROR" xml:space="preserve">
<value>
Your system has VMs that use DMC. Their memory settings must be reconfigured before you can upgrade to {0} because support for DMC has been removed in this release.
Click Shut Down VMs and Disable DMC if you want {1} to reconfigure your VMs' memory settings.
Click Cancel if you prefer to reconfigure your VMs' memory settings manually.</value>
</data>
<data name="DMC_REMOVAL_LONG_WARNING" xml:space="preserve">
<value>Your system has VMs that use DMC. If you are upgrading to {0}, their memory settings must be reconfigured because support for DMC has been removed in this release.
Click Shut Down VMs and Disable DMC if you want {1} to reconfigure your VMs' memory settings.
Click Cancel if you prefer to reconfigure your VMs' memory settings manually.</value>
</data>
<data name="DMC_REMOVAL_SHORT" xml:space="preserve">
<value>{0}: Support for Dynamic Memory Control (DMC) has been removed in {1}.</value>
</data>
<data name="DMC_UNAVAILABLE_LICENSE_RESTRICTION" xml:space="preserve">
<value>The Dynamic Memory Control (DMC) is not available due to license restrictions on the server.</value>
</data>