2023-01-24 15:29:31 +01:00
|
|
|
|
/* Copyright (c) Cloud Software Group, Inc.
|
2013-06-24 13:41:48 +02:00
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms,
|
|
|
|
|
* with or without modification, are permitted provided
|
|
|
|
|
* that the following conditions are met:
|
|
|
|
|
*
|
|
|
|
|
* * Redistributions of source code must retain the above
|
|
|
|
|
* copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer.
|
|
|
|
|
* * Redistributions in binary form must reproduce the above
|
|
|
|
|
* copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer in the documentation and/or other
|
|
|
|
|
* materials provided with the distribution.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
|
|
|
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
|
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Windows.Forms;
|
2015-02-13 15:43:13 +01:00
|
|
|
|
using XenAdmin.Wizards.NewVMWizard;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
using XenAPI;
|
|
|
|
|
using XenAdmin.Actions;
|
|
|
|
|
using XenAdmin.SettingsPanels;
|
|
|
|
|
using XenAdmin.Controls;
|
|
|
|
|
using XenAdmin.Core;
|
|
|
|
|
using XenAdmin.Wizards.NewPolicyWizard;
|
|
|
|
|
using XenAdmin.Wizards.NewVMApplianceWizard;
|
|
|
|
|
using XenAdmin.Wizards.GenericPages;
|
2017-10-17 10:57:50 +02:00
|
|
|
|
using System.Linq;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
namespace XenAdmin.Dialogs
|
|
|
|
|
{
|
|
|
|
|
public partial class PropertiesDialog : VerticallyTabbedDialog
|
|
|
|
|
{
|
|
|
|
|
#region Tabs
|
2023-06-08 12:24:39 +02:00
|
|
|
|
private CpuMemoryEditPage VCpuMemoryEditPage;
|
2013-12-22 18:17:04 +01:00
|
|
|
|
private HostMultipathPage hostMultipathPage1;
|
|
|
|
|
private CustomFieldsDisplayPage CustomFieldsEditPage;
|
|
|
|
|
private LogDestinationEditPage LogDestinationEditPage;
|
|
|
|
|
private HomeServerEditPage HomeServerPage;
|
|
|
|
|
private BootOptionsEditPage StartupOptionsEditPage;
|
|
|
|
|
private VMAdvancedEditPage VMAdvancedEditPage;
|
|
|
|
|
private PerfmonAlertEditPage PerfmonAlertEditPage;
|
|
|
|
|
private EditNetworkPage editNetworkPage;
|
|
|
|
|
private VDISizeLocationPage vdiSizeLocation;
|
|
|
|
|
private VMHAEditPage VMHAEditPage;
|
|
|
|
|
private GeneralEditPage GeneralEditPage;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private UpsellPage PerfmonAlertUpsellEditPage;
|
|
|
|
|
private UpsellPage PerfmonAlertOptionsUpsellEditPage;
|
2013-12-22 18:17:04 +01:00
|
|
|
|
private PerfmonAlertOptionsPage PerfmonAlertOptionsEditPage;
|
|
|
|
|
private HostPowerONEditPage HostPowerONEditPage;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private NewPolicySnapshotFrequencyPage newPolicySnapshotFrequencyPage1;
|
2017-05-25 15:56:13 +02:00
|
|
|
|
private NewPolicySnapshotTypePage newPolicyVMSSTypePage1;
|
2016-01-27 11:36:48 +01:00
|
|
|
|
private NewVMGroupVMsPage<VMSS> newVMSSVMsPage1;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private NewVMGroupVMsPage<VM_appliance> newVMApplianceVMsPage1;
|
|
|
|
|
private NewVMApplianceVMOrderAndDelaysPage newVmApplianceVmOrderAndDelaysPage1;
|
|
|
|
|
private UpsellPage GpuUpsellEditPage;
|
|
|
|
|
private GpuEditPage GpuEditPage;
|
2013-12-22 18:17:04 +01:00
|
|
|
|
private PoolGpuEditPage PoolGpuEditPage;
|
2015-02-06 18:46:58 +01:00
|
|
|
|
private VMEnlightenmentEditPage VMEnlightenmentEditPage;
|
2015-02-13 15:43:13 +01:00
|
|
|
|
private Page_CloudConfigParameters CloudConfigParametersPage;
|
2015-08-19 09:53:15 +02:00
|
|
|
|
private SecurityEditPage SecurityEditPage;
|
2023-05-10 18:04:08 +02:00
|
|
|
|
private LivePatchingEditPage LivePatchingEditPage;
|
2017-09-27 14:37:17 +02:00
|
|
|
|
private USBEditPage usbEditPage;
|
2017-07-20 13:42:43 +02:00
|
|
|
|
private NetworkOptionsEditPage NetworkOptionsEditPage;
|
2017-12-01 15:47:50 +01:00
|
|
|
|
private ClusteringEditPage ClusteringEditPage;
|
2020-04-14 19:40:17 +02:00
|
|
|
|
private SrReadCachingEditPage SrReadCachingEditPage;
|
2022-12-15 21:28:54 +01:00
|
|
|
|
private PoolAdvancedEditPage _poolAdvancedEditPage;
|
2023-09-14 08:49:46 +02:00
|
|
|
|
private NRPEEditPage NRPEEditPage;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
#endregion
|
|
|
|
|
|
2023-06-01 04:15:25 +02:00
|
|
|
|
private readonly IXenObject _xenObjectBefore, _xenObjectCopy;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private AsyncAction _action;
|
|
|
|
|
private bool _startAction = true;
|
|
|
|
|
private System.Timers.Timer timer = new System.Timers.Timer();
|
|
|
|
|
|
|
|
|
|
public new event EventHandler<PropertiesDialogClosingEventArgs> FormClosing;
|
|
|
|
|
|
|
|
|
|
public PropertiesDialog(IXenObject xenObject)
|
|
|
|
|
: base(xenObject.Connection)
|
|
|
|
|
{
|
|
|
|
|
// xenObject must not be null. If this occurs, we shouldn't have offered Properties in the UI.
|
|
|
|
|
Debug.Assert(xenObject != null, "XenObject is null");
|
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
2023-06-01 04:15:25 +02:00
|
|
|
|
_xenObjectBefore = xenObject;
|
|
|
|
|
_xenObjectCopy = xenObject.Clone();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2023-06-01 04:15:25 +02:00
|
|
|
|
Name = string.Format("Edit{0}GeneralSettingsDialog", xenObject.GetType().Name);
|
|
|
|
|
Text = string.Format(Messages.PROPERTIES_DIALOG_TITLE, Helpers.GetName(xenObject));
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
if (!Application.RenderWithVisualStyles)
|
|
|
|
|
ContentPanel.BackColor = SystemColors.Control;
|
|
|
|
|
|
|
|
|
|
Build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Build()
|
|
|
|
|
{
|
|
|
|
|
var pool = Helpers.GetPoolOfOne(connection);
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
bool isHost = _xenObjectCopy is Host;
|
|
|
|
|
bool isVm = _xenObjectCopy is VM vm && !vm.is_a_snapshot;
|
|
|
|
|
bool isSr = _xenObjectCopy is SR;
|
|
|
|
|
bool isPool = _xenObjectCopy is Pool;
|
|
|
|
|
bool isVdi = _xenObjectCopy is VDI;
|
|
|
|
|
bool isNetwork = _xenObjectCopy is XenAPI.Network;
|
|
|
|
|
bool isPoolOrStandalone = isPool || (isHost && Helpers.GetPool(_xenObjectCopy.Connection) == null);
|
|
|
|
|
bool isVmAppliance = _xenObjectCopy is VM_appliance;
|
|
|
|
|
bool isVmss = _xenObjectCopy is VMSS;
|
2016-01-27 11:36:48 +01:00
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
ContentPanel.SuspendLayout();
|
|
|
|
|
verticalTabs.BeginUpdate();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
verticalTabs.Items.Clear();
|
|
|
|
|
|
|
|
|
|
ShowTab(GeneralEditPage = new GeneralEditPage());
|
|
|
|
|
|
2023-08-15 11:55:14 +02:00
|
|
|
|
if (!isVmAppliance && !isVmss)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
ShowTab(CustomFieldsEditPage = new CustomFieldsDisplayPage {AutoScroll = true});
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isVm)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2023-06-08 12:24:39 +02:00
|
|
|
|
ShowTab(VCpuMemoryEditPage = new CpuMemoryEditPage());
|
2013-06-24 13:41:48 +02:00
|
|
|
|
ShowTab(StartupOptionsEditPage = new BootOptionsEditPage());
|
2019-03-15 15:10:42 +01:00
|
|
|
|
VMHAEditPage = new VMHAEditPage();
|
|
|
|
|
VMHAEditPage.Populated += EditPage_Populated;
|
|
|
|
|
ShowTab(VMHAEditPage);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isVm || isHost || isSr)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2023-06-01 04:15:25 +02:00
|
|
|
|
if (Helpers.FeatureForbidden(_xenObjectCopy, Host.RestrictAlerts))
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2020-06-17 10:34:41 +02:00
|
|
|
|
PerfmonAlertUpsellEditPage = new UpsellPage
|
|
|
|
|
{
|
2020-06-18 02:20:29 +02:00
|
|
|
|
Image = Images.StaticImages._000_Alert2_h32bit_16,
|
2020-06-17 10:34:41 +02:00
|
|
|
|
Text = Messages.ALERTS,
|
2021-03-16 02:50:45 +01:00
|
|
|
|
BlurbText = Messages.UPSELL_BLURB_ALERTS
|
2020-06-17 10:34:41 +02:00
|
|
|
|
};
|
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
ShowTab(PerfmonAlertUpsellEditPage);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowTab(PerfmonAlertEditPage = new PerfmonAlertEditPage {AutoScroll = true});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isPoolOrStandalone)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2023-06-01 04:15:25 +02:00
|
|
|
|
if (Helpers.FeatureForbidden(_xenObjectCopy, Host.RestrictAlerts))
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2020-06-17 10:34:41 +02:00
|
|
|
|
PerfmonAlertOptionsUpsellEditPage = new UpsellPage
|
|
|
|
|
{
|
2020-06-18 02:20:29 +02:00
|
|
|
|
Image = Images.StaticImages._000_Email_h32bit_16,
|
2020-06-17 10:34:41 +02:00
|
|
|
|
Text = Messages.EMAIL_OPTIONS,
|
2021-03-16 02:50:45 +01:00
|
|
|
|
BlurbText = Messages.UPSELL_BLURB_ALERTS
|
2020-06-17 10:34:41 +02:00
|
|
|
|
};
|
2013-06-24 13:41:48 +02:00
|
|
|
|
ShowTab(PerfmonAlertOptionsUpsellEditPage);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowTab(PerfmonAlertOptionsEditPage = new PerfmonAlertOptionsPage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isHost)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
ShowTab(hostMultipathPage1 = new HostMultipathPage());
|
|
|
|
|
ShowTab(LogDestinationEditPage = new LogDestinationEditPage());
|
|
|
|
|
}
|
2023-06-13 14:06:34 +02:00
|
|
|
|
|
|
|
|
|
if (isHost || isPool)
|
2020-03-19 03:29:08 +01:00
|
|
|
|
ShowTab(HostPowerONEditPage = new HostPowerONEditPage());
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if ((isPoolOrStandalone && Helpers.VGpuCapability(_xenObjectCopy.Connection))
|
|
|
|
|
|| (isHost && ((Host)_xenObjectCopy).CanEnableDisableIntegratedGpu()))
|
2013-11-14 11:35:48 +01:00
|
|
|
|
{
|
2015-02-25 14:01:03 +01:00
|
|
|
|
ShowTab(PoolGpuEditPage = new PoolGpuEditPage());
|
2013-11-14 11:35:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isPoolOrStandalone && !Helpers.FeatureForbidden(_xenObjectCopy.Connection, Host.RestrictSslLegacySwitch) && !Helpers.StockholmOrGreater(connection))
|
2015-08-19 09:53:15 +02:00
|
|
|
|
ShowTab(SecurityEditPage = new SecurityEditPage());
|
|
|
|
|
|
2023-06-13 16:08:36 +02:00
|
|
|
|
if (isPoolOrStandalone && !Helpers.FeatureForbidden(_xenObjectCopy.Connection, Host.RestrictLivePatching) && !Helpers.CloudOrGreater(connection))
|
2023-05-10 18:04:08 +02:00
|
|
|
|
ShowTab(LivePatchingEditPage = new LivePatchingEditPage());
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isPoolOrStandalone && !Helpers.FeatureForbidden(_xenObjectCopy.Connection, Host.RestrictIGMPSnooping) && Helpers.GetCoordinator(pool).vSwitchNetworkBackend())
|
2017-07-20 13:42:43 +02:00
|
|
|
|
ShowTab(NetworkOptionsEditPage = new NetworkOptionsEditPage());
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isPoolOrStandalone && !Helpers.FeatureForbidden(_xenObjectCopy.Connection, Host.RestrictCorosync))
|
2017-12-01 15:47:50 +01:00
|
|
|
|
ShowTab(ClusteringEditPage = new ClusteringEditPage());
|
|
|
|
|
|
2023-06-13 16:08:36 +02:00
|
|
|
|
if (isPool && Helpers.CloudOrGreater(_xenObjectCopy.Connection) && Helpers.XapiEqualOrGreater_22_33_0(_xenObjectCopy.Connection))
|
2022-12-15 21:28:54 +01:00
|
|
|
|
ShowTab(_poolAdvancedEditPage = new PoolAdvancedEditPage());
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isNetwork)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
ShowTab(editNetworkPage = new EditNetworkPage());
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isVm)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2023-06-13 14:06:34 +02:00
|
|
|
|
var theVm = (VM)_xenObjectCopy;
|
|
|
|
|
|
|
|
|
|
if (!Helpers.WlbEnabledAndConfigured(_xenObjectCopy.Connection))
|
|
|
|
|
ShowTab(HomeServerPage = new HomeServerEditPage());
|
|
|
|
|
|
|
|
|
|
if (theVm.CanHaveGpu())
|
2015-10-26 17:01:55 +01:00
|
|
|
|
{
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (Helpers.FeatureForbidden(_xenObjectCopy, Host.RestrictGpu))
|
2020-06-17 10:34:41 +02:00
|
|
|
|
{
|
2023-06-13 14:06:34 +02:00
|
|
|
|
GpuUpsellEditPage = new UpsellPage
|
|
|
|
|
{
|
|
|
|
|
Image = Images.StaticImages._000_GetMemoryInfo_h32bit_16,
|
|
|
|
|
Text = Messages.GPU,
|
|
|
|
|
BlurbText = Messages.UPSELL_BLURB_GPU
|
|
|
|
|
};
|
|
|
|
|
ShowTab(GpuUpsellEditPage);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(Helpers.GpusAvailable(connection))
|
|
|
|
|
ShowTab(GpuEditPage = new GpuEditPage());
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (theVm.IsHVM())
|
|
|
|
|
{
|
|
|
|
|
if (!theVm.is_a_template && !Helpers.FeatureForbidden(_xenObjectCopy, Host.RestrictUsbPassthrough) &&
|
|
|
|
|
pool.Connection.Cache.Hosts.Any(host => host.PUSBs.Count > 0))
|
|
|
|
|
{
|
|
|
|
|
usbEditPage = new USBEditPage();
|
|
|
|
|
usbEditPage.Populated += EditPage_Populated;
|
|
|
|
|
ShowTab(usbEditPage);
|
|
|
|
|
}
|
2017-10-10 10:05:22 +02:00
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
ShowTab(VMAdvancedEditPage = new VMAdvancedEditPage());
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (Helpers.ContainerCapability(_xenObjectCopy.Connection))
|
|
|
|
|
{
|
|
|
|
|
if (theVm.CanBeEnlightened())
|
|
|
|
|
ShowTab(VMEnlightenmentEditPage = new VMEnlightenmentEditPage());
|
2015-02-06 18:46:58 +01:00
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (theVm.CanHaveCloudConfigDrive())
|
|
|
|
|
ShowTab(CloudConfigParametersPage = new Page_CloudConfigParameters());
|
|
|
|
|
}
|
2021-08-06 01:30:16 +02:00
|
|
|
|
}
|
2015-02-13 15:43:13 +01:00
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isVmss)
|
2016-01-27 11:36:48 +01:00
|
|
|
|
{
|
|
|
|
|
ShowTab(newVMSSVMsPage1 = new NewVMGroupVMsPage<VMSS> {Pool = pool});
|
2017-05-25 15:56:13 +02:00
|
|
|
|
ShowTab(newPolicyVMSSTypePage1 = new NewPolicySnapshotTypePage());
|
2019-03-15 15:10:42 +01:00
|
|
|
|
newPolicySnapshotFrequencyPage1 = new NewPolicySnapshotFrequencyPage {Connection = pool.Connection};
|
|
|
|
|
newPolicySnapshotFrequencyPage1.Populated += EditPage_Populated;
|
|
|
|
|
ShowTab(newPolicySnapshotFrequencyPage1);
|
2016-01-27 11:36:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isVmAppliance)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
ShowTab(newVMApplianceVMsPage1 = new NewVMGroupVMsPage<VM_appliance> { Pool = pool });
|
|
|
|
|
ShowTab(newVmApplianceVmOrderAndDelaysPage1 = new NewVMApplianceVMOrderAndDelaysPage { Pool = pool });
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isSr && ((SR)_xenObjectCopy).SupportsReadCaching() && !Helpers.FeatureForbidden(_xenObjectCopy, Host.RestrictReadCaching))
|
2020-04-14 19:40:17 +02:00
|
|
|
|
ShowTab(SrReadCachingEditPage = new SrReadCachingEditPage());
|
|
|
|
|
|
2023-06-13 14:06:34 +02:00
|
|
|
|
if (isVdi)
|
2022-12-15 21:28:54 +01:00
|
|
|
|
{
|
|
|
|
|
ShowTab(vdiSizeLocation = new VDISizeLocationPage());
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2023-06-01 04:15:25 +02:00
|
|
|
|
VDI vdi = _xenObjectCopy as VDI;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2022-12-15 21:28:54 +01:00
|
|
|
|
List<VBDEditPage> vbdEditPages = new List<VBDEditPage>();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2022-12-15 21:28:54 +01:00
|
|
|
|
foreach (VBD vbd in vdi.Connection.ResolveAll(vdi.VBDs))
|
|
|
|
|
{
|
|
|
|
|
VBDEditPage editPage = new VBDEditPage();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2022-12-15 21:28:54 +01:00
|
|
|
|
editPage.SetXenObjects(null, vbd);
|
|
|
|
|
vbdEditPages.Add(editPage);
|
|
|
|
|
ShowTab(editPage);
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2022-12-15 21:28:54 +01:00
|
|
|
|
if (vbdEditPages.Count <= 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
using (var dialog = new ActionProgressDialog(
|
|
|
|
|
new DelegatedAsyncAction(vdi.Connection, Messages.DEVICE_POSITION_SCANNING,
|
|
|
|
|
Messages.DEVICE_POSITION_SCANNING, Messages.DEVICE_POSITION_SCANNED,
|
|
|
|
|
delegate(Session session)
|
|
|
|
|
{
|
|
|
|
|
foreach (VBDEditPage page in vbdEditPages)
|
|
|
|
|
page.UpdateDevicePositions(session);
|
|
|
|
|
}),
|
|
|
|
|
ProgressBarStyle.Continuous))
|
|
|
|
|
{
|
|
|
|
|
dialog.ShowCancel = true;
|
|
|
|
|
dialog.ShowDialog(Program.MainWindow);
|
|
|
|
|
}
|
2016-06-20 14:17:42 +02:00
|
|
|
|
}
|
2023-10-16 10:59:33 +02:00
|
|
|
|
if (isPoolOrStandalone &&
|
2023-10-08 10:03:18 +02:00
|
|
|
|
(connection.Session.IsLocalSuperuser || connection.Session.Roles.Any(r => r.name_label == Role.MR_ROLE_POOL_ADMIN)))
|
2023-09-14 08:49:46 +02:00
|
|
|
|
{
|
2023-09-28 14:22:46 +02:00
|
|
|
|
NRPEEditPage = new NRPEEditPage();
|
2023-09-14 08:49:46 +02:00
|
|
|
|
ShowTab(NRPEEditPage);
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
ContentPanel.ResumeLayout();
|
|
|
|
|
verticalTabs.EndUpdate();
|
|
|
|
|
verticalTabs.SelectedIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ShowTab(IEditPage editPage)
|
|
|
|
|
{
|
|
|
|
|
var pageAsControl = (Control)editPage;
|
|
|
|
|
ContentPanel.Controls.Add(pageAsControl);
|
|
|
|
|
pageAsControl.BackColor = Color.Transparent;
|
|
|
|
|
pageAsControl.Dock = DockStyle.Fill;
|
|
|
|
|
|
2023-06-01 04:15:25 +02:00
|
|
|
|
editPage.SetXenObjects(_xenObjectBefore, _xenObjectCopy);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
verticalTabs.Items.Add(editPage);
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-15 15:10:42 +01:00
|
|
|
|
private void EditPage_Populated()
|
|
|
|
|
{
|
|
|
|
|
verticalTabs.Refresh();
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2022-12-19 16:12:45 +01:00
|
|
|
|
var changedPageExists = false;
|
|
|
|
|
|
|
|
|
|
foreach (IEditPage editPage in verticalTabs.Items)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2022-12-19 16:12:45 +01:00
|
|
|
|
if (!editPage.ValidToSave)
|
|
|
|
|
{
|
|
|
|
|
SelectPage(editPage);
|
|
|
|
|
|
|
|
|
|
editPage.ShowLocalValidationMessages();
|
|
|
|
|
DialogResult = DialogResult.None;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (editPage.HasChanged)
|
|
|
|
|
changedPageExists = true;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-19 16:12:45 +01:00
|
|
|
|
if (!changedPageExists)
|
2019-09-04 03:03:44 +02:00
|
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
// Yes, save to the LocalXenObject.
|
|
|
|
|
List<AsyncAction> actions = SaveSettings();
|
|
|
|
|
|
2020-03-13 16:22:45 +01:00
|
|
|
|
Program.Invoke(Program.MainWindow.GeneralPage, Program.MainWindow.GeneralPage.UpdateButtons);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
// Add a save changes on the beginning of the actions to enact the alterations that were just changes to the xenObjectCopy.
|
|
|
|
|
// Must come first because some pages' SaveChanges() rely on modifying the object via the xenObjectCopy before their actions are run.
|
|
|
|
|
|
2022-12-22 00:02:07 +01:00
|
|
|
|
int index = 0;
|
2023-06-01 04:15:25 +02:00
|
|
|
|
if (_xenObjectBefore is VMSS vmss && vmss.type != vmss_type.snapshot_with_quiesce)
|
2022-12-22 00:02:07 +01:00
|
|
|
|
index = actions.Count;
|
|
|
|
|
|
2023-06-01 04:15:25 +02:00
|
|
|
|
actions.Insert(index, new SaveChangesAction(_xenObjectCopy, true, _xenObjectBefore));
|
2018-07-13 11:22:20 +02:00
|
|
|
|
|
2023-06-01 04:15:25 +02:00
|
|
|
|
var objName = Helpers.GetName(_xenObjectBefore).Ellipsise(50);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
_action = new MultipleAction(
|
|
|
|
|
connection,
|
2018-07-13 11:22:20 +02:00
|
|
|
|
string.Format(Messages.UPDATE_PROPERTIES, objName),
|
2013-06-24 13:41:48 +02:00
|
|
|
|
Messages.UPDATING_PROPERTIES,
|
2018-07-13 11:22:20 +02:00
|
|
|
|
string.Format(Messages.UPDATED_PROPERTIES, objName),
|
2013-06-24 13:41:48 +02:00
|
|
|
|
actions);
|
2014-07-21 12:40:26 +02:00
|
|
|
|
|
2023-06-01 04:15:25 +02:00
|
|
|
|
_action.SetObject(_xenObjectCopy);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
_action.Completed += action_Completed;
|
|
|
|
|
Close();
|
|
|
|
|
|
|
|
|
|
if (_startAction)
|
|
|
|
|
{
|
2023-06-01 04:15:25 +02:00
|
|
|
|
_xenObjectBefore.Locked = true;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
_action.RunAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-05 15:28:21 +02:00
|
|
|
|
private void action_Completed(ActionBase sender)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2023-06-01 04:15:25 +02:00
|
|
|
|
_xenObjectBefore.Locked = false;
|
2020-03-13 16:22:45 +01:00
|
|
|
|
Program.Invoke(Program.MainWindow.GeneralPage, Program.MainWindow.GeneralPage.UpdateButtons);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-19 16:12:45 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Iterates through all of the tab pages, saving changes to their cloned XenObjects,
|
|
|
|
|
/// and accumulating and returning their Actions for further processing.
|
|
|
|
|
/// </summary>
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private List<AsyncAction> SaveSettings()
|
|
|
|
|
{
|
|
|
|
|
List<AsyncAction> actions = new List<AsyncAction>();
|
2015-08-19 10:35:51 +02:00
|
|
|
|
AsyncAction finalAction = null;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
foreach (IEditPage editPage in verticalTabs.Items)
|
|
|
|
|
{
|
|
|
|
|
if (!editPage.HasChanged)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
AsyncAction action = editPage.SaveSettings();
|
|
|
|
|
if (action == null)
|
|
|
|
|
continue;
|
|
|
|
|
|
2015-08-19 10:35:51 +02:00
|
|
|
|
if (action is SetSslLegacyAction)
|
|
|
|
|
finalAction = action; // annoying special case: SetSslLegacyAction must be last because it will disrupt the connection and we may lose later actions
|
|
|
|
|
else
|
|
|
|
|
actions.Add(action);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-19 10:35:51 +02:00
|
|
|
|
if (finalAction != null)
|
|
|
|
|
actions.Add(finalAction);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
return actions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.DialogResult = DialogResult.Cancel;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected sealed override void OnFormClosing(FormClosingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
foreach (IEditPage editPage in verticalTabs.Items)
|
|
|
|
|
{
|
|
|
|
|
editPage.Cleanup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var args = new PropertiesDialogClosingEventArgs(_action, _startAction);
|
|
|
|
|
|
|
|
|
|
OnFormClosing(args);
|
|
|
|
|
|
|
|
|
|
_startAction = args.StartAction;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void OnFormClosing(PropertiesDialogClosingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var handler = FormClosing;
|
|
|
|
|
|
|
|
|
|
if (handler != null)
|
|
|
|
|
{
|
|
|
|
|
handler(this, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void verticalTabs_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2017-05-25 15:56:13 +02:00
|
|
|
|
var snapshotTypePage = verticalTabs.SelectedItem as NewPolicySnapshotTypePage;
|
|
|
|
|
if (snapshotTypePage != null)
|
2016-10-24 02:29:01 +02:00
|
|
|
|
{
|
|
|
|
|
newPolicyVMSSTypePage1.ToggleQuiesceCheckBox(newVMSSVMsPage1.SelectedVMs);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
var vmApplianceStartOrderPage = verticalTabs.SelectedItem as NewVMApplianceVMOrderAndDelaysPage;
|
|
|
|
|
if (vmApplianceStartOrderPage != null && newVMApplianceVMsPage1 != null)
|
|
|
|
|
{
|
|
|
|
|
vmApplianceStartOrderPage.SetSelectedVMs(newVMApplianceVMsPage1.SelectedVMs);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-14 13:38:00 +01:00
|
|
|
|
if (verticalTabs.SelectedItem == VMHAEditPage)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2013-11-14 13:38:00 +01:00
|
|
|
|
VMHAEditPage.StartNtolUpdate();
|
|
|
|
|
if (GpuEditPage != null)
|
|
|
|
|
{
|
2019-04-15 20:47:32 +02:00
|
|
|
|
VMHAEditPage.VGpus = GpuEditPage.VGpus;
|
2013-11-14 13:38:00 +01:00
|
|
|
|
VMHAEditPage.RefillPrioritiesComboBox();
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (verticalTabs.SelectedItem == GpuEditPage && VMHAEditPage != null)
|
|
|
|
|
{
|
|
|
|
|
GpuEditPage.SelectedPriority = VMHAEditPage.SelectedPriority;
|
|
|
|
|
GpuEditPage.ShowHideWarnings();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
2017-10-10 10:05:22 +02:00
|
|
|
|
|
|
|
|
|
if (verticalTabs.SelectedItem == usbEditPage && VMHAEditPage != null)
|
|
|
|
|
{
|
|
|
|
|
usbEditPage.SelectedPriority = VMHAEditPage.SelectedPriority;
|
|
|
|
|
usbEditPage.ShowHideWarnings();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-03-19 03:29:08 +01:00
|
|
|
|
|
|
|
|
|
if (verticalTabs.SelectedItem == HostPowerONEditPage)
|
|
|
|
|
{
|
|
|
|
|
HostPowerONEditPage.LoadPowerOnMode();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-08-23 11:34:46 +02:00
|
|
|
|
|
|
|
|
|
HideToolTips();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void HideToolTips()
|
|
|
|
|
{
|
|
|
|
|
foreach (IEditPage page in verticalTabs.Items)
|
|
|
|
|
{
|
|
|
|
|
page.HideLocalValidationMessages();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-31 11:58:02 +02:00
|
|
|
|
private void PropertiesDialog_Move(object sender, EventArgs e)
|
2021-08-23 11:34:46 +02:00
|
|
|
|
{
|
|
|
|
|
HideToolTips();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PropertiesDialog_FormClosed(object sender, FormClosedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
timer.Stop();
|
|
|
|
|
}
|
2013-12-22 16:28:00 +01:00
|
|
|
|
|
2013-12-22 18:17:04 +01:00
|
|
|
|
#region Select page methods
|
|
|
|
|
|
2013-12-30 13:46:56 +01:00
|
|
|
|
public void EditName()
|
2013-12-22 18:17:04 +01:00
|
|
|
|
{
|
|
|
|
|
SelectPage(GeneralEditPage);
|
2013-12-30 13:46:56 +01:00
|
|
|
|
GeneralEditPage.SelectName();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void EditDescription()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(GeneralEditPage);
|
|
|
|
|
GeneralEditPage.SelectDescription();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void EditIqn()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(GeneralEditPage);
|
|
|
|
|
GeneralEditPage.SelectIqn();
|
2013-12-22 18:17:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SelectCustomFieldsEditPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(CustomFieldsEditPage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SelectPoolGpuEditPage()
|
|
|
|
|
{
|
2014-09-29 14:14:05 +02:00
|
|
|
|
SelectPage(PoolGpuEditPage);
|
2013-12-22 18:17:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-22 16:28:00 +01:00
|
|
|
|
public void SelectPerfmonAlertEditPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(PerfmonAlertEditPage);
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-22 18:17:04 +01:00
|
|
|
|
public void SelectStartupOptionsEditPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(StartupOptionsEditPage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SelectHomeServerEditPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(HomeServerPage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SelectLogDestinationEditPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(LogDestinationEditPage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SelectVMHAEditPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(VMHAEditPage);
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 14:50:13 +02:00
|
|
|
|
public void SelectVMCPUEditPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(VCpuMemoryEditPage);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-14 14:51:51 +02:00
|
|
|
|
public void SelectVdiSizeLocationPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(vdiSizeLocation);
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-12 14:36:09 +01:00
|
|
|
|
public void SelectClusteringEditPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(ClusteringEditPage);
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-22 16:28:00 +01:00
|
|
|
|
#endregion
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class PropertiesDialogClosingEventArgs : EventArgs
|
|
|
|
|
{
|
|
|
|
|
public AsyncAction Action { get; private set; }
|
|
|
|
|
public bool StartAction { get; set; }
|
|
|
|
|
public PropertiesDialogClosingEventArgs(AsyncAction action, bool startAction)
|
|
|
|
|
{
|
|
|
|
|
StartAction = startAction;
|
|
|
|
|
Action = action;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|