xenadmin/XenAdmin/SettingsPanels/VMHAEditPage.cs

609 lines
22 KiB
C#
Raw Normal View History

/* 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;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using XenAdmin.Actions;
using XenAdmin.Commands;
using XenAdmin.Core;
using XenAdmin.Network;
using XenAPI;
namespace XenAdmin.SettingsPanels
{
public partial class VMHAEditPage : UserControl, IEditPage
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
{
#region Private fields
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private VM vm;
private bool vmIsAgile;
CP-44767, CP-44766 & CP-44765: Refactor usage of VM restrictions and add `reference_label` to OVFs (#3211) * Tidy up `VM` extension: use `var` * Tidy up `VM` extension: remove redundant initialisers * Tidy up `VM` extension: use type keywords when possible * Tidy up `VM` extension: merge conditional expressions * Tidy up `VM` extension: remove redundant qualifiers * Tidy up `VM` extension: remove redundant type arguments * Tidy up `VM` extension: remove redundant `else`s and parentheses * Tidy up `VM` extension: fix naming * Tidy up `VM` extension: misc changes * Tidy up `VM` extension: use `null` propagation * Tidy up `VM` extension: fix whitespace * Tidy up `VM` extension: apply ReSharper Code Cleanup utility * Tidy up `VM` extension: Fix naming of private string array * CP-44767: Ignore VM restriction when fetching `MaxVCPUsAllowed` Instead, fetch the highest available value in all templates for the host. This means that VMs imported from vhd won't automatically default to `DEFAULT_NUM_VCPUS_ALLOWED`, and that VMs that have been kept across XenServer upgrades won't be limited to the number of vCPUs in their own (possibly outdated) restrictions * CP-44766: Use value in template with a matching `reference_label` when checking VM restrictions * Move restriction getters to own region * CP-44766: Use matching templates to fetch VM restrictions - Rewrite `GetRestrictions...` methods to perform simpler operations - Add `GetIntRestrictionValue` and `GetBoolRestrictionValue` wrappers to `GetRestrictionValueFromMatchingTemplate` - Now all calls to a restrictions first check the template value, with a fall-back to defaults * CP-44765: Export `reference-label` when generating OVFs --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
2023-09-29 04:45:17 +02:00
private VM.HaRestartPriority origRestartPriority;
private long origNtol;
private long origOrder;
private long origStartDelay;
/// <summary>
/// The vm's pool. May be null.
/// </summary>
private Pool pool;
/// <summary>
/// Any Hosts we have property changed listeners registered on.
/// </summary>
private readonly List<Host> hosts = new List<Host>();
/// <summary>
/// Any Host_metrics objects we have property changed listeners registered on.
/// </summary>
private readonly List<Host_metrics> hostMetrics = new List<Host_metrics>();
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
private readonly CollectionChangeEventHandler Host_CollectionChangedWithInvoke;
#endregion
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
public VMHAEditPage()
{
InitializeComponent();
Host_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(Host_CollectionChanged);
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
Text = Messages.START_UP_OPTIONS;
nudStartDelay.Maximum = long.MaxValue;
nudOrder.Maximum = long.MaxValue;
}
#region VerticalTabs.IVerticalTab implementation
public event Action Populated;
public String SubText
{
get
{
if (vm == null)
return "";
Pool pool = Helpers.GetPool(vm.Connection);
if (pool == null)
{
return Messages.HA_STANDALONE_SERVER;
}
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
if (!pool.ha_enabled)
{
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
return String.Format(Messages.HA_NOT_CONFIGURED, Helpers.GetName(pool).Ellipsise(30));
}
return Helpers.RestartPriorityI18n(SelectedPriority);
}
}
public Image Image => Images.StaticImages._000_RebootVM_h32bit_16;
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
#endregion
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
#region Event handlers
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
/// <summary>
/// Called when the Host collection of the current VM's Connection changes.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Host_CollectionChanged(object sender, CollectionChangeEventArgs e)
{
// NB this code is unused at the moment, since the HA is not yet capable of adding/removing hosts once switched on
// This may change in the future
// ... in which case test this code ;)
Host host = (Host)e.Element;
if (e.Action == CollectionChangeAction.Add)
{
// Listen for changes on the host's metrics field
host.PropertyChanged += host_PropertyChanged;
// Remember the host so we can deregister the listener later
hosts.Add(host);
// Register on the new host's metrics object - we need to know if the host goes down
Host_metrics metrics = vm.Connection.Resolve(host.metrics);
if (metrics != null)
{
metrics.PropertyChanged += metrics_PropertyChanged;
// Remember the metrics object so we can deregister the listener later
hostMetrics.Add(metrics);
}
}
else if (e.Action == CollectionChangeAction.Remove)
{
host.PropertyChanged -= host_PropertyChanged;
hosts.Remove(host);
// Also try deregistering from the host's metrics. Probably not terrible if we cannot.
Host_metrics metrics = vm.Connection.Resolve(host.metrics);
if (metrics != null)
{
metrics.PropertyChanged -= metrics_PropertyChanged;
hostMetrics.Remove(metrics);
}
}
}
/// <summary>
/// Called when the pool of the current VM has a property changed event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pool_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "ha_enabled")
{
Repopulate();
}
}
/// <summary>
/// Called when any Host of the current VM's connection has a property changed event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void host_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
Host host = (Host)sender;
if (e.PropertyName == "metrics")
{
// Just register on the new metrics object - assume the old one is deleted and will fire no more events
Host_metrics metrics = vm.Connection.Resolve(host.metrics);
if (metrics != null)
{
metrics.PropertyChanged += metrics_PropertyChanged;
// Remember the metrics object so we can deregister the listener later
hostMetrics.Add(metrics);
}
}
}
private void metrics_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "live")
{
// Looks like a host has gone down
Repopulate();
}
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
}
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
#endregion
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
private void UpdateVMAgility(object obj)
{
Program.AssertOffEventThread();
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
try
{
IXenConnection c = vm.Connection;
Session session = c.DuplicateSession();
try
{
VM.assert_agile(session, vm.opaque_ref);
// The VM was agile
vmIsAgile = true;
}
catch (Failure)
{
// VM wasn't agile
vmIsAgile = false;
}
Program.Invoke(Program.MainWindow, RefillPrioritiesComboBox);
}
catch (Exception e)
{
log.Error(e);
}
finally
{
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
Program.Invoke(this, delegate ()
{
if (Populated != null)
Populated();
});
}
}
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
/// <param name="showScan">
/// True to show the scanning label and hide the HA restart priority groupbox.
/// </param>
private void ToggleScanningVmAgile(bool showScan)
{
try
{
m_tlpMain.SuspendLayout();
groupBoxHA.Visible = !showScan;
m_tlpScanning.Visible = showScan;
}
finally
{
m_tlpMain.ResumeLayout();
}
}
/// <summary>
/// Called after we determine if the selected VM is agile or not. Fills the combo box with the correct PriorityWrappers.
/// </summary>
public void RefillPrioritiesComboBox()
{
Program.AssertOnEventThread();
m_comboBoxProtectionLevel.Items.Clear();
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
ToggleScanningVmAgile(false);
CP-44767, CP-44766 & CP-44765: Refactor usage of VM restrictions and add `reference_label` to OVFs (#3211) * Tidy up `VM` extension: use `var` * Tidy up `VM` extension: remove redundant initialisers * Tidy up `VM` extension: use type keywords when possible * Tidy up `VM` extension: merge conditional expressions * Tidy up `VM` extension: remove redundant qualifiers * Tidy up `VM` extension: remove redundant type arguments * Tidy up `VM` extension: remove redundant `else`s and parentheses * Tidy up `VM` extension: fix naming * Tidy up `VM` extension: misc changes * Tidy up `VM` extension: use `null` propagation * Tidy up `VM` extension: fix whitespace * Tidy up `VM` extension: apply ReSharper Code Cleanup utility * Tidy up `VM` extension: Fix naming of private string array * CP-44767: Ignore VM restriction when fetching `MaxVCPUsAllowed` Instead, fetch the highest available value in all templates for the host. This means that VMs imported from vhd won't automatically default to `DEFAULT_NUM_VCPUS_ALLOWED`, and that VMs that have been kept across XenServer upgrades won't be limited to the number of vCPUs in their own (possibly outdated) restrictions * CP-44766: Use value in template with a matching `reference_label` when checking VM restrictions * Move restriction getters to own region * CP-44766: Use matching templates to fetch VM restrictions - Rewrite `GetRestrictions...` methods to perform simpler operations - Add `GetIntRestrictionValue` and `GetBoolRestrictionValue` wrappers to `GetRestrictionValueFromMatchingTemplate` - Now all calls to a restrictions first check the template value, with a fall-back to defaults * CP-44765: Export `reference-label` when generating OVFs --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
2023-09-29 04:45:17 +02:00
List<VM.HaRestartPriority> restartPriorities = VM.GetAvailableRestartPriorities(vm.Connection);
foreach (var restartPriority in restartPriorities)
{
// add "restart" priorities only is vm is agile
if (VM.HaPriorityIsRestart(vm.Connection, restartPriority) &&
(!vmIsAgile || VGpus != null && VGpus.Count > 0))
continue;
m_comboBoxProtectionLevel.Items.Add(new PriorityWrapper(restartPriority));
}
// Select appropriate entry in combo box
bool found = false;
foreach (PriorityWrapper w in m_comboBoxProtectionLevel.Items)
{
if (w.Priority == SelectedPriority)
{
found = true;
m_comboBoxProtectionLevel.SelectedItem = w;
break;
}
}
if (!found)
{
// Someone might have set a High/Medium/Low restart priority for a non-agile VM through the CLI,
// even though this is not possible through the GUI. Hence we need to add that priority to the
// combo box just to prevent things screwing up.
m_comboBoxProtectionLevel.Items.Insert(0, new PriorityWrapper(SelectedPriority));
m_comboBoxProtectionLevel.SelectedIndex = 0;
}
}
private void Repopulate()
{
System.Diagnostics.Trace.Assert(vm != null);
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
UpdateEnablement();
// Select the current priority from the list
foreach (PriorityWrapper p in m_comboBoxProtectionLevel.Items)
{
if (p.Priority == vm.HARestartPriority())
{
m_comboBoxProtectionLevel.SelectedItem = p;
break;
}
}
nudOrder.Value = vm.order;
nudStartDelay.Value = vm.start_delay;
}
private void UpdateEnablement()
{
CP-34231: Remove language with negative connotations (#2860) * CA-34231: Replace negative language with `block list` in code and references Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `stop` in code and references Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `freezing` in code Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run/ran` in code comments Some paramater mentions have been renamed, as they will be renamed in future commits. Excluded mentions in XenAPI/Host.cs and XenAPI/VM.cs since code is autogenerated. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # CFUValidator/CommandLineOptions/CFUCommandLineOptionManager.cs # XenAdmin/Controls/Wlb/WlbOptModeScheduler.cs # XenAdmin/Dialogs/Wlb/WorkloadReports.cs * CA-34231: Replace negative language with `run` in Command.cs Run method Used Resharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/TabPages/GeneralTabPage.cs * CA-34231: Replace negative language with `run` in Command.cs CanRun method Used Resharper rename utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in Command.cs CanRunCore method Used ReSharper rename utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/DRConfigureCommand.cs # XenAdmin/Commands/DRDryrunCommand.cs # XenAdmin/Commands/DRFailbackCommand.cs # XenAdmin/Commands/DRFailoverCommand.cs # XenAdmin/Commands/DisasterRecoveryCommand.cs # XenAdmin/Commands/VMGroupCommand.cs * CA-34231: Replace negative language with `run` in Command.cs RunCore method Used ReSharper rename utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in Command.cs GetCantExecuteReasonCore method Used ReSharper rename utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in Command.cs GetCantRunReasons method Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative language with `run` in Command.cs Also applied to related symbols. Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in methods named CanRun Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in methods in CrossPoolMigrateCommand.cs Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/CrossPoolMigrateCommand.cs * CA-34231: Replace negative language with `run` in remaining Run methods Also updated negative language in `DeleteVMCommand` Also updated in comment in `CrossPoolMigrateCommand` Also renamed missed instances of `CanRun` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in `CanRunCore` and `RunCore` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative language with `run` in Commands folder Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative language with `run` in XenAdmin/Controls folder Used ReSharper renaming utility. Had to rename `WlbReportView.xs:RunReport()` to `WlbReportView.xs:StartRunReport()` to resolve conflict with change from `WlbReportView:ExecuteReport()` to `WlbReportView:RunReport()` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Controls/Wlb/WlbOptModeScheduler.cs # XenAdmin/Dialogs/Wlb/WorkloadReports.cs # XenAdminTests/UnitTests/WlbTests/WlbScheduledTaskTests.cs * CA-34231: Replace all remaining negative language with `run` in code Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/Controls/WlbRecommendations.cs # XenAdminTests/UnitTests/WlbTests/WlbScheduledTaskTests.cs # XenModel/WLB/WlbScheduledTask.cs * CA-34231: Replace negative language with `supporter` or `bond member` in code strings Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `supporter` or `bond member` in Messages string Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/MainWindow.cs # XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs # XenModel/Messages.Designer.cs # XenModel/Messages.resx * CA-34231: Replace remaining negative language with `supporter` in .resx files Used ReSharper renaming utility. FriendlyErrorNames.resx has been excluded. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `supporter` or `bond member` in XenAdmin code Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/NewPoolDialog.cs * CA-34231: Replace negative language with `supporter` or `bond member` in XenModel code Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in CFUValidator code Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # CFUValidator/CFUValidator.cs * CA-34231: Replace negative language with `coordinator` in solution's comments and hardcoded strings Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `Helpers:GetCoordinator` method Used ReSharper renaming utility. also renamed similarly named method in `ObjectChange.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Alerts/Types/HotfixEligibilityAlert.cs # XenAdmin/Controls/CustomDataGraph/ArchiveMaintainer.cs * CA-34231: Replace negative language with `coordinator` in `EvacuateHostDialog.resx` Used ReSharper renaming utility. Excluded jp and zh resources Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/EvacuateHostDialog.resx * CA-34231: Replace negative language with `coordinator` in `EvacuateHostDialog.resx` Used ReSharper renaming utility. Excluded jp and zh resource files. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/NewPoolDialog.resx * CA-34231: Rename missing language references for change to `coordinator` Misc files were not saved before last commits. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `Messages.resx`'s code Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/HACommand.cs # XenAdmin/TabPages/AdPage.cs # XenModel/Actions/Network/CreateBondAction.cs # XenModel/Actions/Network/NetworkAction.cs # XenModel/Messages.Designer.cs # XenModel/Messages.resx * CA-34231: Replace negative language with `coordinator` in `ExternalPluginAction.cs` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `XenAdmin/Commands` Used ReSharper renaming utility. Also replace negative language in missed comment in `ExternalPluginAction.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/AddHostToPoolCommand.cs # XenAdmin/Commands/HACommand.cs * CA-34231: Replace negative language with `coordinator` in `Helpers.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `NetworkingHelper.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `PoolJoinRules.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/NewPoolDialog.cs * CA-34231: Replace negative language with `coordinator` in `XenAdmin/Commands`, `Controls`, and `Core` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/AddHostToPoolCommand.cs * CA-34231: Replace negative language with `coordinator` in `XenAdmin/Diagnostics` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `XenAdmin/Dialogs` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/NewPoolDialog.cs * CA-34231: Replace remaining negative language with `coordinator` in `XenAdmin` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/MainWindow.cs # XenAdmin/TabPages/GeneralTabPage.cs # XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs # XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeExtrasPage.cs # XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizard.cs # XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizardPrecheckPage.cs # XenAdmin/XenSearch/Columns.cs * CA-34231: Replace remaining negative language with `coordinator` in `XenModel\Actions` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenModel/Actions/Network/CreateBondAction.cs * CA-34231: Replace remaining negative language with `coordinator` in `XenModel` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative strings with `main` in `Messages.resx` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenModel/Messages.Designer.cs # XenModel/Messages.resx * CA-34231: Replace remaining negative string names with `main` in `Messages.resx` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/OptionsPages/SaveAndRestoreOptionsPage.cs # XenModel/Messages.resx * CA-34231: Rename dialogs to replace negative connotations with `main` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `main` in `SaveAndResoreOptionsPage.cs` Also updated its resx file. Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/OptionsPages/SaveAndRestoreOptionsPage.cs * CA-34231: Fix invalid reference in `SaveAndRestoreOptionsPage.Designer.cs` after renaming Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `main` in `EnterMainPasswordDialog.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `main` in `ChangeMainPasswordDialog.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Fix invalid reference not changed after renaming `EnterMainPasswordDialog.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative language with `main` in `XenAdmin/Dialogs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Update class names in HelpManager.resx Following renaming of main password dialog. Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `main` in `Metadata.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Remove remaning negative language with `coordinator` from `Messages.resx` Used ReSharper renaming Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Remove remaning negative language with `other pool member` from `Messages.resx` Used ReSharper Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative language in solution Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Remove commented out code in VNCGraphicsClient.cs Code has only been improved partially as it's not strictly relevant to the PR Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Amend negative word replacement in XSVNCScreen.cs Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Simplify debug call formatting in NewPoolDialog.cs Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Add code mistakenly removed in MainWindow.cs Removed as part of `f155f9c8` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Revert renaming of constant related to Windows' API Considered external to CH Center Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Amend hotkey for Coordinator field in `NewPoolDialog` Previous ALT+<key> hotkey was conflicting with CreatePool Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Remove unecessary whitespace in EvacuateHostDialog.cs Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Update if block to exclude unecessary else in DRFailoverWizard.cs Not relevant to the PR, but the change is small enought to no need extra testing Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Amend typo in PoolJoinRules.cs supporer -> supporter Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Replace missing negative language with `coordinator` in `XenAPI-Extensions/Pool.cs` Variables and methods XenAPI-Extensions were mistakenly skipped Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Replace negative language in `XenApi-Extensions` with `coordinator/interface` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Replace negative language in `XenApi-Extensions` with `supporter/member` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Replace remaining negative language in `XenServerHealthCheckBugTool.cs` This is only used to format the string Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Change line-endings to CRLF in `Page_CloudConfigParamters.cs` Done in order to fix merge conflict into master Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Amend misc negative language renaming typos `XenServerHealthCheckBugTool` and `XenServerHealthCheckService` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-08-31 12:31:16 +02:00
// Disable editing if pool coordinator doesn't have HA license flag
Host host = Helpers.GetCoordinator(vm.Connection);
2015-10-26 17:01:55 +01:00
if (host == null || Host.RestrictHA(host))
{
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
m_labelHaStatus.Text = Messages.HA_LICENSE_DISABLED;
m_tlpPriority.Visible = false;
haNtolIndicator.Visible = false;
m_linkLabel.Visible = false;
return;
}
// Disable editing if HA isn't switched on
Pool pool = Helpers.GetPool(vm.Connection);
if (pool == null)
{
m_labelHaStatus.Text = Messages.HA_STANDALONE_SERVER;
m_tlpPriority.Visible = false;
haNtolIndicator.Visible = false;
m_linkLabel.Visible = false;
return;
}
if (!pool.ha_enabled)
{
m_labelHaStatus.Text = String.Format(Messages.HA_NOT_CONFIGURED, Helpers.GetName(pool).Ellipsise(30));
m_tlpPriority.Visible = false;
haNtolIndicator.Visible = false;
m_linkLabel.Visible = true;
m_linkLabel.Text = Messages.HA_CONFIGURE_NOW;
return;
}
// Disable editing if not all hosts are live (because we can't do a db_sync)
List<string> deadHosts = new List<string>();
foreach (Host member in pool.Connection.Cache.Hosts)
{
if (!member.IsLive())
{
deadHosts.Add(Helpers.GetName(member).Ellipsise(30));
}
}
if (deadHosts.Count > 0)
{
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
m_labelHaStatus.Text = String.Format(Messages.HA_CANNOT_EDIT_WITH_DEAD_HOSTS_WRAPPED, String.Join("\n", deadHosts.ToArray()));
m_tlpPriority.Visible = false;
haNtolIndicator.Visible = false;
m_linkLabel.Visible = false;
return;
}
// Disable editing if we can't find out the HA number from the server (for less privileged users).
if (haNtolIndicator.Ntol == -1)
{
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
m_labelHaStatus.Text = Messages.HA_NTOL_UNKNOWN;
m_tlpPriority.Visible = false;
haNtolIndicator.Visible = false;
m_linkLabel.Visible = false;
return;
}
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
m_labelHaStatus.Text = String.Format(Messages.HA_CONFIGURED, Helpers.GetName(pool).Ellipsise(30));
m_tlpPriority.Visible = true;
haNtolIndicator.Visible = true;
m_linkLabel.Visible = true;
m_linkLabel.Text = Messages.HA_EDIT_NOW;
}
private bool ChangesMadeInHA()
{
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
return IsHaEditable() && (SelectedPriority != origRestartPriority || haNtolIndicator.Ntol != origNtol);
}
private bool ChangesMadeInStartupOptions()
{
2015-10-26 17:01:55 +01:00
return nudOrder.Value != origOrder || nudStartDelay.Value != origStartDelay;
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
}
CP-44767, CP-44766 & CP-44765: Refactor usage of VM restrictions and add `reference_label` to OVFs (#3211) * Tidy up `VM` extension: use `var` * Tidy up `VM` extension: remove redundant initialisers * Tidy up `VM` extension: use type keywords when possible * Tidy up `VM` extension: merge conditional expressions * Tidy up `VM` extension: remove redundant qualifiers * Tidy up `VM` extension: remove redundant type arguments * Tidy up `VM` extension: remove redundant `else`s and parentheses * Tidy up `VM` extension: fix naming * Tidy up `VM` extension: misc changes * Tidy up `VM` extension: use `null` propagation * Tidy up `VM` extension: fix whitespace * Tidy up `VM` extension: apply ReSharper Code Cleanup utility * Tidy up `VM` extension: Fix naming of private string array * CP-44767: Ignore VM restriction when fetching `MaxVCPUsAllowed` Instead, fetch the highest available value in all templates for the host. This means that VMs imported from vhd won't automatically default to `DEFAULT_NUM_VCPUS_ALLOWED`, and that VMs that have been kept across XenServer upgrades won't be limited to the number of vCPUs in their own (possibly outdated) restrictions * CP-44766: Use value in template with a matching `reference_label` when checking VM restrictions * Move restriction getters to own region * CP-44766: Use matching templates to fetch VM restrictions - Rewrite `GetRestrictions...` methods to perform simpler operations - Add `GetIntRestrictionValue` and `GetBoolRestrictionValue` wrappers to `GetRestrictionValueFromMatchingTemplate` - Now all calls to a restrictions first check the template value, with a fall-back to defaults * CP-44765: Export `reference-label` when generating OVFs --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
2023-09-29 04:45:17 +02:00
public VM.HaRestartPriority SelectedPriority { get; private set; }
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
public List<VGPU> VGpus { private get; set; }
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
private bool IsHaEditable()
{
return m_tlpPriority.Visible || m_linkLabel.Visible || haNtolIndicator.Visible;
}
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
#region IEditPage implementation
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
/// <summary>
/// Must be a VM.
/// </summary>
public void SetXenObjects(IXenObject orig, IXenObject clone)
{
// This should only ever be set once
System.Diagnostics.Trace.Assert(vm == null);
vm = (VM)clone;
origRestartPriority = vm.HARestartPriority();
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
SelectedPriority = origRestartPriority;
origOrder = vm.order;
origStartDelay = vm.start_delay;
Repopulate();
haNtolIndicator.Connection = vm.Connection;
haNtolIndicator.Settings = Helpers.GetVmHaRestartPriorities(vm.Connection, Properties.Settings.Default.ShowHiddenVMs);
haNtolIndicator.UpdateInProgressChanged += haNtolIndicator_UpdateInProgressChanged;
// Put property changed listener on pool, disable edits if HA becomes disabled
pool = Helpers.GetPoolOfOne(vm.Connection);
if (pool != null)
{
pool.PropertyChanged += pool_PropertyChanged;
origNtol = pool.ha_host_failures_to_tolerate;
}
// Put property changed listener on all hosts to listen for changes in their Host_metrics
foreach (Host host in vm.Connection.Cache.Hosts)
{
host.PropertyChanged += host_PropertyChanged;
// Remember the host so we can deregister the listener later
hosts.Add(host);
// Also register on the current metrics object - we need to know if a host goes down
Host_metrics metrics = vm.Connection.Resolve(host.metrics);
if (metrics != null)
{
metrics.PropertyChanged += metrics_PropertyChanged;
// Remember the metrics object so we can deregister the listener later
hostMetrics.Add(metrics);
}
}
// Listen for new hosts so that we can add metrics listeners
vm.Connection.Cache.RegisterCollectionChanged<Host>(Host_CollectionChangedWithInvoke);
// Start thread to determine if VM is agile
ToggleScanningVmAgile(true);
Thread t = new Thread(UpdateVMAgility);
t.Name = "Updater for VM agility for " + Helpers.GetName(vm);
t.IsBackground = true;
t.Priority = ThreadPriority.Highest;
t.Start();
}
public bool HasChanged
{
get
{
return ChangesMadeInHA() || ChangesMadeInStartupOptions();
}
}
public void ShowLocalValidationMessages()
{
}
public void HideLocalValidationMessages()
{ }
/// <summary>
/// a.k.a. OnClosing()
/// </summary>
public void Cleanup()
{
haNtolIndicator.StopNtolUpdate();
// Deregister listeners
if (vm != null)
{
vm.Connection.Cache.DeregisterCollectionChanged<Host>(Host_CollectionChangedWithInvoke);
}
if (pool != null)
{
pool.PropertyChanged -= pool_PropertyChanged;
}
foreach (Host host in hosts)
{
host.PropertyChanged -= host_PropertyChanged;
}
foreach (Host_metrics metrics in hostMetrics)
{
metrics.PropertyChanged -= metrics_PropertyChanged;
}
}
private bool PoolHasHAEnabled
{
get
{
return pool != null && pool.ha_enabled;
}
}
public bool ValidToSave
{
get
{
if (!PoolHasHAEnabled)
return true;
// If skankPanel is disabled, so is editing
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
var validToSaveHA = !IsHaEditable() || this.vm != null && !haNtolIndicator.UpdateInProgress && haNtolIndicator.Ntol >= 0;
2015-10-26 17:01:55 +01:00
var validToSaveStartupOptions = this.vm != null;
return validToSaveHA && validToSaveStartupOptions;
}
}
public AsyncAction SaveSettings()
{
if (vm == null || (!ChangesMadeInStartupOptions() && !ChangesMadeInHA()))
return null;
var settings = new Dictionary<VM, VMStartupOptions>();
if (ChangesMadeInHA() && PoolHasHAEnabled)
{
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
settings[vm] = new VMStartupOptions((long)nudOrder.Value, (long)nudStartDelay.Value, SelectedPriority);
return new SetHaPrioritiesAction(vm.Connection, settings, haNtolIndicator.Ntol, true);
}
settings[vm] = new VMStartupOptions((long)nudOrder.Value, (long)nudStartDelay.Value);
return new SetVMStartupOptionsAction(vm.Connection, settings, true);
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
}
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
#endregion
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
#region Control Event handlers
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
private void haNtolIndicator_UpdateInProgressChanged(object sender, EventArgs e)
{
UpdateEnablement();
}
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
private void comboBoxRestartPriority_SelectedIndexChanged(object sender, EventArgs e)
{
if (vm == null)
return;
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
var pw = m_comboBoxProtectionLevel.SelectedItem as PriorityWrapper;
if (pw != null)
SelectedPriority = pw.Priority;
comboLabel.Text = Helpers.RestartPriorityDescription(SelectedPriority);
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
var settings = Helpers.GetVmHaRestartPriorities(vm.Connection, Properties.Settings.Default.ShowHiddenVMs);
// Supplement with the changed setting
settings[vm] = SelectedPriority;
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
// This will trigger an update in the ntol indicator.
haNtolIndicator.Settings = settings;
}
private void m_linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (pool == null)
return;
var cmd = new HAConfigureCommand(Program.MainWindow, pool);
CP-34231: Remove language with negative connotations (#2860) * CA-34231: Replace negative language with `block list` in code and references Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `stop` in code and references Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `freezing` in code Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run/ran` in code comments Some paramater mentions have been renamed, as they will be renamed in future commits. Excluded mentions in XenAPI/Host.cs and XenAPI/VM.cs since code is autogenerated. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # CFUValidator/CommandLineOptions/CFUCommandLineOptionManager.cs # XenAdmin/Controls/Wlb/WlbOptModeScheduler.cs # XenAdmin/Dialogs/Wlb/WorkloadReports.cs * CA-34231: Replace negative language with `run` in Command.cs Run method Used Resharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/TabPages/GeneralTabPage.cs * CA-34231: Replace negative language with `run` in Command.cs CanRun method Used Resharper rename utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in Command.cs CanRunCore method Used ReSharper rename utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/DRConfigureCommand.cs # XenAdmin/Commands/DRDryrunCommand.cs # XenAdmin/Commands/DRFailbackCommand.cs # XenAdmin/Commands/DRFailoverCommand.cs # XenAdmin/Commands/DisasterRecoveryCommand.cs # XenAdmin/Commands/VMGroupCommand.cs * CA-34231: Replace negative language with `run` in Command.cs RunCore method Used ReSharper rename utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in Command.cs GetCantExecuteReasonCore method Used ReSharper rename utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in Command.cs GetCantRunReasons method Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative language with `run` in Command.cs Also applied to related symbols. Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in methods named CanRun Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in methods in CrossPoolMigrateCommand.cs Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/CrossPoolMigrateCommand.cs * CA-34231: Replace negative language with `run` in remaining Run methods Also updated negative language in `DeleteVMCommand` Also updated in comment in `CrossPoolMigrateCommand` Also renamed missed instances of `CanRun` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `run` in `CanRunCore` and `RunCore` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative language with `run` in Commands folder Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative language with `run` in XenAdmin/Controls folder Used ReSharper renaming utility. Had to rename `WlbReportView.xs:RunReport()` to `WlbReportView.xs:StartRunReport()` to resolve conflict with change from `WlbReportView:ExecuteReport()` to `WlbReportView:RunReport()` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Controls/Wlb/WlbOptModeScheduler.cs # XenAdmin/Dialogs/Wlb/WorkloadReports.cs # XenAdminTests/UnitTests/WlbTests/WlbScheduledTaskTests.cs * CA-34231: Replace all remaining negative language with `run` in code Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/Controls/WlbRecommendations.cs # XenAdminTests/UnitTests/WlbTests/WlbScheduledTaskTests.cs # XenModel/WLB/WlbScheduledTask.cs * CA-34231: Replace negative language with `supporter` or `bond member` in code strings Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `supporter` or `bond member` in Messages string Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/MainWindow.cs # XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs # XenModel/Messages.Designer.cs # XenModel/Messages.resx * CA-34231: Replace remaining negative language with `supporter` in .resx files Used ReSharper renaming utility. FriendlyErrorNames.resx has been excluded. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `supporter` or `bond member` in XenAdmin code Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/NewPoolDialog.cs * CA-34231: Replace negative language with `supporter` or `bond member` in XenModel code Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in CFUValidator code Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # CFUValidator/CFUValidator.cs * CA-34231: Replace negative language with `coordinator` in solution's comments and hardcoded strings Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `Helpers:GetCoordinator` method Used ReSharper renaming utility. also renamed similarly named method in `ObjectChange.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Alerts/Types/HotfixEligibilityAlert.cs # XenAdmin/Controls/CustomDataGraph/ArchiveMaintainer.cs * CA-34231: Replace negative language with `coordinator` in `EvacuateHostDialog.resx` Used ReSharper renaming utility. Excluded jp and zh resources Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/EvacuateHostDialog.resx * CA-34231: Replace negative language with `coordinator` in `EvacuateHostDialog.resx` Used ReSharper renaming utility. Excluded jp and zh resource files. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/NewPoolDialog.resx * CA-34231: Rename missing language references for change to `coordinator` Misc files were not saved before last commits. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `Messages.resx`'s code Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/HACommand.cs # XenAdmin/TabPages/AdPage.cs # XenModel/Actions/Network/CreateBondAction.cs # XenModel/Actions/Network/NetworkAction.cs # XenModel/Messages.Designer.cs # XenModel/Messages.resx * CA-34231: Replace negative language with `coordinator` in `ExternalPluginAction.cs` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `XenAdmin/Commands` Used ReSharper renaming utility. Also replace negative language in missed comment in `ExternalPluginAction.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/AddHostToPoolCommand.cs # XenAdmin/Commands/HACommand.cs * CA-34231: Replace negative language with `coordinator` in `Helpers.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `NetworkingHelper.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `PoolJoinRules.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/NewPoolDialog.cs * CA-34231: Replace negative language with `coordinator` in `XenAdmin/Commands`, `Controls`, and `Core` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Commands/AddHostToPoolCommand.cs * CA-34231: Replace negative language with `coordinator` in `XenAdmin/Diagnostics` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `coordinator` in `XenAdmin/Dialogs` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/NewPoolDialog.cs * CA-34231: Replace remaining negative language with `coordinator` in `XenAdmin` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/MainWindow.cs # XenAdmin/TabPages/GeneralTabPage.cs # XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs # XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeExtrasPage.cs # XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizard.cs # XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizardPrecheckPage.cs # XenAdmin/XenSearch/Columns.cs * CA-34231: Replace remaining negative language with `coordinator` in `XenModel\Actions` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenModel/Actions/Network/CreateBondAction.cs * CA-34231: Replace remaining negative language with `coordinator` in `XenModel` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative strings with `main` in `Messages.resx` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenModel/Messages.Designer.cs # XenModel/Messages.resx * CA-34231: Replace remaining negative string names with `main` in `Messages.resx` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/OptionsPages/SaveAndRestoreOptionsPage.cs # XenModel/Messages.resx * CA-34231: Rename dialogs to replace negative connotations with `main` Used ReSharper renaming utility Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `main` in `SaveAndResoreOptionsPage.cs` Also updated its resx file. Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> # Conflicts: # XenAdmin/Dialogs/OptionsPages/SaveAndRestoreOptionsPage.cs * CA-34231: Fix invalid reference in `SaveAndRestoreOptionsPage.Designer.cs` after renaming Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `main` in `EnterMainPasswordDialog.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `main` in `ChangeMainPasswordDialog.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Fix invalid reference not changed after renaming `EnterMainPasswordDialog.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative language with `main` in `XenAdmin/Dialogs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Update class names in HelpManager.resx Following renaming of main password dialog. Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace negative language with `main` in `Metadata.cs` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Remove remaning negative language with `coordinator` from `Messages.resx` Used ReSharper renaming Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Remove remaning negative language with `other pool member` from `Messages.resx` Used ReSharper Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CA-34231: Replace remaining negative language in solution Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Remove commented out code in VNCGraphicsClient.cs Code has only been improved partially as it's not strictly relevant to the PR Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Amend negative word replacement in XSVNCScreen.cs Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Simplify debug call formatting in NewPoolDialog.cs Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Add code mistakenly removed in MainWindow.cs Removed as part of `f155f9c8` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Revert renaming of constant related to Windows' API Considered external to CH Center Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Amend hotkey for Coordinator field in `NewPoolDialog` Previous ALT+<key> hotkey was conflicting with CreatePool Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Remove unecessary whitespace in EvacuateHostDialog.cs Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Update if block to exclude unecessary else in DRFailoverWizard.cs Not relevant to the PR, but the change is small enought to no need extra testing Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Amend typo in PoolJoinRules.cs supporer -> supporter Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Replace missing negative language with `coordinator` in `XenAPI-Extensions/Pool.cs` Variables and methods XenAPI-Extensions were mistakenly skipped Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Replace negative language in `XenApi-Extensions` with `coordinator/interface` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Replace negative language in `XenApi-Extensions` with `supporter/member` Used ReSharper renaming utility. Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Replace remaining negative language in `XenServerHealthCheckBugTool.cs` This is only used to format the string Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Change line-endings to CRLF in `Page_CloudConfigParamters.cs` Done in order to fix merge conflict into master Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-34231: Amend misc negative language renaming typos `XenServerHealthCheckBugTool` and `XenServerHealthCheckService` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-08-31 12:31:16 +02:00
if (cmd.CanRun())
cmd.Run();
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
}
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
#endregion
CP-36392: Misc fixes to flagged Bugs (#2907) * CP-36392: Add several `null` checks All were flagged by SonarQube Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `SettingsUpdate` Added to `XenAdmin` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Collapse useless condition check Also use pattern matching for type cast Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Specify `namespace` for `ProduceConsumerQueue` Add to `XenAdmin.Actions` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Rename field in `BugToolPageSelectCapabilties` to avoid name clash Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Add explicit `null` check While the `null` check in `GraphDetailsDialog.cs` is not strictly necessary, it has been added to fix a SonarQube issue Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Remove unused field in `WlbPoolConfiguration.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Replace useless self-assignment with ad-hoc method Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Simplify dictionary key assignment in `WlbScheduledTask.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Fix minor formatting issues Add newline at end of file, and reformat content of if statement Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up latest flagged bugs changes - Fix whitespace/braces in a few affected files - Add missing null check in `ValueMaps.cs` - Check for args length in `RbacCollectorProxy.cs` - Fix logic in `MainWindow.cs` to revert to previous behaviour Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com> * CP-36392: Tidy up setter in `ChangeableList.cs` Also update whitespace inconsitencies in `PerfmonAlertEditPage.cs` and `VMHAEditPage.cs` Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
2021-12-21 16:53:46 +01:00
private class PriorityWrapper
{
CP-44767, CP-44766 & CP-44765: Refactor usage of VM restrictions and add `reference_label` to OVFs (#3211) * Tidy up `VM` extension: use `var` * Tidy up `VM` extension: remove redundant initialisers * Tidy up `VM` extension: use type keywords when possible * Tidy up `VM` extension: merge conditional expressions * Tidy up `VM` extension: remove redundant qualifiers * Tidy up `VM` extension: remove redundant type arguments * Tidy up `VM` extension: remove redundant `else`s and parentheses * Tidy up `VM` extension: fix naming * Tidy up `VM` extension: misc changes * Tidy up `VM` extension: use `null` propagation * Tidy up `VM` extension: fix whitespace * Tidy up `VM` extension: apply ReSharper Code Cleanup utility * Tidy up `VM` extension: Fix naming of private string array * CP-44767: Ignore VM restriction when fetching `MaxVCPUsAllowed` Instead, fetch the highest available value in all templates for the host. This means that VMs imported from vhd won't automatically default to `DEFAULT_NUM_VCPUS_ALLOWED`, and that VMs that have been kept across XenServer upgrades won't be limited to the number of vCPUs in their own (possibly outdated) restrictions * CP-44766: Use value in template with a matching `reference_label` when checking VM restrictions * Move restriction getters to own region * CP-44766: Use matching templates to fetch VM restrictions - Rewrite `GetRestrictions...` methods to perform simpler operations - Add `GetIntRestrictionValue` and `GetBoolRestrictionValue` wrappers to `GetRestrictionValueFromMatchingTemplate` - Now all calls to a restrictions first check the template value, with a fall-back to defaults * CP-44765: Export `reference-label` when generating OVFs --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
2023-09-29 04:45:17 +02:00
public readonly VM.HaRestartPriority Priority;
CP-44767, CP-44766 & CP-44765: Refactor usage of VM restrictions and add `reference_label` to OVFs (#3211) * Tidy up `VM` extension: use `var` * Tidy up `VM` extension: remove redundant initialisers * Tidy up `VM` extension: use type keywords when possible * Tidy up `VM` extension: merge conditional expressions * Tidy up `VM` extension: remove redundant qualifiers * Tidy up `VM` extension: remove redundant type arguments * Tidy up `VM` extension: remove redundant `else`s and parentheses * Tidy up `VM` extension: fix naming * Tidy up `VM` extension: misc changes * Tidy up `VM` extension: use `null` propagation * Tidy up `VM` extension: fix whitespace * Tidy up `VM` extension: apply ReSharper Code Cleanup utility * Tidy up `VM` extension: Fix naming of private string array * CP-44767: Ignore VM restriction when fetching `MaxVCPUsAllowed` Instead, fetch the highest available value in all templates for the host. This means that VMs imported from vhd won't automatically default to `DEFAULT_NUM_VCPUS_ALLOWED`, and that VMs that have been kept across XenServer upgrades won't be limited to the number of vCPUs in their own (possibly outdated) restrictions * CP-44766: Use value in template with a matching `reference_label` when checking VM restrictions * Move restriction getters to own region * CP-44766: Use matching templates to fetch VM restrictions - Rewrite `GetRestrictions...` methods to perform simpler operations - Add `GetIntRestrictionValue` and `GetBoolRestrictionValue` wrappers to `GetRestrictionValueFromMatchingTemplate` - Now all calls to a restrictions first check the template value, with a fall-back to defaults * CP-44765: Export `reference-label` when generating OVFs --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
2023-09-29 04:45:17 +02:00
public PriorityWrapper(VM.HaRestartPriority priority)
{
this.Priority = priority;
}
public override string ToString()
{
return Helpers.RestartPriorityI18n(this.Priority);
}
}
public void StartNtolUpdate()
{
haNtolIndicator.Visible = true;
haNtolIndicator.StartNtolUpdate();
}
}
}