Merge branch 'master' into feature/merge

Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>

# Conflicts:
#	XenAdmin/Dialogs/PropertiesDialog.cs
This commit is contained in:
Konstantina Chremmou 2023-06-13 15:08:36 +01:00
commit 6d83365cfc
44 changed files with 2832 additions and 3442 deletions

View File

@ -88,7 +88,9 @@ namespace XenAdmin.Commands
}
foreach (var app in appsToStart)
(new StartApplianceAction(app, false)).RunAsync();
{
new StartApplianceAction(app, false).RunAsync();
}
}
private bool CanStartAppliance(VM_appliance app)

View File

@ -52,6 +52,7 @@ namespace XenAdmin.Controls.Ballooning
amount = Util.CorrectRoundingErrors(amount);
Units = static_max <= Util.BINARY_GIGA ? Messages.VAL_MEGB : Messages.VAL_GIGB;
ChangeSpinnerSettings();
previousUnitsValue = Units;
Initialize(amount, RoundingBehaviour.None);

View File

@ -30,6 +30,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
@ -222,6 +223,7 @@ namespace XenAdmin.Controls.Ballooning
protected void DrawGrid(Graphics g, Rectangle barArea, double bytesPerPixel, double max)
{
Debug.Assert(max > 0, "Memory value should be larger than zero");
const int min_gap = 40; // min gap between consecutive labels (which are on alternate ticks)
const int line_height = 12;
@ -236,15 +238,15 @@ namespace XenAdmin.Controls.Ballooning
int text_top = text_bottom - labelSize.Height;
// Calculate a suitable increment
long incr = Util.BINARY_MEGA / 2;
while((double)incr / bytesPerPixel * 2 < min_gap + longest)
var incr = Util.BINARY_MEGA / 2.0;
while(incr / bytesPerPixel * 2 < min_gap + longest)
incr *= 2;
// Draw the grid
using (Pen pen = new Pen(Grid))
{
bool withLabel = true;
for (long x = 0; x <= max; x += incr)
for (var x = 0.0; x <= max; x += incr)
{
// Tick
int pos = barArea.Left + (int)((double)x / bytesPerPixel);
@ -257,7 +259,7 @@ namespace XenAdmin.Controls.Ballooning
Size size = Drawing.MeasureText(g, label, Program.DefaultFont);
Rectangle rect = new Rectangle(new Point(pos - size.Width/2, text_top), size);
if (LabelShouldBeShown(max, label, x))
if (LabelShouldBeShown(max, x))
{
Drawing.DrawText(g, label, Program.DefaultFont, rect, Grid, Color.Transparent);
}
@ -273,10 +275,9 @@ namespace XenAdmin.Controls.Ballooning
/// 2. If the maximum is greater than 1 GB, then show only the labels that are a multiple of half a GB.
/// </summary>
/// <param name="max"></param>
/// <param name="label"></param>
/// <param name="x"></param>
/// <returns></returns>
private static bool LabelShouldBeShown(double max, string label, long x)
private static bool LabelShouldBeShown(double max, double x)
{
return max <= Util.BINARY_GIGA || (x % (0.5 * Util.BINARY_GIGA)) == 0;
}

View File

@ -82,10 +82,11 @@ namespace XenAdmin.Core
/// <param name="f">The form to be brought to the front.</param>
public static void BringFormToFront(Form f)
{
if (f == null)
return;
if (f.WindowState == FormWindowState.Minimized)
{
f.WindowState = FormWindowState.Normal;
}
f.BringToFront();
f.Activate();

View File

@ -172,7 +172,7 @@ namespace XenAdmin.Dialogs
{
conn.Hostname = server;
conn.Port = ConnectionsManager.DEFAULT_XEN_PORT;
XenConnectionUI.ConnectToXapiDatabase(conn, this);
XenConnectionUI.ConnectToXapiDatabase(conn, Owner);
}
else if (!_changedPass)
{

View File

@ -242,7 +242,7 @@ namespace XenAdmin.Dialogs
vbd.unpluggable = true;
// Try to hot plug the VBD.
var action = new VbdSaveAndPlugAction(TheVM, vbd, TheVDI.Name(), null, false);
var action = new VbdCreateAndPlugAction(TheVM, vbd, TheVDI.Name(), false);
action.ShowUserInstruction += Action_ShowUserInstruction;
action.RunAsync();
});

View File

@ -150,6 +150,7 @@ namespace XenAdmin.Dialogs
}
SR sr = srPicker.SR;
var actions = new List<AsyncAction>();
if (!sr.shared && _vm != null && _vm.HaPriorityIsRestart())
{
@ -160,32 +161,26 @@ namespace XenAdmin.Dialogs
return;
}
new HAUnprotectVMAction(_vm).RunSync(_vm.Connection.Session);
actions.Add(new HAUnprotectVMAction(_vm));
}
if (_vm != null)
{
//note that this action alters the Device
var action = new CreateDiskAction(Disk, Device, _vm);
using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks))
dialog.ShowDialog();
if (!action.Succeeded)
return;
actions.Add(new CreateDiskAction(Disk, Device, _vm));
// Now try to plug the VBD.
var plugAction = new VbdSaveAndPlugAction(_vm, Device, Disk.Name(), _vm.Connection.Session, false);
var plugAction = new VbdCreateAndPlugAction(_vm, Device, Disk.Name(), false);
plugAction.ShowUserInstruction += PlugAction_ShowUserInstruction;
plugAction.RunAsync();
actions.Add(plugAction);
}
else
{
var action = new CreateDiskAction(Disk);
using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
dialog.ShowDialog();
if (!action.Succeeded)
return;
actions.Add(new CreateDiskAction(Disk));
}
new MultipleAction(connection, "", "", "", actions, true, true, true).RunAsync();
DialogResult = DialogResult.OK;
Close();
}

View File

@ -49,7 +49,7 @@ namespace XenAdmin.Dialogs
public partial class PropertiesDialog : VerticallyTabbedDialog
{
#region Tabs
private CPUMemoryEditPage VCpuMemoryEditPage;
private CpuMemoryEditPage VCpuMemoryEditPage;
private HostMultipathPage hostMultipathPage1;
private CustomFieldsDisplayPage CustomFieldsEditPage;
private LogDestinationEditPage LogDestinationEditPage;
@ -84,7 +84,7 @@ namespace XenAdmin.Dialogs
private PoolAdvancedEditPage _poolAdvancedEditPage;
#endregion
private IXenObject xenObject, xenObjectBefore, xenObjectCopy;
private readonly IXenObject _xenObjectBefore, _xenObjectCopy;
private AsyncAction _action;
private bool _startAction = true;
private System.Timers.Timer timer = new System.Timers.Timer();
@ -99,12 +99,11 @@ namespace XenAdmin.Dialogs
InitializeComponent();
this.xenObject = xenObject;
xenObjectBefore = xenObject.Clone();
xenObjectCopy = xenObject.Clone();
_xenObjectBefore = xenObject;
_xenObjectCopy = xenObject.Clone();
Name = String.Format("Edit{0}GeneralSettingsDialog", xenObject.GetType().Name);
Text = String.Format(Messages.PROPERTIES_DIALOG_TITLE, Helpers.GetName(xenObject));
Name = string.Format("Edit{0}GeneralSettingsDialog", xenObject.GetType().Name);
Text = string.Format(Messages.PROPERTIES_DIALOG_TITLE, Helpers.GetName(xenObject));
if (!Application.RenderWithVisualStyles)
ContentPanel.BackColor = SystemColors.Control;
@ -116,25 +115,15 @@ namespace XenAdmin.Dialogs
{
var pool = Helpers.GetPoolOfOne(connection);
bool is_host = xenObjectCopy is Host;
bool is_vm = xenObjectCopy is VM && !((VM)xenObjectCopy).is_a_snapshot;
bool is_sr = xenObjectCopy is SR;
bool is_pool = xenObjectCopy is Pool;
bool is_vdi = xenObjectCopy is VDI;
bool is_network = xenObjectCopy is XenAPI.Network;
bool is_hvm = is_vm && ((VM)xenObjectCopy).IsHVM();
bool is_template = is_vm && ((VM)xenObjectCopy).is_a_template;
bool is_in_pool = Helpers.GetPool(xenObjectCopy.Connection) != null;
bool is_pool_or_standalone = is_pool || (is_host && !is_in_pool);
bool wlb_enabled = (Helpers.WlbEnabledAndConfigured(xenObjectCopy.Connection));
bool is_VM_appliance = xenObjectCopy is VM_appliance;
bool is_VMSS = xenObjectCopy is VMSS;
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;
ContentPanel.SuspendLayout();
verticalTabs.BeginUpdate();
@ -145,21 +134,21 @@ namespace XenAdmin.Dialogs
ShowTab(GeneralEditPage = new GeneralEditPage());
if (!is_VM_appliance)
if (!isVmAppliance)
ShowTab(CustomFieldsEditPage = new CustomFieldsDisplayPage {AutoScroll = true});
if (is_vm)
if (isVm)
{
ShowTab(VCpuMemoryEditPage = new CPUMemoryEditPage());
ShowTab(VCpuMemoryEditPage = new CpuMemoryEditPage());
ShowTab(StartupOptionsEditPage = new BootOptionsEditPage());
VMHAEditPage = new VMHAEditPage();
VMHAEditPage.Populated += EditPage_Populated;
ShowTab(VMHAEditPage);
}
if (is_vm || is_host || is_sr)
if (isVm || isHost || isSr)
{
if (Helpers.FeatureForbidden(xenObjectCopy, Host.RestrictAlerts))
if (Helpers.FeatureForbidden(_xenObjectCopy, Host.RestrictAlerts))
{
PerfmonAlertUpsellEditPage = new UpsellPage
{
@ -176,9 +165,9 @@ namespace XenAdmin.Dialogs
}
}
if (is_pool_or_standalone)
if (isPoolOrStandalone)
{
if (Helpers.FeatureForbidden(xenObjectCopy, Host.RestrictAlerts))
if (Helpers.FeatureForbidden(_xenObjectCopy, Host.RestrictAlerts))
{
PerfmonAlertOptionsUpsellEditPage = new UpsellPage
{
@ -194,84 +183,89 @@ namespace XenAdmin.Dialogs
}
}
if (is_host)
if (isHost)
{
ShowTab(hostMultipathPage1 = new HostMultipathPage());
ShowTab(LogDestinationEditPage = new LogDestinationEditPage());
}
if (is_host || is_pool)
if (isHost || isPool)
ShowTab(HostPowerONEditPage = new HostPowerONEditPage());
if ((is_pool_or_standalone && Helpers.VGpuCapability(xenObjectCopy.Connection))
|| (is_host && ((Host)xenObjectCopy).CanEnableDisableIntegratedGpu()))
if ((isPoolOrStandalone && Helpers.VGpuCapability(_xenObjectCopy.Connection))
|| (isHost && ((Host)_xenObjectCopy).CanEnableDisableIntegratedGpu()))
{
ShowTab(PoolGpuEditPage = new PoolGpuEditPage());
}
if (is_pool_or_standalone && !Helpers.FeatureForbidden(xenObject.Connection, Host.RestrictSslLegacySwitch) && !Helpers.StockholmOrGreater(connection))
if (isPoolOrStandalone && !Helpers.FeatureForbidden(_xenObjectCopy.Connection, Host.RestrictSslLegacySwitch) && !Helpers.StockholmOrGreater(connection))
ShowTab(SecurityEditPage = new SecurityEditPage());
if (is_pool_or_standalone && !Helpers.FeatureForbidden(xenObject.Connection, Host.RestrictLivePatching) && !Helpers.CloudOrGreater(connection))
if (isPoolOrStandalone && !Helpers.FeatureForbidden(_xenObjectCopy.Connection, Host.RestrictLivePatching) && !Helpers.CloudOrGreater(connection))
ShowTab(LivePatchingEditPage = new LivePatchingEditPage());
if (is_pool_or_standalone && !Helpers.FeatureForbidden(xenObject.Connection, Host.RestrictIGMPSnooping) && Helpers.GetCoordinator(pool).vSwitchNetworkBackend())
if (isPoolOrStandalone && !Helpers.FeatureForbidden(_xenObjectCopy.Connection, Host.RestrictIGMPSnooping) && Helpers.GetCoordinator(pool).vSwitchNetworkBackend())
ShowTab(NetworkOptionsEditPage = new NetworkOptionsEditPage());
if (is_pool_or_standalone && !Helpers.FeatureForbidden(xenObject.Connection, Host.RestrictCorosync))
if (isPoolOrStandalone && !Helpers.FeatureForbidden(_xenObjectCopy.Connection, Host.RestrictCorosync))
ShowTab(ClusteringEditPage = new ClusteringEditPage());
if (is_pool && Helpers.CloudOrGreater(xenObject.Connection) && Helpers.XapiEqualOrGreater_22_33_0(xenObject.Connection))
if (isPool && Helpers.CloudOrGreater(_xenObjectCopy.Connection) && Helpers.XapiEqualOrGreater_22_33_0(_xenObjectCopy.Connection))
ShowTab(_poolAdvancedEditPage = new PoolAdvancedEditPage());
if (is_network)
if (isNetwork)
ShowTab(editNetworkPage = new EditNetworkPage());
if (is_vm && !wlb_enabled)
ShowTab(HomeServerPage = new HomeServerEditPage());
if (is_vm && ((VM)xenObjectCopy).CanHaveGpu())
if (isVm)
{
if (Helpers.FeatureForbidden(xenObjectCopy, Host.RestrictGpu))
var theVm = (VM)_xenObjectCopy;
if (!Helpers.WlbEnabledAndConfigured(_xenObjectCopy.Connection))
ShowTab(HomeServerPage = new HomeServerEditPage());
if (theVm.CanHaveGpu())
{
GpuUpsellEditPage = new UpsellPage
if (Helpers.FeatureForbidden(_xenObjectCopy, Host.RestrictGpu))
{
Image = Images.StaticImages._000_GetMemoryInfo_h32bit_16,
Text = Messages.GPU,
BlurbText = Messages.UPSELL_BLURB_GPU
};
ShowTab(GpuUpsellEditPage);
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());
}
}
else
if (theVm.IsHVM())
{
if(Helpers.GpusAvailable(connection))
ShowTab(GpuEditPage = new GpuEditPage());
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);
}
ShowTab(VMAdvancedEditPage = new VMAdvancedEditPage());
}
if (Helpers.ContainerCapability(_xenObjectCopy.Connection))
{
if (theVm.CanBeEnlightened())
ShowTab(VMEnlightenmentEditPage = new VMEnlightenmentEditPage());
if (theVm.CanHaveCloudConfigDrive())
ShowTab(CloudConfigParametersPage = new Page_CloudConfigParameters());
}
}
if (is_hvm && !is_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);
}
if (is_hvm)
{
ShowTab(VMAdvancedEditPage = new VMAdvancedEditPage());
}
if (is_vm && Helpers.ContainerCapability(xenObject.Connection))
{
if (((VM)xenObjectCopy).CanBeEnlightened())
ShowTab(VMEnlightenmentEditPage = new VMEnlightenmentEditPage());
if (((VM)xenObjectCopy).CanHaveCloudConfigDrive())
ShowTab(CloudConfigParametersPage = new Page_CloudConfigParameters());
}
if (is_VMSS)
if (isVmss)
{
ShowTab(newVMSSVMsPage1 = new NewVMGroupVMsPage<VMSS> {Pool = pool});
ShowTab(newPolicyVMSSTypePage1 = new NewPolicySnapshotTypePage());
@ -280,20 +274,20 @@ namespace XenAdmin.Dialogs
ShowTab(newPolicySnapshotFrequencyPage1);
}
if (is_VM_appliance)
if (isVmAppliance)
{
ShowTab(newVMApplianceVMsPage1 = new NewVMGroupVMsPage<VM_appliance> { Pool = pool });
ShowTab(newVmApplianceVmOrderAndDelaysPage1 = new NewVMApplianceVMOrderAndDelaysPage { Pool = pool });
}
if (is_sr && ((SR)xenObjectCopy).SupportsReadCaching() && !Helpers.FeatureForbidden(xenObjectCopy, Host.RestrictReadCaching))
if (isSr && ((SR)_xenObjectCopy).SupportsReadCaching() && !Helpers.FeatureForbidden(_xenObjectCopy, Host.RestrictReadCaching))
ShowTab(SrReadCachingEditPage = new SrReadCachingEditPage());
if (is_vdi)
if (isVdi)
{
ShowTab(vdiSizeLocation = new VDISizeLocationPage());
VDI vdi = xenObjectCopy as VDI;
VDI vdi = _xenObjectCopy as VDI;
List<VBDEditPage> vbdEditPages = new List<VBDEditPage>();
@ -339,7 +333,7 @@ namespace XenAdmin.Dialogs
pageAsControl.BackColor = Color.Transparent;
pageAsControl.Dock = DockStyle.Fill;
editPage.SetXenObjects(xenObject, xenObjectCopy);
editPage.SetXenObjects(_xenObjectBefore, _xenObjectCopy);
verticalTabs.Items.Add(editPage);
}
@ -382,12 +376,12 @@ namespace XenAdmin.Dialogs
// Must come first because some pages' SaveChanges() rely on modifying the object via the xenObjectCopy before their actions are run.
int index = 0;
if (xenObjectBefore is VMSS vmss && vmss.type != vmss_type.snapshot_with_quiesce)
if (_xenObjectBefore is VMSS vmss && vmss.type != vmss_type.snapshot_with_quiesce)
index = actions.Count;
actions.Insert(index, new SaveChangesAction(xenObjectCopy, true, xenObjectBefore));
actions.Insert(index, new SaveChangesAction(_xenObjectCopy, true, _xenObjectBefore));
var objName = Helpers.GetName(xenObject).Ellipsise(50);
var objName = Helpers.GetName(_xenObjectBefore).Ellipsise(50);
_action = new MultipleAction(
connection,
string.Format(Messages.UPDATE_PROPERTIES, objName),
@ -395,21 +389,21 @@ namespace XenAdmin.Dialogs
string.Format(Messages.UPDATED_PROPERTIES, objName),
actions);
_action.SetObject(xenObjectCopy);
_action.SetObject(_xenObjectCopy);
_action.Completed += action_Completed;
Close();
if (_startAction)
{
xenObject.Locked = true;
_xenObjectBefore.Locked = true;
_action.RunAsync();
}
}
private void action_Completed(ActionBase sender)
{
xenObject.Locked = false;
_xenObjectBefore.Locked = false;
Program.Invoke(Program.MainWindow.GeneralPage, Program.MainWindow.GeneralPage.UpdateButtons);
}

View File

@ -35,6 +35,7 @@ using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Text;
@ -116,7 +117,6 @@ namespace XenAdmin
private readonly Dictionary<IXenConnection, IList<Form>> activePoolWizards = new Dictionary<IXenConnection, IList<Form>>();
private string[] _commandLineArgs;
private bool _launched;
private static readonly System.Windows.Forms.Timer CheckForUpdatesTimer = new System.Windows.Forms.Timer();
@ -738,13 +738,10 @@ namespace XenAdmin
Password = args.Length > 3 ? args[3] : ""
};
if (ConnectionsManager.XenConnectionsContains(connection))
break;
lock (ConnectionsManager.ConnectionsLock)
ConnectionsManager.XenConnections.Add(connection);
XenConnectionUI.BeginConnect(connection, true, null, false);
if (File.Exists(args[1]))
XenConnectionUI.ConnectToXapiDatabase(connection, this);
else
XenConnectionUI.BeginConnect(connection, true, this, false);
break;
default:
log.Warn("CLI: Wrong syntax or unknown command line options.");
@ -752,14 +749,7 @@ namespace XenAdmin
}
}
if (_launched)
{
// if already running, draw the user's attention
HelpersGUI.BringFormToFront(this);
Activate();
}
_launched = true;
HelpersGUI.BringFormToFront(this);
}
#endregion

View File

@ -1,6 +1,6 @@
namespace XenAdmin.SettingsPanels
{
partial class CPUMemoryEditPage
partial class CpuMemoryEditPage
{
/// <summary>
/// Required designer variable.
@ -28,34 +28,36 @@ namespace XenAdmin.SettingsPanels
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CPUMemoryEditPage));
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CpuMemoryEditPage));
this.lblSliderHighest = new System.Windows.Forms.Label();
this.lblSliderNormal = new System.Windows.Forms.Label();
this.lblSliderLowest = new System.Windows.Forms.Label();
this.lblPriority = new System.Windows.Forms.Label();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.warningsTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.cpuWarningPictureBox = new System.Windows.Forms.PictureBox();
this.cpuWarningLabel = new System.Windows.Forms.Label();
this.topologyWarningLabel = new System.Windows.Forms.Label();
this.topologyPictureBox = new System.Windows.Forms.PictureBox();
this.comboBoxInitialVCPUs = new System.Windows.Forms.ComboBox();
this.labelInitialVCPUs = new System.Windows.Forms.Label();
this.labelInvalidVCPUWarning = new System.Windows.Forms.Label();
this.comboBoxTopology = new XenAdmin.Controls.CPUTopologyComboBox();
this.labelTopology = new System.Windows.Forms.Label();
this.MemWarningLabel = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.lblMB = new System.Windows.Forms.Label();
this.nudMemory = new System.Windows.Forms.NumericUpDown();
this.panel1 = new System.Windows.Forms.Panel();
this.transparentTrackBar1 = new XenAdmin.Controls.TransparentTrackBar();
this.lblVCPUs = new System.Windows.Forms.Label();
this.lblVcpuWarning = new System.Windows.Forms.LinkLabel();
this.lblMemory = new System.Windows.Forms.Label();
this.VCPUWarningLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.comboBoxVCPUs = new System.Windows.Forms.ComboBox();
this.initialVCPUWarningLabel = new System.Windows.Forms.Label();
this.tableLayoutPanelInfo = new System.Windows.Forms.TableLayoutPanel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.labelInfo = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudMemory)).BeginInit();
this.warningsTableLayoutPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cpuWarningPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.topologyPictureBox)).BeginInit();
this.panel1.SuspendLayout();
this.tableLayoutPanelInfo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// lblSliderHighest
@ -76,31 +78,60 @@ namespace XenAdmin.SettingsPanels
// lblPriority
//
resources.ApplyResources(this.lblPriority, "lblPriority");
this.tableLayoutPanel1.SetColumnSpan(this.lblPriority, 4);
this.tableLayoutPanel1.SetColumnSpan(this.lblPriority, 3);
this.lblPriority.Name = "lblPriority";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
this.tableLayoutPanel1.Controls.Add(this.initialVCPUWarningLabel, 2, 6);
this.tableLayoutPanel1.Controls.Add(this.comboBoxInitialVCPUs, 1, 6);
this.tableLayoutPanel1.Controls.Add(this.labelInitialVCPUs, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.labelInvalidVCPUWarning, 1, 5);
this.tableLayoutPanel1.Controls.Add(this.comboBoxTopology, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.labelTopology, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.MemWarningLabel, 3, 10);
this.tableLayoutPanel1.Controls.Add(this.panel2, 1, 10);
this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 9);
this.tableLayoutPanel1.Controls.Add(this.lblPriority, 0, 8);
this.tableLayoutPanel1.Controls.Add(this.warningsTableLayoutPanel, 0, 7);
this.tableLayoutPanel1.Controls.Add(this.comboBoxInitialVCPUs, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.labelInitialVCPUs, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.comboBoxTopology, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.labelTopology, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.lblPriority, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.lblVCPUs, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.lblVcpuWarning, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.lblMemory, 0, 10);
this.tableLayoutPanel1.Controls.Add(this.VCPUWarningLabel, 2, 2);
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.comboBoxVCPUs, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanelInfo, 0, 1);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
//
// warningsTableLayoutPanel
//
resources.ApplyResources(this.warningsTableLayoutPanel, "warningsTableLayoutPanel");
this.tableLayoutPanel1.SetColumnSpan(this.warningsTableLayoutPanel, 3);
this.warningsTableLayoutPanel.Controls.Add(this.cpuWarningPictureBox, 0, 0);
this.warningsTableLayoutPanel.Controls.Add(this.cpuWarningLabel, 1, 0);
this.warningsTableLayoutPanel.Controls.Add(this.topologyWarningLabel, 0, 2);
this.warningsTableLayoutPanel.Controls.Add(this.topologyPictureBox, 0, 2);
this.warningsTableLayoutPanel.Name = "warningsTableLayoutPanel";
//
// cpuWarningPictureBox
//
this.cpuWarningPictureBox.Image = global::XenAdmin.Properties.Resources._000_Alert2_h32bit_16;
resources.ApplyResources(this.cpuWarningPictureBox, "cpuWarningPictureBox");
this.cpuWarningPictureBox.Name = "cpuWarningPictureBox";
this.cpuWarningPictureBox.TabStop = false;
//
// cpuWarningLabel
//
resources.ApplyResources(this.cpuWarningLabel, "cpuWarningLabel");
this.cpuWarningLabel.Name = "cpuWarningLabel";
//
// topologyWarningLabel
//
resources.ApplyResources(this.topologyWarningLabel, "topologyWarningLabel");
this.topologyWarningLabel.Name = "topologyWarningLabel";
//
// topologyPictureBox
//
this.topologyPictureBox.Image = global::XenAdmin.Properties.Resources._000_Alert2_h32bit_16;
resources.ApplyResources(this.topologyPictureBox, "topologyPictureBox");
this.topologyPictureBox.Name = "topologyPictureBox";
this.topologyPictureBox.TabStop = false;
//
// comboBoxInitialVCPUs
//
this.comboBoxInitialVCPUs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@ -114,16 +145,9 @@ namespace XenAdmin.SettingsPanels
resources.ApplyResources(this.labelInitialVCPUs, "labelInitialVCPUs");
this.labelInitialVCPUs.Name = "labelInitialVCPUs";
//
// labelInvalidVCPUWarning
//
resources.ApplyResources(this.labelInvalidVCPUWarning, "labelInvalidVCPUWarning");
this.tableLayoutPanel1.SetColumnSpan(this.labelInvalidVCPUWarning, 3);
this.labelInvalidVCPUWarning.ForeColor = System.Drawing.Color.Red;
this.labelInvalidVCPUWarning.Name = "labelInvalidVCPUWarning";
//
// comboBoxTopology
//
this.tableLayoutPanel1.SetColumnSpan(this.comboBoxTopology, 3);
this.tableLayoutPanel1.SetColumnSpan(this.comboBoxTopology, 2);
this.comboBoxTopology.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
resources.ApplyResources(this.comboBoxTopology, "comboBoxTopology");
this.comboBoxTopology.FormattingEnabled = true;
@ -135,51 +159,10 @@ namespace XenAdmin.SettingsPanels
resources.ApplyResources(this.labelTopology, "labelTopology");
this.labelTopology.Name = "labelTopology";
//
// MemWarningLabel
//
resources.ApplyResources(this.MemWarningLabel, "MemWarningLabel");
this.MemWarningLabel.ForeColor = System.Drawing.Color.Red;
this.MemWarningLabel.Name = "MemWarningLabel";
this.tableLayoutPanel1.SetRowSpan(this.MemWarningLabel, 2);
//
// panel2
//
resources.ApplyResources(this.panel2, "panel2");
this.tableLayoutPanel1.SetColumnSpan(this.panel2, 2);
this.panel2.Controls.Add(this.lblMB);
this.panel2.Controls.Add(this.nudMemory);
this.panel2.Name = "panel2";
//
// lblMB
//
resources.ApplyResources(this.lblMB, "lblMB");
this.lblMB.Name = "lblMB";
//
// nudMemory
//
resources.ApplyResources(this.nudMemory, "nudMemory");
this.nudMemory.Maximum = new decimal(new int[] {
1048576,
0,
0,
0});
this.nudMemory.Minimum = new decimal(new int[] {
64,
0,
0,
0});
this.nudMemory.Name = "nudMemory";
this.nudMemory.Value = new decimal(new int[] {
64,
0,
0,
0});
this.nudMemory.ValueChanged += new System.EventHandler(this.nudMemory_ValueChanged);
//
// panel1
//
resources.ApplyResources(this.panel1, "panel1");
this.tableLayoutPanel1.SetColumnSpan(this.panel1, 4);
this.tableLayoutPanel1.SetColumnSpan(this.panel1, 3);
this.panel1.Controls.Add(this.lblSliderHighest);
this.panel1.Controls.Add(this.lblSliderNormal);
this.panel1.Controls.Add(this.lblSliderLowest);
@ -198,32 +181,10 @@ namespace XenAdmin.SettingsPanels
resources.ApplyResources(this.lblVCPUs, "lblVCPUs");
this.lblVCPUs.Name = "lblVCPUs";
//
// lblVcpuWarning
//
resources.ApplyResources(this.lblVcpuWarning, "lblVcpuWarning");
this.tableLayoutPanel1.SetColumnSpan(this.lblVcpuWarning, 4);
this.lblVcpuWarning.LinkColor = System.Drawing.SystemColors.ActiveCaption;
this.lblVcpuWarning.Name = "lblVcpuWarning";
this.lblVcpuWarning.TabStop = true;
this.lblVcpuWarning.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblVcpuWarning_LinkClicked);
//
// lblMemory
//
resources.ApplyResources(this.lblMemory, "lblMemory");
this.lblMemory.Name = "lblMemory";
//
// VCPUWarningLabel
//
resources.ApplyResources(this.VCPUWarningLabel, "VCPUWarningLabel");
this.tableLayoutPanel1.SetColumnSpan(this.VCPUWarningLabel, 2);
this.VCPUWarningLabel.ForeColor = System.Drawing.Color.Red;
this.VCPUWarningLabel.Name = "VCPUWarningLabel";
this.tableLayoutPanel1.SetRowSpan(this.VCPUWarningLabel, 2);
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.tableLayoutPanel1.SetColumnSpan(this.label1, 4);
this.tableLayoutPanel1.SetColumnSpan(this.label1, 3);
this.label1.Name = "label1";
//
// comboBoxVCPUs
@ -234,14 +195,27 @@ namespace XenAdmin.SettingsPanels
this.comboBoxVCPUs.Name = "comboBoxVCPUs";
this.comboBoxVCPUs.SelectedIndexChanged += new System.EventHandler(this.comboBoxVCPUs_SelectedIndexChanged);
//
// initialVCPUWarningLabel
// tableLayoutPanelInfo
//
resources.ApplyResources(this.initialVCPUWarningLabel, "initialVCPUWarningLabel");
this.tableLayoutPanel1.SetColumnSpan(this.initialVCPUWarningLabel, 2);
this.initialVCPUWarningLabel.ForeColor = System.Drawing.Color.Red;
this.initialVCPUWarningLabel.Name = "initialVCPUWarningLabel";
resources.ApplyResources(this.tableLayoutPanelInfo, "tableLayoutPanelInfo");
this.tableLayoutPanel1.SetColumnSpan(this.tableLayoutPanelInfo, 3);
this.tableLayoutPanelInfo.Controls.Add(this.pictureBox1, 0, 0);
this.tableLayoutPanelInfo.Controls.Add(this.labelInfo, 1, 0);
this.tableLayoutPanelInfo.Name = "tableLayoutPanelInfo";
//
// CPUMemoryEditPage
// pictureBox1
//
this.pictureBox1.Image = global::XenAdmin.Properties.Resources._000_Info3_h32bit_16;
resources.ApplyResources(this.pictureBox1, "pictureBox1");
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.TabStop = false;
//
// labelInfo
//
resources.ApplyResources(this.labelInfo, "labelInfo");
this.labelInfo.Name = "labelInfo";
//
// CpuMemoryEditPage
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
@ -249,14 +223,18 @@ namespace XenAdmin.SettingsPanels
this.Controls.Add(this.tableLayoutPanel1);
this.DoubleBuffered = true;
this.ForeColor = System.Drawing.SystemColors.ControlText;
this.Name = "CPUMemoryEditPage";
this.Name = "CpuMemoryEditPage";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudMemory)).EndInit();
this.warningsTableLayoutPanel.ResumeLayout(false);
this.warningsTableLayoutPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.cpuWarningPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.topologyPictureBox)).EndInit();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.tableLayoutPanelInfo.ResumeLayout(false);
this.tableLayoutPanelInfo.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
@ -264,27 +242,26 @@ namespace XenAdmin.SettingsPanels
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.NumericUpDown nudMemory;
private System.Windows.Forms.Label lblMB;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label lblSliderHighest;
private System.Windows.Forms.Label lblSliderNormal;
private System.Windows.Forms.Label lblSliderLowest;
private System.Windows.Forms.Label lblPriority;
private System.Windows.Forms.Label lblVCPUs;
private System.Windows.Forms.Label lblMemory;
private System.Windows.Forms.LinkLabel lblVcpuWarning;
private XenAdmin.Controls.TransparentTrackBar transparentTrackBar1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label VCPUWarningLabel;
private System.Windows.Forms.Label MemWarningLabel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label labelTopology;
private XenAdmin.Controls.CPUTopologyComboBox comboBoxTopology;
private System.Windows.Forms.Label labelInvalidVCPUWarning;
private System.Windows.Forms.ComboBox comboBoxVCPUs;
private System.Windows.Forms.ComboBox comboBoxInitialVCPUs;
private System.Windows.Forms.Label labelInitialVCPUs;
private System.Windows.Forms.Label initialVCPUWarningLabel;
private System.Windows.Forms.TableLayoutPanel warningsTableLayoutPanel;
private System.Windows.Forms.PictureBox cpuWarningPictureBox;
private System.Windows.Forms.Label cpuWarningLabel;
private System.Windows.Forms.Label topologyWarningLabel;
private System.Windows.Forms.PictureBox topologyPictureBox;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelInfo;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label labelInfo;
}
}

View File

@ -31,541 +31,241 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using XenAdmin.Actions;
using XenAdmin.Commands;
using XenAdmin.Core;
using XenAPI;
using XenAdmin.Dialogs;
namespace XenAdmin.SettingsPanels
{
public partial class CPUMemoryEditPage : UserControl, IEditPage
public partial class CpuMemoryEditPage : UserControl, IEditPage
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()?.DeclaringType);
private VM vm;
bool ShowMemory = false; // If this VM has DMC, we don't show the memory controls on this page.
private bool _ValidToSave = true;
private decimal _OrigMemory;
private long _OrigVCPUs;
private long _OrigVCPUsMax;
private long _OrigVCPUsAtStartup;
private decimal _OrigVCPUWeight;
private decimal _CurrentVCPUWeight;
private bool isVcpuHotplugSupported;
private int minVCPUs;
private VM _vm;
private bool _validToSave = true;
private long _origVCpus;
private long _origVCpusMax;
private long _origVCpusAtStartup;
private decimal _origVCpuWeight;
private decimal _currentVCpuWeight;
private bool _isVCpuHotplugSupported;
private int _minVCpus;
private long _prevVCpusMax;
// Please note that the comboBoxVCPUs control can represent two different VM properties, depending whether the VM supports vCPU hotplug or not:
// If vCPU hotplug is supported, comboBoxVCPUs represents the maximum number of vCPUs (VCPUs_max). And the initial number of vCPUs is represented in comboBoxInitialVCPUs (which is only visible in this case)
// If vCPU hotplug is not supported, comboBoxVCPUs represents the initial number of vCPUs (VCPUs_at_startup). In this case we will also set the VM property VCPUs_max to the same value.
// We use the _OrigVCPUs variable to store the original value that populates this combo box (VCPUs_max if hotplug is allowed, otherwise VCPUs_at_startup)
private ChangeMemorySettingsAction memoryAction;
public bool ValidToSave
{
get
{
if (!_ValidToSave)
return false;
private bool HasVCpuChanged => _origVCpus != (long)comboBoxVCPUs.SelectedItem;
// Also confirm whether the user wants to save memory changes.
// If not, don't close the properties dialog.
if (HasMemoryChanged)
{
long mem = Convert.ToInt64(this.nudMemory.Value * Util.BINARY_MEGA);
memoryAction = ConfirmAndCalcActions(mem);
if (memoryAction == null)
return false;
}
private bool HasVCpuWeightChanged => _origVCpuWeight != _currentVCpuWeight;
return true;
}
}
private bool HasVCpusAtStartupChanged =>
_isVCpuHotplugSupported && _origVCpusAtStartup != (long)comboBoxInitialVCPUs.SelectedItem;
private ChangeMemorySettingsAction ConfirmAndCalcActions(long mem)
{
if (vm.memory_static_max / Util.BINARY_MEGA == mem / Util.BINARY_MEGA)
{
// don't want to show warning dialog just for rounding errors
mem = vm.memory_static_max;
}
else if (vm.power_state != vm_power_state.Halted)
{
var msg = vm.SupportsBallooning() && !Helpers.FeatureForbidden(vm, Host.RestrictDMC)
? Messages.CONFIRM_CHANGE_MEMORY_MAX_SINGULAR
: Messages.CONFIRM_CHANGE_MEMORY_SINGULAR;
private bool HasTopologyChanged => _vm.GetCoresPerSocket() != comboBoxTopology.CoresPerSocket;
using (var dlg = new WarningDialog(msg,
ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo))
{
if (dlg.ShowDialog(this) != DialogResult.Yes)
return null;
}
}
private long SelectedVCpusMax => (long)comboBoxVCPUs.SelectedItem;
return new ChangeMemorySettingsAction(vm,
string.Format(Messages.ACTION_CHANGE_MEMORY_SETTINGS, vm.Name()),
vm.memory_static_min, mem, mem, mem,
VMOperationCommand.WarningDialogHAInvalidConfig, VMOperationCommand.StartDiagnosisForm, true);
}
public CPUMemoryEditPage()
{
InitializeComponent();
Text = Messages.CPU_AND_MEMORY;
transparentTrackBar1.Scroll += new EventHandler(tbPriority_Scroll);
this.nudMemory.TextChanged += new EventHandler(nudMemory_TextChanged);
this.nudMemory.LostFocus += new EventHandler(nudMemory_LostFocus);
}
private long SelectedVCpusAtStartup => _isVCpuHotplugSupported
? (long)comboBoxInitialVCPUs.SelectedItem
: (long)comboBoxVCPUs.SelectedItem;
public Image Image => Images.StaticImages._000_CPU_h32bit_16;
void nudMemory_LostFocus(object sender, EventArgs e)
public string SubText => string.Format(Messages.CPU_SUB, SelectedVCpusAtStartup);
public CpuMemoryEditPage()
{
ValidateNud(nudMemory, (decimal)vm.memory_static_max / Util.BINARY_MEGA);
InitializeComponent();
transparentTrackBar1.Scroll += tbPriority_Scroll;
Text = Messages.CPU;
}
private void ValidateNud(NumericUpDown nud, Decimal defaultValue)
private void InitializeVCpuControls()
{
if (!String.IsNullOrEmpty(nud.Text.Trim()))
return;
nud.Value = defaultValue >= nud.Minimum && defaultValue <= nud.Maximum ?
defaultValue : nud.Maximum;
nud.Text = nud.Value.ToString();
}
void nudMemory_TextChanged(object sender, EventArgs e)
{
decimal val;
if (decimal.TryParse(nudMemory.Text, out val))
{
if (val >= nudMemory.Minimum && val <= nudMemory.Maximum)
nudMemory_ValueChanged(null, null);
else if (val > nudMemory.Maximum)
ShowMemError(true, false);
else
ShowMemError(false, false);
}
if (this.nudMemory.Text == "")
{
_ValidToSave = false;
}
else
{
_ValidToSave = true;
}
}
private void tbPriority_Scroll(object sender, EventArgs e)
{
_CurrentVCPUWeight = Convert.ToDecimal(Math.Pow(4.0d, Convert.ToDouble(transparentTrackBar1.Value)));
if (transparentTrackBar1.Value == transparentTrackBar1.Max)
_CurrentVCPUWeight--;
}
/// <summary>
/// Must be a VM.
/// </summary>
public void SetXenObjects(IXenObject orig, IXenObject clone)
{
vm = (VM)clone;
ShowMemory = Helpers.FeatureForbidden(vm, Host.RestrictDMC);
Repopulate();
}
public void Repopulate()
{
VM vm = this.vm;
Text = ShowMemory ? Messages.CPU_AND_MEMORY : Messages.CPU;
if (!ShowMemory)
lblMemory.Visible = panel2.Visible = MemWarningLabel.Visible = false;
else if (vm.power_state != vm_power_state.Halted && vm.power_state != vm_power_state.Running)
{
panel2.Enabled = false;
MemWarningLabel.Text = Messages.MEM_NOT_WHEN_SUSPENDED;
MemWarningLabel.ForeColor = SystemColors.ControlText;
MemWarningLabel.Visible = true;
}
// Since updates come in dribs and drabs, avoid error if new max and min arrive
// out of sync and maximum < minimum.
if (vm.memory_dynamic_max >= vm.memory_dynamic_min &&
vm.memory_static_max >= vm.memory_static_min)
{
decimal min = Convert.ToDecimal(vm.memory_static_min / Util.BINARY_MEGA);
decimal max = Convert.ToDecimal(vm.MaxMemAllowed() / Util.BINARY_MEGA);
decimal value = Convert.ToDecimal(vm.memory_static_max / Util.BINARY_MEGA);
// Avoid setting the range to exclude the current value: CA-40041
if (value > max)
max = value;
if (value < min)
min = value;
this.nudMemory.Minimum = min;
this.nudMemory.Maximum = max;
this.nudMemory.Text = (this.nudMemory.Value = value).ToString();
}
Host currentHost = Helpers.GetCoordinator(this.vm.Connection);
if (currentHost != null)
{
// Show the performance warning about vCPUs > pCPUs.
// Don't show if the VM isn't running, since we don't know which server it will
// run on (and so can't count the number of pCPUs).
if ( vm.power_state == vm_power_state.Running
&& vm.VCPUs_at_startup > currentHost.host_CPUs.Count
&& !vm.GetIgnoreExcessiveVcpus())
{
lblVcpuWarning.Visible = true;
this.tableLayoutPanel1.RowStyles[1].SizeType = SizeType.Absolute;
this.tableLayoutPanel1.RowStyles[1].Height = 30;
}
else
{
lblVcpuWarning.Visible = false;
}
}
else
{
lblVcpuWarning.Visible = false;
}
isVcpuHotplugSupported = vm.SupportsVcpuHotplug();
minVCPUs = vm.MinVCPUs();
label1.Text = GetRubric();
_OrigMemory = nudMemory.Value;
_OrigVCPUsMax = vm.VCPUs_max > 0 ? vm.VCPUs_max : 1;
_OrigVCPUsAtStartup = vm.VCPUs_at_startup > 0 ? vm.VCPUs_at_startup : 1;
_OrigVCPUWeight = _CurrentVCPUWeight;
_OrigVCPUs = isVcpuHotplugSupported ? _OrigVCPUsMax : _OrigVCPUsAtStartup;
_prevVCPUsMax = _OrigVCPUsMax; // we use variable in RefreshCurrentVCPUs for checking if VcpusAtStartup and VcpusMax were equal before VcpusMax changed
_CurrentVCPUWeight = Convert.ToDecimal(vm.GetVcpuWeight());
InitializeVcpuControls();
_ValidToSave = true;
}
private void InitializeVcpuControls()
{
lblVCPUs.Text = isVcpuHotplugSupported
lblVCPUs.Text = _isVCpuHotplugSupported
? Messages.VM_CPUMEMPAGE_MAX_VCPUS_LABEL
: Messages.VM_CPUMEMPAGE_VCPUS_LABEL;
labelInitialVCPUs.Text = vm.power_state == vm_power_state.Halted
labelInitialVCPUs.Text = _vm.power_state == vm_power_state.Halted
? Messages.VM_CPUMEMPAGE_INITIAL_VCPUS_LABEL
: Messages.VM_CPUMEMPAGE_CURRENT_VCPUS_LABEL;
labelInitialVCPUs.Visible = comboBoxInitialVCPUs.Visible = isVcpuHotplugSupported;
comboBoxInitialVCPUs.Enabled = isVcpuHotplugSupported &&
(vm.power_state == vm_power_state.Halted ||
vm.power_state == vm_power_state.Running);
comboBoxVCPUs.Enabled = comboBoxTopology.Enabled = vm.power_state == vm_power_state.Halted;
labelInitialVCPUs.Visible = comboBoxInitialVCPUs.Visible = _isVCpuHotplugSupported;
comboBoxInitialVCPUs.Enabled = _isVCpuHotplugSupported &&
(_vm.power_state == vm_power_state.Halted ||
_vm.power_state == vm_power_state.Running);
comboBoxTopology.Populate(vm.VCPUs_at_startup, vm.VCPUs_max, vm.GetCoresPerSocket(), vm.MaxCoresPerSocket());
comboBoxVCPUs.Enabled = comboBoxTopology.Enabled = _vm.power_state == vm_power_state.Halted;
comboBoxTopology.Populate(_vm.VCPUs_at_startup, _vm.VCPUs_max, _vm.GetCoresPerSocket(),
_vm.MaxCoresPerSocket());
// CA-12941
// We set a sensible maximum based on the template, but if the user sets something higher
// from the CLI then use that as the maximum.
var maxAllowed = vm.MaxVCPUsAllowed();
long maxVCPUs = maxAllowed < _OrigVCPUs ? _OrigVCPUs : maxAllowed;
PopulateVCPUs(maxVCPUs, _OrigVCPUs);
var maxAllowed = _vm.MaxVCPUsAllowed();
var maxVCpus = maxAllowed < _origVCpus ? _origVCpus : maxAllowed;
PopulateVCpus(maxVCpus, _origVCpus);
if (isVcpuHotplugSupported)
PopulateVCPUsAtStartup(_OrigVCPUsMax, _OrigVCPUsAtStartup);
if (_isVCpuHotplugSupported)
PopulateVCpusAtStartup(_origVCpusMax, _origVCpusAtStartup);
transparentTrackBar1.Value = Convert.ToInt32(Math.Log(Convert.ToDouble(vm.GetVcpuWeight())) / Math.Log(4.0d));
panel1.Enabled = vm.power_state == vm_power_state.Halted;
transparentTrackBar1.Value =
Convert.ToInt32(Math.Log(Convert.ToDouble(_vm.GetVcpuWeight())) / Math.Log(4.0d));
panel1.Enabled = _vm.power_state == vm_power_state.Halted;
}
private void PopulateVCPUComboBox(ComboBox comboBox, long min, long max, long currentValue, Predicate<long> isValid)
private void Repopulate()
{
var vm = _vm;
_isVCpuHotplugSupported = vm.SupportsVcpuHotplug();
_minVCpus = vm.MinVCPUs();
label1.Text = Messages.VM_CPUMEMPAGE_RUBRIC;
if (_isVCpuHotplugSupported)
label1.Text += Messages.VM_CPUMEMPAGE_RUBRIC_HOTPLUG;
if (_vm.power_state != vm_power_state.Halted)
{
if (_isVCpuHotplugSupported)
{
labelInfo.Text = Messages.VM_CPUMEMPAGE_MAX_VCPUS_READONLY;
if (_vm.power_state != vm_power_state.Running)
labelInfo.Text += Messages.VM_CPUMEMPAGE_CURRENT_VCPUS_READONLY;
}
else
{
labelInfo.Text = Messages.VCPU_ONLY_WHEN_HALTED;
}
tableLayoutPanelInfo.Visible = true;
}
else
{
tableLayoutPanelInfo.Visible = false;
}
_origVCpusMax = vm.VCPUs_max > 0 ? vm.VCPUs_max : 1;
_origVCpusAtStartup = vm.VCPUs_at_startup > 0 ? vm.VCPUs_at_startup : 1;
_origVCpuWeight = _currentVCpuWeight;
_origVCpus = _isVCpuHotplugSupported ? _origVCpusMax : _origVCpusAtStartup;
_prevVCpusMax = _origVCpusMax; // we use variable in RefreshCurrentVCPUs for checking if VcpusAtStartup and VcpusMax were equal before VcpusMax changed
_currentVCpuWeight = Convert.ToDecimal(vm.GetVcpuWeight());
InitializeVCpuControls();
_validToSave = true;
}
private void PopulateVCpuComboBox(ComboBox comboBox, long min, long max, long currentValue,
Predicate<long> isValid)
{
comboBox.BeginUpdate();
comboBox.Items.Clear();
for (long i = min; i <= max; ++i)
for (var i = min; i <= max; ++i)
{
if (i == currentValue || isValid(i))
comboBox.Items.Add(i);
}
if (currentValue > max)
comboBox.Items.Add(currentValue);
comboBox.SelectedItem = currentValue;
comboBox.EndUpdate();
}
private void PopulateVCPUs(long maxVCPUs, long currentVCPUs)
private void PopulateVCpus(long maxVCpus, long currentVCpus)
{
PopulateVCPUComboBox(comboBoxVCPUs, 1, maxVCPUs, currentVCPUs, i => comboBoxTopology.IsValidVCPU(i));
PopulateVCpuComboBox(comboBoxVCPUs, 1, maxVCpus, currentVCpus, i => comboBoxTopology.IsValidVCPU(i));
}
private void PopulateVCPUsAtStartup(long max, long currentValue)
private void PopulateVCpusAtStartup(long max, long currentValue)
{
long min = vm.power_state == vm_power_state.Halted ? 1 : _OrigVCPUsAtStartup;
PopulateVCPUComboBox(comboBoxInitialVCPUs, min, max, currentValue, i => true);
var min = _vm.power_state == vm_power_state.Halted ? 1 : _origVCpusAtStartup;
PopulateVCpuComboBox(comboBoxInitialVCPUs, min, max, currentValue, i => true);
}
private string GetRubric()
private void ShowCpuWarnings(IReadOnlyCollection<string> warnings)
{
StringBuilder sb = new StringBuilder();
sb.Append(Messages.VM_CPUMEMPAGE_RUBRIC);
// add hotplug text
if (isVcpuHotplugSupported)
sb.Append(Messages.VM_CPUMEMPAGE_RUBRIC_HOTPLUG);
// add power state warning
if (vm.power_state != vm_power_state.Halted)
{
sb.AppendLine();
sb.AppendLine();
sb.Append(isVcpuHotplugSupported ? Messages.VM_CPUMEMPAGE_MAX_VCPUS_READONLY : Messages.VCPU_ONLY_WHEN_HALTED);
}
// add power state warning for Current number of vCPUs
if (isVcpuHotplugSupported && vm.power_state != vm_power_state.Halted && vm.power_state != vm_power_state.Running)
{
sb.Append(Messages.VM_CPUMEMPAGE_CURRENT_VCPUS_READONLY);
}
return sb.ToString();
var show = warnings.Count > 0;
cpuWarningLabel.Text = show ? string.Join($"{Environment.NewLine}{Environment.NewLine}", warnings) : null;
cpuWarningPictureBox.Visible = cpuWarningLabel.Visible = show;
}
public bool HasChanged
private void ShowTopologyWarnings(IReadOnlyCollection<string> warnings)
{
get { return HasVCPUChanged || HasMemoryChanged || HasTopologyChanged || HasVCPUsAtStartupChanged || HasVCPUWeightChanged; }
var show = warnings.Count > 0;
topologyWarningLabel.Text = show ? string.Join($"{Environment.NewLine}{Environment.NewLine}", warnings) : null;
topologyPictureBox.Visible = topologyWarningLabel.Visible = show;
}
private bool HasMemoryChanged
private void ValidateVCpuSettings()
{
get
{
return _OrigMemory != nudMemory.Value;
}
}
private bool HasVCPUChanged
{
get
{
return _OrigVCPUs != (long)comboBoxVCPUs.SelectedItem;
}
}
private bool HasVCPUWeightChanged
{
get
{
return _OrigVCPUWeight != _CurrentVCPUWeight;
}
}
private bool HasVCPUsAtStartupChanged
{
get
{
return isVcpuHotplugSupported && _OrigVCPUsAtStartup != (long)comboBoxInitialVCPUs.SelectedItem;
}
}
private bool HasTopologyChanged
{
get
{
return vm.GetCoresPerSocket() != comboBoxTopology.CoresPerSocket;
}
}
private long SelectedVcpusMax
{
get
{
return (long)comboBoxVCPUs.SelectedItem;
}
}
private long SelectedVcpusAtStartup
{
get
{
return isVcpuHotplugSupported ? (long)comboBoxInitialVCPUs.SelectedItem : (long)comboBoxVCPUs.SelectedItem;
}
}
public AsyncAction SaveSettings()
{
List<AsyncAction> actions = new List<AsyncAction>();
if (HasVCPUWeightChanged)
{
vm.SetVcpuWeight(Convert.ToInt32(_CurrentVCPUWeight));
}
if (HasVCPUChanged || HasVCPUsAtStartupChanged)
{
actions.Add(new ChangeVCPUSettingsAction(vm, SelectedVcpusMax, SelectedVcpusAtStartup));
}
if (HasTopologyChanged)
{
vm.SetCoresPerSocket(comboBoxTopology.CoresPerSocket);
}
if (HasMemoryChanged)
{
actions.Add(memoryAction); // Calculated in ValidToSave
}
if (actions.Count == 0)
return null;
else if (actions.Count == 1)
return actions[0];
else
{
MultipleAction multipleAction = new MultipleAction(vm.Connection, "", "", "", actions, true);
return multipleAction;
}
}
/** Show local validation balloon tooltips */
public void ShowLocalValidationMessages() { }
public void HideLocalValidationMessages() { }
/** Unregister listeners, dispose balloon tooltips, etc. */
public void Cleanup() { }
/// <summary>
/// Shows the warning dialog about vCPUs > pCPUs.
/// </summary>
private void lblVcpuWarning_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (vm == null)
{
System.Diagnostics.Trace.Assert(false, "Selected object should be a vm");
return;
}
using (var dialog = new WarningDialog(Messages.VCPUS_MORE_THAN_PCPUS)
{
ShowCheckbox = true,
CheckboxCaption = Messages.DO_NOT_SHOW_THIS_MESSAGE
})
{
dialog.ShowDialog(this);
if (dialog.IsCheckBoxChecked)
{
// User clicked 'ignore': set flag in VM.
log.DebugFormat("Setting IgnoreExcessiveVcpus flag to true for VM {0}", vm.Name());
VM copyVm = (VM)vm.Clone();
copyVm.SetIgnoreExcessiveVcpus(true);
try
{
vm.Locked = true;
copyVm.SaveChanges(vm.Connection.Session);
}
finally
{
vm.Locked = false;
}
}
else if (Program.MainWindow.SelectObjectInTree(vm))
{
Program.MainWindow.SwitchToTab(MainWindow.Tab.General);
}
}
Refresh();
}
private void nudMemory_ValueChanged(object sender, EventArgs e)
{
ShowMemError(false, true);
}
private void ShowMemError(bool showAlways, bool testValue)
{
if (vm == null || !ShowMemory)
if (_vm == null || !comboBoxVCPUs.Enabled)
return;
Host selectedAffinity = vm.Connection.Resolve<Host>(vm.power_state == vm_power_state.Running ? vm.resident_on : vm.affinity);
if (selectedAffinity != null)
var homeHost = _vm.Home();
var maxPhysicalCpus = _vm.Connection.Cache.Hosts.Select(h => h.host_CPUs.Count).Max();
var homeHostPhysicalCpus = homeHost?.host_CPUs.Count;
var warnings = new List<string>();
if (comboBoxVCPUs.SelectedItem != null && maxPhysicalCpus < SelectedVCpusMax)
{
Host_metrics host_metrics = vm.Connection.Resolve<Host_metrics>(selectedAffinity.metrics);
if ((showAlways || (testValue && (host_metrics != null && (double)host_metrics.memory_total < (double)nudMemory.Value * (double)Util.BINARY_MEGA))))
if (homeHostPhysicalCpus != null && homeHostPhysicalCpus < SelectedVCpusMax &&
maxPhysicalCpus >= SelectedVCpusMax)
{
MemWarningLabel.Visible = true;
warnings.Add(Messages.VM_CPUMEMPAGE_VCPU_HOME_HOST_WARNING);
}
else
else if (maxPhysicalCpus < SelectedVCpusMax)
{
MemWarningLabel.Visible = false;
warnings.Add(Messages.VM_CPUMEMPAGE_VCPU_WARNING);
}
}
}
private void comboBoxVCPUs_SelectedIndexChanged(object sender, EventArgs e)
{
ValidateVCPUSettings();
comboBoxTopology.Update((long)comboBoxVCPUs.SelectedItem);
ValidateTopologySettings();
RefreshCurrentVCPUs();
}
private void ValidateVCPUSettings()
{
if (vm == null || !comboBoxVCPUs.Enabled)
return;
Host selectedAffinity = vm.Home();
if (selectedAffinity == null && vm.Connection.Cache.Hosts.Length == 1)
selectedAffinity = vm.Connection.Cache.Hosts[0];
if (selectedAffinity != null && comboBoxVCPUs.SelectedItem != null && selectedAffinity.host_CPUs.Count < SelectedVcpusMax)
if (comboBoxVCPUs.SelectedItem != null && SelectedVCpusMax < _minVCpus)
{
VCPUWarningLabel.Text = Messages.VM_CPUMEMPAGE_VCPU_WARNING;
VCPUWarningLabel.Visible = true;
}
else if (comboBoxVCPUs.SelectedItem != null && SelectedVcpusMax < minVCPUs)
{
VCPUWarningLabel.Text = string.Format(Messages.VM_CPUMEMPAGE_VCPU_MIN_WARNING, minVCPUs);
VCPUWarningLabel.Visible = true;
}
else
{
VCPUWarningLabel.Visible = false;
warnings.Add(string.Format(Messages.VM_CPUMEMPAGE_VCPU_MIN_WARNING, _minVCpus));
}
if (comboBoxInitialVCPUs.SelectedItem != null && SelectedVcpusAtStartup < minVCPUs)
if (comboBoxVCPUs.SelectedItem != null && SelectedVCpusMax > VM.MAX_VCPUS_FOR_NON_TRUSTED_VMS)
{
initialVCPUWarningLabel.Text = string.Format(Messages.VM_CPUMEMPAGE_VCPU_MIN_WARNING, minVCPUs);
initialVCPUWarningLabel.Visible = true;
warnings.Add(string.Format(Messages.VCPUS_UNTRUSTED_VM_WARNING, VM.MAX_VCPUS_FOR_NON_TRUSTED_VMS, BrandManager.ProductBrand));
}
else
if (comboBoxInitialVCPUs.SelectedItem != null && SelectedVCpusAtStartup < _minVCpus)
{
initialVCPUWarningLabel.Visible = false;
warnings.Add(string.Format(Messages.VM_CPUMEMPAGE_VCPU_MIN_WARNING, _minVCpus));
}
ShowCpuWarnings(warnings);
}
private void ValidateTopologySettings()
{
var warnings = new List<string>();
if (comboBoxVCPUs.SelectedItem != null)
labelInvalidVCPUWarning.Text = VM.ValidVCPUConfiguration((long)comboBoxVCPUs.SelectedItem, comboBoxTopology.CoresPerSocket);
{
var topologyWarning = VM.ValidVCPUConfiguration((long)comboBoxVCPUs.SelectedItem, comboBoxTopology.CoresPerSocket);
if (!string.IsNullOrEmpty(topologyWarning))
{
warnings.Add($"{topologyWarning}.");
}
}
ShowTopologyWarnings(warnings);
}
private long _prevVCPUsMax;
private void RefreshCurrentVCPUs()
private void RefreshCurrentVCpus()
{
// refresh comboBoxInitialVCPUs if it's visible and populated
if (comboBoxInitialVCPUs.Visible && comboBoxInitialVCPUs.Items.Count > 0)
@ -574,28 +274,88 @@ namespace XenAdmin.SettingsPanels
// So if VcpusMax is decreased below VcpusAtStartup, then VcpusAtStartup is decreased to that number too
// If VcpusAtStartup and VcpusMax are equal, and VcpusMax is changed, then VcpusAtStartup is changed to match
// But if the numbers are unequal, and VcpusMax is changed but is still higher than VcpusAtStartup, then VcpusAtStartup is unchanged
var newValue = SelectedVcpusAtStartup;
if (SelectedVcpusMax < SelectedVcpusAtStartup)
newValue = SelectedVcpusMax;
else if (SelectedVcpusAtStartup == _prevVCPUsMax && SelectedVcpusMax != _prevVCPUsMax)
newValue = SelectedVcpusMax;
var newValue = SelectedVCpusAtStartup;
PopulateVCPUsAtStartup(SelectedVcpusMax, newValue);
_prevVCPUsMax = SelectedVcpusMax;
if (SelectedVCpusMax < SelectedVCpusAtStartup)
newValue = SelectedVCpusMax;
else if (SelectedVCpusAtStartup == _prevVCpusMax && SelectedVCpusMax != _prevVCpusMax)
newValue = SelectedVCpusMax;
PopulateVCpusAtStartup(SelectedVCpusMax, newValue);
_prevVCpusMax = SelectedVCpusMax;
}
}
public String SubText
#region IEditPage
public AsyncAction SaveSettings()
{
get
var actions = new List<AsyncAction>();
if (HasVCpuWeightChanged)
{
return ShowMemory ?
String.Format(Messages.CPU_AND_MEMORY_SUB, SelectedVcpusAtStartup, nudMemory.Value) :
String.Format(Messages.CPU_SUB, SelectedVcpusAtStartup);
_vm.SetVcpuWeight(Convert.ToInt32(_currentVCpuWeight));
}
if (HasVCpuChanged || HasVCpusAtStartupChanged)
{
actions.Add(new ChangeVCPUSettingsAction(_vm, SelectedVCpusMax, SelectedVCpusAtStartup));
}
if (HasTopologyChanged)
{
_vm.SetCoresPerSocket(comboBoxTopology.CoresPerSocket);
}
switch (actions.Count)
{
case 0:
return null;
case 1:
return actions[0];
default:
{
var multipleAction = new MultipleAction(_vm.Connection, "", "", "", actions, true);
return multipleAction;
}
}
}
/// <summary>
/// Must be a VM.
/// </summary>
public void SetXenObjects(IXenObject orig, IXenObject clone)
{
_vm = (VM)clone;
Repopulate();
}
public bool ValidToSave => _validToSave;
/** Show local validation balloon tooltips */
public void ShowLocalValidationMessages()
{
// not applicable
}
public void HideLocalValidationMessages()
{
// not applicable
}
/** Unregister listeners, dispose balloon tooltips, etc. */
public void Cleanup()
{
// not applicable
}
public bool HasChanged => HasVCpuChanged || HasTopologyChanged ||
HasVCpusAtStartupChanged || HasVCpuWeightChanged;
#endregion
#region Events
private void comboBoxTopology_SelectedIndexChanged(object sender, EventArgs e)
{
ValidateTopologySettings();
@ -603,7 +363,24 @@ namespace XenAdmin.SettingsPanels
private void comboBoxInitialVCPUs_SelectedIndexChanged(object sender, EventArgs e)
{
ValidateVCPUSettings();
ValidateVCpuSettings();
}
private void comboBoxVCPUs_SelectedIndexChanged(object sender, EventArgs e)
{
ValidateVCpuSettings();
comboBoxTopology.Update((long)comboBoxVCPUs.SelectedItem);
ValidateTopologySettings();
RefreshCurrentVCpus();
}
private void tbPriority_Scroll(object sender, EventArgs e)
{
_currentVCpuWeight = Convert.ToDecimal(Math.Pow(4.0d, Convert.ToDouble(transparentTrackBar1.Value)));
if (transparentTrackBar1.Value == transparentTrackBar1.Max)
_currentVCpuWeight--;
}
#endregion
}
}
}

View File

@ -898,7 +898,7 @@
<value>500, 500</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>CPUMemoryEditPage</value>
<value>CpuMemoryEditPage</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>

View File

@ -226,52 +226,178 @@
<value>True</value>
</data>
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>4</value>
<value>3</value>
</data>
<data name="initialVCPUWarningLabel.AutoSize" type="System.Boolean, mscorlib">
<data name="warningsTableLayoutPanel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="initialVCPUWarningLabel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
<data name="warningsTableLayoutPanel.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="initialVCPUWarningLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<data name="warningsTableLayoutPanel.ColumnCount" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="cpuWarningPictureBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="initialVCPUWarningLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>185, 133</value>
<data name="cpuWarningPictureBox.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 3</value>
</data>
<data name="initialVCPUWarningLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>312, 27</value>
<data name="cpuWarningPictureBox.Size" type="System.Drawing.Size, System.Drawing">
<value>16, 16</value>
</data>
<data name="initialVCPUWarningLabel.TabIndex" type="System.Int32, mscorlib">
<value>19</value>
</data>
<data name="initialVCPUWarningLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="initialVCPUWarningLabel.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;initialVCPUWarningLabel.Name" xml:space="preserve">
<value>initialVCPUWarningLabel</value>
</data>
<data name="&gt;&gt;initialVCPUWarningLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;initialVCPUWarningLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;initialVCPUWarningLabel.ZOrder" xml:space="preserve">
<data name="cpuWarningPictureBox.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="cpuWarningPictureBox.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;cpuWarningPictureBox.Name" xml:space="preserve">
<value>cpuWarningPictureBox</value>
</data>
<data name="&gt;&gt;cpuWarningPictureBox.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cpuWarningPictureBox.Parent" xml:space="preserve">
<value>warningsTableLayoutPanel</value>
</data>
<data name="&gt;&gt;cpuWarningPictureBox.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="cpuWarningLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="cpuWarningLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cpuWarningLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="cpuWarningLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>25, 4</value>
</data>
<data name="cpuWarningLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>0, 13</value>
</data>
<data name="cpuWarningLabel.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="cpuWarningLabel.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;cpuWarningLabel.Name" xml:space="preserve">
<value>cpuWarningLabel</value>
</data>
<data name="&gt;&gt;cpuWarningLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cpuWarningLabel.Parent" xml:space="preserve">
<value>warningsTableLayoutPanel</value>
</data>
<data name="&gt;&gt;cpuWarningLabel.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="topologyWarningLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="topologyWarningLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="topologyWarningLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="topologyWarningLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>25, 32</value>
</data>
<data name="topologyWarningLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>0, 13</value>
</data>
<data name="topologyWarningLabel.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="topologyWarningLabel.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;topologyWarningLabel.Name" xml:space="preserve">
<value>topologyWarningLabel</value>
</data>
<data name="&gt;&gt;topologyWarningLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;topologyWarningLabel.Parent" xml:space="preserve">
<value>warningsTableLayoutPanel</value>
</data>
<data name="&gt;&gt;topologyWarningLabel.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="topologyPictureBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="topologyPictureBox.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 31</value>
</data>
<data name="topologyPictureBox.Size" type="System.Drawing.Size, System.Drawing">
<value>16, 16</value>
</data>
<data name="topologyPictureBox.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="topologyPictureBox.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;topologyPictureBox.Name" xml:space="preserve">
<value>topologyPictureBox</value>
</data>
<data name="&gt;&gt;topologyPictureBox.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;topologyPictureBox.Parent" xml:space="preserve">
<value>warningsTableLayoutPanel</value>
</data>
<data name="&gt;&gt;topologyPictureBox.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="warningsTableLayoutPanel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="warningsTableLayoutPanel.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 255</value>
</data>
<data name="warningsTableLayoutPanel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 20, 0, 0</value>
</data>
<data name="warningsTableLayoutPanel.RowCount" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="warningsTableLayoutPanel.Size" type="System.Drawing.Size, System.Drawing">
<value>500, 50</value>
</data>
<data name="warningsTableLayoutPanel.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="&gt;&gt;warningsTableLayoutPanel.Name" xml:space="preserve">
<value>warningsTableLayoutPanel</value>
</data>
<data name="&gt;&gt;warningsTableLayoutPanel.Type" xml:space="preserve">
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;warningsTableLayoutPanel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;warningsTableLayoutPanel.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="warningsTableLayoutPanel.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="cpuWarningPictureBox" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="cpuWarningLabel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="topologyWarningLabel" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="topologyPictureBox" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,Absolute,6,AutoSize,0" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="comboBoxInitialVCPUs.Location" type="System.Drawing.Point, System.Drawing">
<value>129, 136</value>
<value>129, 130</value>
</data>
<data name="comboBoxInitialVCPUs.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 21</value>
</data>
<data name="comboBoxInitialVCPUs.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
<value>6</value>
</data>
<data name="&gt;&gt;comboBoxInitialVCPUs.Name" xml:space="preserve">
<value>comboBoxInitialVCPUs</value>
@ -285,33 +411,27 @@
<data name="&gt;&gt;comboBoxInitialVCPUs.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="labelInitialVCPUs.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="labelInitialVCPUs.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labelInitialVCPUs.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="labelInitialVCPUs.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="labelInitialVCPUs.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 136</value>
</data>
<data name="labelInitialVCPUs.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
<value>3, 134</value>
</data>
<data name="labelInitialVCPUs.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 21</value>
<value>120, 13</value>
</data>
<data name="labelInitialVCPUs.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
<value>5</value>
</data>
<data name="labelInitialVCPUs.Text" xml:space="preserve">
<value>Initial number of v&amp;CPUs:</value>
</data>
<data name="labelInitialVCPUs.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;labelInitialVCPUs.Name" xml:space="preserve">
<value>labelInitialVCPUs</value>
</data>
@ -324,90 +444,51 @@
<data name="&gt;&gt;labelInitialVCPUs.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="labelInvalidVCPUWarning.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labelInvalidVCPUWarning.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="labelInvalidVCPUWarning.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="labelInvalidVCPUWarning.Location" type="System.Drawing.Point, System.Drawing">
<value>129, 114</value>
</data>
<data name="labelInvalidVCPUWarning.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 0, 3, 6</value>
</data>
<data name="labelInvalidVCPUWarning.Size" type="System.Drawing.Size, System.Drawing">
<value>368, 13</value>
</data>
<data name="labelInvalidVCPUWarning.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="&gt;&gt;labelInvalidVCPUWarning.Name" xml:space="preserve">
<value>labelInvalidVCPUWarning</value>
</data>
<data name="&gt;&gt;labelInvalidVCPUWarning.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelInvalidVCPUWarning.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;labelInvalidVCPUWarning.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="comboBoxTopology.Font" type="System.Drawing.Font, System.Drawing">
<value>Tahoma, 8pt</value>
</data>
<data name="comboBoxTopology.Location" type="System.Drawing.Point, System.Drawing">
<value>129, 90</value>
<value>129, 103</value>
</data>
<data name="comboBoxTopology.Size" type="System.Drawing.Size, System.Drawing">
<value>250, 21</value>
</data>
<data name="comboBoxTopology.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
<value>4</value>
</data>
<data name="&gt;&gt;comboBoxTopology.Name" xml:space="preserve">
<value>comboBoxTopology</value>
</data>
<data name="&gt;&gt;comboBoxTopology.Type" xml:space="preserve">
<value>XenAdmin.Controls.CPUTopologyComboBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.CPUTopologyComboBox, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;comboBoxTopology.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;comboBoxTopology.ZOrder" xml:space="preserve">
<value>4</value>
<value>3</value>
</data>
<data name="labelTopology.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="labelTopology.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labelTopology.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="labelTopology.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="labelTopology.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 90</value>
</data>
<data name="labelTopology.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
<value>3, 107</value>
</data>
<data name="labelTopology.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 21</value>
<value>54, 13</value>
</data>
<data name="labelTopology.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
<value>3</value>
</data>
<data name="labelTopology.Text" xml:space="preserve">
<value>&amp;Topology:</value>
</data>
<data name="labelTopology.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;labelTopology.Name" xml:space="preserve">
<value>labelTopology</value>
</data>
@ -418,139 +499,7 @@
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;labelTopology.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="MemWarningLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="MemWarningLabel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="MemWarningLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="MemWarningLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>230, 272</value>
</data>
<data name="MemWarningLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>267, 26</value>
</data>
<data name="MemWarningLabel.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="MemWarningLabel.Text" xml:space="preserve">
<value>The amount of physical memory allocated to this VM is greater than the total memory of its home server</value>
</data>
<data name="MemWarningLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="MemWarningLabel.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;MemWarningLabel.Name" xml:space="preserve">
<value>MemWarningLabel</value>
</data>
<data name="&gt;&gt;MemWarningLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;MemWarningLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;MemWarningLabel.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="panel2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="panel2.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="lblMB.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblMB.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lblMB.Location" type="System.Drawing.Point, System.Drawing">
<value>72, 3</value>
</data>
<data name="lblMB.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
</data>
<data name="lblMB.Size" type="System.Drawing.Size, System.Drawing">
<value>23, 13</value>
</data>
<data name="lblMB.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="lblMB.Text" xml:space="preserve">
<value>MB</value>
</data>
<data name="lblMB.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;lblMB.Name" xml:space="preserve">
<value>lblMB</value>
</data>
<data name="&gt;&gt;lblMB.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblMB.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;lblMB.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="nudMemory.Location" type="System.Drawing.Point, System.Drawing">
<value>1, 0</value>
</data>
<data name="nudMemory.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value>
</data>
<data name="nudMemory.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 20</value>
</data>
<data name="nudMemory.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;nudMemory.Name" xml:space="preserve">
<value>nudMemory</value>
</data>
<data name="&gt;&gt;nudMemory.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;nudMemory.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;nudMemory.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="panel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
<value>126, 275</value>
</data>
<data name="panel2.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 3, 0, 3</value>
</data>
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
<value>101, 20</value>
</data>
<data name="panel2.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="&gt;&gt;panel2.Name" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;panel2.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panel2.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;panel2.ZOrder" xml:space="preserve">
<value>7</value>
<value>4</value>
</data>
<data name="panel1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
@ -571,7 +520,7 @@
<value>transparentTrackBar1</value>
</data>
<data name="&gt;&gt;transparentTrackBar1.Type" xml:space="preserve">
<value>XenAdmin.Controls.TransparentTrackBar, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.TransparentTrackBar, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;transparentTrackBar1.Parent" xml:space="preserve">
<value>panel1</value>
@ -580,10 +529,7 @@
<value>3</value>
</data>
<data name="panel1.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 206</value>
</data>
<data name="panel1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 24</value>
<value>3, 190</value>
</data>
<data name="panel1.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 6</value>
@ -592,7 +538,7 @@
<value>494, 42</value>
</data>
<data name="panel1.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
<value>8</value>
</data>
<data name="&gt;&gt;panel1.Name" xml:space="preserve">
<value>panel1</value>
@ -604,35 +550,29 @@
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;panel1.ZOrder" xml:space="preserve">
<value>8</value>
<value>5</value>
</data>
<data name="lblVCPUs.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="lblVCPUs.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblVCPUs.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="lblVCPUs.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lblVCPUs.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 63</value>
</data>
<data name="lblVCPUs.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
<value>3, 80</value>
</data>
<data name="lblVCPUs.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 21</value>
<value>95, 13</value>
</data>
<data name="lblVCPUs.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
<value>1</value>
</data>
<data name="lblVCPUs.Text" xml:space="preserve">
<value>&amp;Number of vCPUs:</value>
</data>
<data name="lblVCPUs.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;lblVCPUs.Name" xml:space="preserve">
<value>lblVCPUs</value>
</data>
@ -643,121 +583,7 @@
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;lblVCPUs.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="lblVcpuWarning.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblVcpuWarning.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lblVcpuWarning.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 41</value>
</data>
<data name="lblVcpuWarning.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 0, 3, 6</value>
</data>
<data name="lblVcpuWarning.Size" type="System.Drawing.Size, System.Drawing">
<value>183, 13</value>
</data>
<data name="lblVcpuWarning.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="lblVcpuWarning.Text" xml:space="preserve">
<value>How can I improve VM performance?</value>
</data>
<data name="lblVcpuWarning.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;lblVcpuWarning.Name" xml:space="preserve">
<value>lblVcpuWarning</value>
</data>
<data name="&gt;&gt;lblVcpuWarning.Type" xml:space="preserve">
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblVcpuWarning.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;lblVcpuWarning.ZOrder" xml:space="preserve">
<value>11</value>
</data>
<data name="lblMemory.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblMemory.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="lblMemory.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lblMemory.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 275</value>
</data>
<data name="lblMemory.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
</data>
<data name="lblMemory.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 20</value>
</data>
<data name="lblMemory.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="lblMemory.Text" xml:space="preserve">
<value>&amp;VM memory:</value>
</data>
<data name="lblMemory.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;lblMemory.Name" xml:space="preserve">
<value>lblMemory</value>
</data>
<data name="&gt;&gt;lblMemory.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblMemory.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;lblMemory.ZOrder" xml:space="preserve">
<value>12</value>
</data>
<data name="VCPUWarningLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="VCPUWarningLabel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="VCPUWarningLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="VCPUWarningLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>185, 60</value>
</data>
<data name="VCPUWarningLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>312, 27</value>
</data>
<data name="VCPUWarningLabel.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="VCPUWarningLabel.Text" xml:space="preserve">
<value>More vCPUs than physical CPUs may lead to reduced VM performance</value>
</data>
<data name="VCPUWarningLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="VCPUWarningLabel.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;VCPUWarningLabel.Name" xml:space="preserve">
<value>VCPUWarningLabel</value>
</data>
<data name="&gt;&gt;VCPUWarningLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;VCPUWarningLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;VCPUWarningLabel.ZOrder" xml:space="preserve">
<value>13</value>
<value>7</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -771,11 +597,11 @@
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 0</value>
</data>
<data name="label1.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 15</value>
<data name="label1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 0, 3, 15</value>
</data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>494, 41</value>
<value>494, 26</value>
</data>
<data name="label1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -793,16 +619,16 @@
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>14</value>
<value>8</value>
</data>
<data name="comboBoxVCPUs.Location" type="System.Drawing.Point, System.Drawing">
<value>129, 63</value>
<value>129, 76</value>
</data>
<data name="comboBoxVCPUs.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 21</value>
</data>
<data name="comboBoxVCPUs.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
<value>2</value>
</data>
<data name="&gt;&gt;comboBoxVCPUs.Name" xml:space="preserve">
<value>comboBoxVCPUs</value>
@ -814,7 +640,97 @@
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;comboBoxVCPUs.ZOrder" xml:space="preserve">
<value>15</value>
<value>9</value>
</data>
<data name="tableLayoutPanelInfo.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="tableLayoutPanelInfo.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="tableLayoutPanelInfo.ColumnCount" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 3</value>
</data>
<data name="pictureBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>16, 16</value>
</data>
<data name="pictureBox1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;pictureBox1.Name" xml:space="preserve">
<value>pictureBox1</value>
</data>
<data name="&gt;&gt;pictureBox1.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox1.Parent" xml:space="preserve">
<value>tableLayoutPanelInfo</value>
</data>
<data name="&gt;&gt;pictureBox1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="labelInfo.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="labelInfo.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labelInfo.Location" type="System.Drawing.Point, System.Drawing">
<value>25, 4</value>
</data>
<data name="labelInfo.Size" type="System.Drawing.Size, System.Drawing">
<value>0, 13</value>
</data>
<data name="labelInfo.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="&gt;&gt;labelInfo.Name" xml:space="preserve">
<value>labelInfo</value>
</data>
<data name="&gt;&gt;labelInfo.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelInfo.Parent" xml:space="preserve">
<value>tableLayoutPanelInfo</value>
</data>
<data name="&gt;&gt;labelInfo.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="tableLayoutPanelInfo.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="tableLayoutPanelInfo.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 41</value>
</data>
<data name="tableLayoutPanelInfo.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 10</value>
</data>
<data name="tableLayoutPanelInfo.RowCount" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="tableLayoutPanelInfo.Size" type="System.Drawing.Size, System.Drawing">
<value>500, 22</value>
</data>
<data name="tableLayoutPanelInfo.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="&gt;&gt;tableLayoutPanelInfo.Name" xml:space="preserve">
<value>tableLayoutPanelInfo</value>
</data>
<data name="&gt;&gt;tableLayoutPanelInfo.Type" xml:space="preserve">
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tableLayoutPanelInfo.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;tableLayoutPanelInfo.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="tableLayoutPanelInfo.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="pictureBox1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="labelInfo" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
@ -826,10 +742,10 @@
<value>0, 0, 0, 0</value>
</data>
<data name="tableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
<value>13</value>
<value>8</value>
</data>
<data name="tableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
<value>500, 500</value>
<value>500, 400</value>
</data>
<data name="tableLayoutPanel1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -847,22 +763,22 @@
<value>0</value>
</data>
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="initialVCPUWarningLabel" Row="6" RowSpan="1" Column="2" ColumnSpan="2" /&gt;&lt;Control Name="comboBoxInitialVCPUs" Row="6" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="labelInitialVCPUs" Row="6" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="labelInvalidVCPUWarning" Row="5" RowSpan="1" Column="1" ColumnSpan="3" /&gt;&lt;Control Name="comboBoxTopology" Row="4" RowSpan="1" Column="1" ColumnSpan="3" /&gt;&lt;Control Name="labelTopology" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="MemWarningLabel" Row="10" RowSpan="2" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="panel2" Row="10" RowSpan="1" Column="1" ColumnSpan="2" /&gt;&lt;Control Name="panel1" Row="9" RowSpan="1" Column="0" ColumnSpan="4" /&gt;&lt;Control Name="lblPriority" Row="8" RowSpan="1" Column="0" ColumnSpan="4" /&gt;&lt;Control Name="lblVCPUs" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lblVcpuWarning" Row="1" RowSpan="1" Column="0" ColumnSpan="4" /&gt;&lt;Control Name="lblMemory" Row="10" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="VCPUWarningLabel" Row="2" RowSpan="2" Column="2" ColumnSpan="2" /&gt;&lt;Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="4" /&gt;&lt;Control Name="comboBoxVCPUs" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,AutoSize,0,Absolute,45,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,20,AutoSize,0,Absolute,20,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,100,Percent,50,Absolute,20" /&gt;&lt;/TableLayoutSettings&gt;</value>
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="warningsTableLayoutPanel" Row="7" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="comboBoxInitialVCPUs" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="labelInitialVCPUs" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="comboBoxTopology" Row="3" RowSpan="1" Column="1" ColumnSpan="2" /&gt;&lt;Control Name="labelTopology" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="panel1" Row="6" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="lblPriority" Row="5" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="lblVCPUs" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="comboBoxVCPUs" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="tableLayoutPanelInfo" Row="1" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,AutoSize,0,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="lblPriority.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lblPriority.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 180</value>
<value>3, 174</value>
</data>
<data name="lblPriority.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 10, 0, 0</value>
<data name="lblPriority.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 20, 3, 0</value>
</data>
<data name="lblPriority.Size" type="System.Drawing.Size, System.Drawing">
<value>179, 23</value>
<value>179, 13</value>
</data>
<data name="lblPriority.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
<value>7</value>
</data>
<data name="lblPriority.Text" xml:space="preserve">
<value>vCPU priority for this virtual machine:</value>
@ -880,7 +796,7 @@
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;lblPriority.ZOrder" xml:space="preserve">
<value>9</value>
<value>6</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
@ -892,13 +808,13 @@
<value>0, 0, 0, 0</value>
</data>
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>500, 500</value>
<value>500, 400</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>500, 500</value>
<value>500, 400</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>CPUMemoryEditPage</value>
<value>CpuMemoryEditPage</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>

View File

@ -898,7 +898,7 @@
<value>500, 500</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>CPUMemoryEditPage</value>
<value>CpuMemoryEditPage</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>

View File

@ -63,7 +63,6 @@ namespace XenAdmin.SettingsPanels
resources.ApplyResources(this.EmailNotificationCheckBox, "EmailNotificationCheckBox");
this.EmailNotificationCheckBox.Name = "EmailNotificationCheckBox";
this.EmailNotificationCheckBox.UseVisualStyleBackColor = false;
this.EmailNotificationCheckBox.CheckedChanged += new System.EventHandler(this.EmailNotificationCheckBox_CheckedChanged);
//
// groupBox1
//
@ -81,9 +80,9 @@ namespace XenAdmin.SettingsPanels
//
// MailLanguageComboBox
//
resources.ApplyResources(this.MailLanguageComboBox, "MailLanguageComboBox");
this.MailLanguageComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.MailLanguageComboBox.FormattingEnabled = true;
resources.ApplyResources(this.MailLanguageComboBox, "MailLanguageComboBox");
this.MailLanguageComboBox.Name = "MailLanguageComboBox";
//
// MailLanguageLabel

View File

@ -35,24 +35,25 @@ using System.Windows.Forms;
using System.Text.RegularExpressions;
using XenAPI;
using XenAdmin.Alerts;
using XenAdmin.Actions;
using XenAdmin.Core;
using XenCenterLib;
namespace XenAdmin.SettingsPanels
{
public partial class PerfmonAlertOptionsPage : UserControl, IEditPage
{
private IXenObject _XenModelObject;
private PerfmonOptionsDefinition _PerfmonOptions;
// match anything with an @ sign in the middle
private static readonly Regex emailRegex = new Regex(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", RegexOptions.IgnoreCase);
private bool _OrigEmailNotificationCheckBox;
private string _OrigEmailAddressTextBox;
private string _OrigSmtpServerAddrTextBox;
private string _OrigSmtpServerPortTextBox;
private string _OrigMailLanguageCode;
private bool _bSupportMailLanguage;
private IXenObject _XenModelObject;
private bool _origEmailNotificationCheckBox;
private string _origEmailAddressTextBox;
private string _origSmtpServerAddrTextBox;
private string _origSmtpServerPortTextBox;
private int _origMailLanguageIndex;
private readonly ToolTip InvalidParamToolTip;
@ -62,117 +63,112 @@ namespace XenAdmin.SettingsPanels
Text = Messages.EMAIL_OPTIONS;
InvalidParamToolTip = new ToolTip();
InvalidParamToolTip.IsBalloon = true;
InvalidParamToolTip.ToolTipIcon = ToolTipIcon.Warning;
InvalidParamToolTip.ToolTipTitle = Messages.INVALID_PARAMETER;
MailLanguageComboBox.DataSource = new BindingSource(PerfmonOptionsDefinition.MailLanguageDataSource(), null);
MailLanguageComboBox.DisplayMember = "Value";
MailLanguageComboBox.ValueMember = "Key";
EmailNotificationCheckBox_CheckedChanged(null, null);
}
public String SubText
{
get
InvalidParamToolTip = new ToolTip
{
if (!EmailNotificationCheckBox.Checked)
return Messages.NONE_DEFINED;
IsBalloon = true,
ToolTipIcon = ToolTipIcon.Warning,
ToolTipTitle = Messages.INVALID_PARAMETER
};
return EmailAddressTextBox.Text;
}
MailLanguageComboBox.Items.Add(new ToStringWrapper<string>(Messages.MAIL_LANGUAGE_ENGLISH_CODE, Messages.MAIL_LANGUAGE_ENGLISH_NAME));
MailLanguageComboBox.Items.Add(new ToStringWrapper<string>(Messages.MAIL_LANGUAGE_CHINESE_CODE, Messages.MAIL_LANGUAGE_CHINESE_NAME));
MailLanguageComboBox.Items.Add(new ToStringWrapper<string>(Messages.MAIL_LANGUAGE_JAPANESE_CODE, Messages.MAIL_LANGUAGE_JAPANESE_NAME));
}
public string SubText => EmailNotificationCheckBox.Checked ? EmailAddressTextBox.Text : Messages.NONE_DEFINED;
public Image Image => Images.StaticImages._000_Email_h32bit_16;
// match anything with an @ sign in the middle
private static readonly Regex emailRegex = new Regex(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", RegexOptions.IgnoreCase);
public static bool IsValidEmail(string s)
private static bool IsValidEmail(string s)
{
return emailRegex.IsMatch(s);
}
private bool IsValidSmtpAddress()
{
return !SmtpServerAddrTextBox.Text.ToCharArray().Any((c) => c >= 128) && SmtpServerAddrTextBox.Text.Trim().Length > 0;
}
public void SetMailLanguageComboBoxValue(String code)
{
if (_bSupportMailLanguage && PerfmonOptionsDefinition.MailLanguageHasCode(code))
MailLanguageComboBox.SelectedValue = code; // Feature supported and code is valid
else
{
// Set default value
if (PerfmonOptionsDefinition.MailLanguageHasCode(BrandManager.PerfAlertMailDefaultLanguage))
MailLanguageComboBox.SelectedValue = BrandManager.PerfAlertMailDefaultLanguage;
else
MailLanguageComboBox.SelectedIndex = 0;
}
return !SmtpServerAddrTextBox.Text.ToCharArray().Any(c => c >= 128) && SmtpServerAddrTextBox.Text.Trim().Length > 0;
}
public void SetXenObjects(IXenObject orig, IXenObject clone)
{
_XenModelObject = clone;
_bSupportMailLanguage = Helpers.InvernessOrGreater(_XenModelObject.Connection);
Repopulate();
Populate();
// Save original settings for change detection
_OrigEmailNotificationCheckBox = EmailNotificationCheckBox.Checked;
_OrigEmailAddressTextBox = EmailAddressTextBox.Text;
_OrigSmtpServerAddrTextBox = SmtpServerAddrTextBox.Text;
_OrigSmtpServerPortTextBox = SmtpServerPortTextBox.Text;
_origEmailNotificationCheckBox = EmailNotificationCheckBox.Checked;
_origEmailAddressTextBox = EmailAddressTextBox.Text;
_origSmtpServerAddrTextBox = SmtpServerAddrTextBox.Text;
_origSmtpServerPortTextBox = SmtpServerPortTextBox.Text;
_origMailLanguageIndex = MailLanguageComboBox.SelectedIndex;
}
public void Repopulate()
private void Populate()
{
if (_XenModelObject == null)
var pool = Helpers.GetPoolOfOne(_XenModelObject?.Connection);
if (pool == null)
return;
try
{
MailLanguageLabel.Visible = MailLanguageComboBox.Visible = _bSupportMailLanguage;
_PerfmonOptions = PerfmonOptionsDefinition.GetPerfmonOptionsDefinitions(_XenModelObject);
if (_PerfmonOptions != null)
{
EmailNotificationCheckBox.Checked = true;
EmailAddressTextBox.Text = _PerfmonOptions.MailDestination;
SmtpServerAddrTextBox.Text = PerfmonOptionsDefinition.GetSmtpServerAddress(_PerfmonOptions.MailHub);
SmtpServerPortTextBox.Text = PerfmonOptionsDefinition.GetSmtpPort(_PerfmonOptions.MailHub);
pool.other_config.TryGetValue(Pool.MAIL_DESTINATION_KEY_NAME, out var mailDestination);
pool.other_config.TryGetValue(Pool.SMTP_MAILHUB_KEY_NAME, out var mailHub);
pool.other_config.TryGetValue(Pool.MAIL_LANGUAGE_KEY_NAME, out var mailLanguageCode);
SetMailLanguageComboBoxValue(_PerfmonOptions.MailLanguageCode);
if (_bSupportMailLanguage) // Save original MailLanguageCode for change detection
_OrigMailLanguageCode = _PerfmonOptions.MailLanguageCode;
else
_OrigMailLanguageCode = null;
}
else
{
SetMailLanguageComboBoxValue(null);
_OrigMailLanguageCode = null;
}
}
catch
EmailNotificationCheckBox.Checked = !string.IsNullOrWhiteSpace(mailDestination) && !string.IsNullOrWhiteSpace(mailHub);
if (!string.IsNullOrWhiteSpace(mailDestination))
EmailAddressTextBox.Text = mailDestination.Trim();
if (!string.IsNullOrWhiteSpace(mailHub))
{
// ignored
string[] words = mailHub.Trim().Split(':');
if (words.Length > 0)
SmtpServerAddrTextBox.Text = words[0];
if (words.Length > 1)
SmtpServerPortTextBox.Text = words[1];
}
bool isLangSupported = Helpers.InvernessOrGreater(pool.Connection);
MailLanguageLabel.Visible = MailLanguageComboBox.Visible = isLangSupported;
int index = -1;
if (isLangSupported && !string.IsNullOrWhiteSpace(mailLanguageCode))
index = IndexOfLangItem(mailLanguageCode.Trim());
if (index == -1)
index = IndexOfLangItem(BrandManager.PerfAlertMailDefaultLanguage);
if (index == -1)
index = 0;
MailLanguageComboBox.SelectedIndex = index;
}
public bool HasChanged
private int IndexOfLangItem(string code)
{
get
if (string.IsNullOrWhiteSpace(code))
return -1;
for (var index = 0; index < MailLanguageComboBox.Items.Count; index++)
{
return ((_OrigEmailNotificationCheckBox != EmailNotificationCheckBox.Checked) ||
(_OrigEmailAddressTextBox != EmailAddressTextBox.Text) ||
(_OrigSmtpServerAddrTextBox != SmtpServerAddrTextBox.Text) ||
(_OrigSmtpServerPortTextBox != SmtpServerPortTextBox.Text) ||
(_bSupportMailLanguage && _OrigMailLanguageCode != MailLanguageComboBox.SelectedValue.ToString()));
var obj = MailLanguageComboBox.Items[index];
if (obj is ToStringWrapper<string> wrapper && wrapper.item.ToLower() == code.ToLower())
return index;
}
return -1;
}
public bool HasChanged =>
_origEmailNotificationCheckBox != EmailNotificationCheckBox.Checked ||
_origEmailAddressTextBox != EmailAddressTextBox.Text ||
_origSmtpServerAddrTextBox != SmtpServerAddrTextBox.Text ||
_origSmtpServerPortTextBox != SmtpServerPortTextBox.Text ||
_origMailLanguageIndex != MailLanguageComboBox.SelectedIndex;
public void ShowLocalValidationMessages()
{
if (!IsValidEmail(EmailAddressTextBox.Text))
@ -205,20 +201,9 @@ namespace XenAdmin.SettingsPanels
}
}
public bool ValidToSave
{
get
{
if (EmailNotificationCheckBox.Checked)
{
return IsValidEmail(EmailAddressTextBox.Text) && Util.IsValidPort(SmtpServerPortTextBox.Text) && IsValidSmtpAddress();
}
else
{
return true;
}
}
}
public bool ValidToSave =>
!EmailNotificationCheckBox.Checked ||
IsValidEmail(EmailAddressTextBox.Text) && Util.IsValidPort(SmtpServerPortTextBox.Text) && IsValidSmtpAddress();
public void Cleanup()
{
@ -227,25 +212,21 @@ namespace XenAdmin.SettingsPanels
public AsyncAction SaveSettings()
{
PerfmonOptionsDefinition perfmonOptions = null; // a null value will clear the definitions
// a null value will clear the definitions
string mailDestination = null;
string mailHub = null;
string mailLangCode = null;
if (EmailNotificationCheckBox.Checked)
{
string smtpMailHub = SmtpServerAddrTextBox.Text + ":" + SmtpServerPortTextBox.Text;
string mailLanguageCode = null;
if (_bSupportMailLanguage && null != MailLanguageComboBox.SelectedValue)
mailLanguageCode = MailLanguageComboBox.SelectedValue.ToString();
perfmonOptions = new PerfmonOptionsDefinition(smtpMailHub, EmailAddressTextBox.Text, mailLanguageCode);
mailDestination = EmailAddressTextBox.Text;
mailHub = SmtpServerAddrTextBox.Text + ":" + SmtpServerPortTextBox.Text;
if (MailLanguageComboBox.Visible && MailLanguageComboBox.SelectedValue != null)
mailLangCode = MailLanguageComboBox.SelectedValue.ToString();
}
return new PerfmonOptionsDefinitionAction(_XenModelObject.Connection, perfmonOptions, true);
}
private void EmailNotificationCheckBox_CheckedChanged(object sender, EventArgs e)
{
EmailAddressTextBox.Enabled = EmailNotificationCheckBox.Checked;
SmtpServerAddrTextBox.Enabled = EmailNotificationCheckBox.Checked;
SmtpServerPortTextBox.Enabled = EmailNotificationCheckBox.Checked;
MailLanguageComboBox.Enabled = EmailNotificationCheckBox.Checked;
return new PerfmonOptionsDefinitionAction(_XenModelObject.Connection, mailDestination, mailHub, mailLangCode, true);
}
}
}

View File

@ -59,46 +59,46 @@
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
<xsd:element msdata:IsDataSet="true" name="root">
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="value" type="xsd:string"/>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="mimetype" type="xsd:string"/>
<xsd:attribute ref="xml:space"/>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" msdata:Ordinal="1" name="value" type="xsd:string"/>
<xsd:element minOccurs="0" msdata:Ordinal="2" name="comment" type="xsd:string"/>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute msdata:Ordinal="1" name="name" type="xsd:string" use="required"/>
<xsd:attribute msdata:Ordinal="3" name="type" type="xsd:string"/>
<xsd:attribute msdata:Ordinal="4" name="mimetype" type="xsd:string"/>
<xsd:attribute ref="xml:space"/>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" msdata:Ordinal="1" name="value" type="xsd:string"/>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
@ -117,409 +117,65 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?>&lt;TableLayoutSettings>&lt;Controls>&lt;Control Name="SendEmailNoteLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" />&lt;Control Name="EmailNotificationCheckBox" Row="1" RowSpan="1" Column="0" ColumnSpan="1" />&lt;Control Name="groupBox1" Row="2" RowSpan="1" Column="0" ColumnSpan="1" />&lt;/Controls>&lt;Columns Styles="Percent,100" />&lt;Rows Styles="AutoSize,0,AutoSize,0,Percent,100,Absolute,20" />&lt;/TableLayoutSettings></value>
<data name="SendEmailNoteLabel.Text" xml:space="preserve">
<value>サーバーによりシステム アラートが生成されたときにメールが送信されるように設定できます。このプールまたはスタンドアロン サーバーでこの機能を有効にするには、アラート通知メールの送信先アドレスを入力してください。</value>
</data>
<data name="EmailAddressLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="EmailNotificationCheckBox.Size" type="System.Drawing.Size, System.Drawing">
<value>160, 17</value>
<value>164, 17</value>
</data>
<data name="EmailNotificationCheckBox.Text" xml:space="preserve">
<value>アラートをメールで送信する(&amp;E)</value>
</data>
<data name="SendEmailNoteLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="groupBox1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>22, 5, 3, 3</value>
</data>
<data name="&gt;&gt;MailLanguageComboBox.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;SmtpServerPortTextBox.Name" xml:space="preserve">
<value>SmtpServerPortTextBox</value>
</data>
<data name="SmtpServerLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>74, 13</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<data name="EmailNotificationCheckBox.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;SmtpServerLabel.Name" xml:space="preserve">
<value>SmtpServerLabel</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>PerfmonAlertOptionsPage</value>
</data>
<data name="SmtpServerPortTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>388, 45</value>
</data>
<data name="MailLanguageComboBox.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="SmtpPortLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="SmtpServerPortTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 20</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="MailLanguageLabel.Text" xml:space="preserve">
<value>メール言語(&amp;L):</value>
</data>
<data name="&gt;&gt;MailLanguageComboBox.Name" xml:space="preserve">
<value>MailLanguageComboBox</value>
</data>
<data name="tableLayoutPanel1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="SendEmailNoteLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="MailLanguageLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>76, 13</value>
</data>
<data name="tableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
<value>485, 333</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="SmtpServerLabel.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="MailLanguageLabel.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="groupBox1.Text" xml:space="preserve">
<value>送信先</value>
</data>
<data name="tableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="SmtpServerAddrTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>210, 20</value>
</data>
<data name="SmtpServerLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;SmtpServerLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SmtpPortLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>29, 13</value>
</data>
<data name="SmtpServerPortTextBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 0</value>
</data>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>31</value>
</data>
<data name="SmtpServerLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="MailLanguageLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="MailLanguageLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="EmailAddressLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="EmailAddressLabel.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="groupBox1.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="MailLanguageComboBox.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
</data>
<data name="EmailNotificationCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="SmtpServerPortTextBox.Text" xml:space="preserve">
<value>25</value>
</data>
<data name="SmtpServerAddrTextBox.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Type" xml:space="preserve">
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="MailLanguageLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="&gt;&gt;SmtpServerPortTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SmtpPortLabel.Text" xml:space="preserve">
<value>ポート(&amp;P):</value>
</data>
<data name="SmtpPortLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.Name" xml:space="preserve">
<value>EmailAddressLabel</value>
</data>
<data name="&gt;&gt;MailLanguageComboBox.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;SmtpServerPortTextBox.Parent" xml:space="preserve">
<value>groupBox1</value>
<data name="MailLanguageComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>113, 71</value>
</data>
<data name="MailLanguageComboBox.Size" type="System.Drawing.Size, System.Drawing">
<value>210, 21</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="MailLanguageLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>74, 13</value>
</data>
<data name="SmtpServerLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 48</value>
<data name="MailLanguageLabel.Text" xml:space="preserve">
<value>メール言語(&amp;L):</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.Name" xml:space="preserve">
<value>SmtpServerAddrTextBox</value>
<data name="SmtpPortLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>51, 13</value>
</data>
<data name="groupBox1.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>5, 9, 5, 0</value>
<data name="SmtpPortLabel.Text" xml:space="preserve">
<value>ポート(&amp;P):</value>
</data>
<data name="&gt;&gt;EmailNotificationCheckBox.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
<data name="SmtpServerPortTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>388, 45</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.Name" xml:space="preserve">
<value>SendEmailNoteLabel</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;groupBox1.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>22, 77</value>
</data>
<data name="SmtpServerLabel.Text" xml:space="preserve">
<value>SMTP サーバー(&amp;S):</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.Name" xml:space="preserve">
<value>MailLanguageLabel</value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>455, 108</value>
</data>
<data name="SmtpServerLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="SmtpServerAddrTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="&gt;&gt;SmtpServerLabel.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="SendEmailNoteLabel.Text" xml:space="preserve">
<value>サーバーによりシステム アラートが生成されたときにメールが送信されるように設定できます。このプールまたはスタンドアロン サーバーでこの機能を有効にするには、アラート通知メールの送信先アドレスを入力してください。</value>
</data>
<data name="SendEmailNoteLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 10</value>
<data name="SmtpServerPortTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 20</value>
</data>
<data name="EmailAddressTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>113, 19</value>
</data>
<data name="MailLanguageComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>113, 71</value>
<data name="EmailAddressTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>334, 20</value>
</data>
<data name="EmailAddressLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Name" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;MailLanguageComboBox.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="&gt;&gt;groupBox1.Type" xml:space="preserve">
<value>XenAdmin.Controls.DecentGroupBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;EmailNotificationCheckBox.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="SmtpServerPortTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="EmailAddressTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="&gt;&gt;SmtpServerLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="EmailNotificationCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.Name" xml:space="preserve">
<value>SmtpPortLabel</value>
</data>
<data name="MailLanguageLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 74</value>
</data>
<data name="SmtpServerPortTextBox.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
<data name="EmailAddressLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>92, 13</value>
</data>
<data name="EmailAddressLabel.Text" xml:space="preserve">
<value>メール アドレス(&amp;M):</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>485, 333</value>
</data>
<data name="MailLanguageLabel.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="SmtpPortLabel.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="SmtpPortLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>330, 48</value>
</data>
<data name="EmailAddressTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>334, 20</value>
</data>
<data name="SmtpServerAddrTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>113, 45</value>
</data>
<data name="EmailAddressLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 13</value>
<data name="SmtpServerAddrTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>210, 20</value>
</data>
<data name="SendEmailNoteLabel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
<data name="SmtpServerLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>96, 13</value>
</data>
<data name="SendEmailNoteLabel.TabIndex" type="System.Int32, mscorlib">
<value>32</value>
<data name="SmtpServerLabel.Text" xml:space="preserve">
<value>SMTP サーバー(&amp;S):</value>
</data>
<data name="EmailAddressTextBox.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
<data name="groupBox1.Text" xml:space="preserve">
<value>送信先</value>
</data>
<data name="SendEmailNoteLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="groupBox1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;EmailNotificationCheckBox.Name" xml:space="preserve">
<value>EmailNotificationCheckBox</value>
</data>
<data name="&gt;&gt;groupBox1.Name" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="SmtpPortLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="&gt;&gt;EmailNotificationCheckBox.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SmtpPortLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;SmtpServerPortTextBox.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="SmtpServerAddrTextBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 0</value>
</data>
<data name="&gt;&gt;groupBox1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="EmailAddressLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 22</value>
</data>
<data name="MailLanguageComboBox.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
<value>No</value>
</data>
<data name="SendEmailNoteLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>485, 39</value>
</data>
<data name="tableLayoutPanel1.TabIndex" type="System.Int32, mscorlib">
<value>32</value>
</data>
<data name="EmailNotificationCheckBox.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 52</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.Name" xml:space="preserve">
<value>EmailAddressTextBox</value>
</data>
<data name="SmtpPortLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>96, 96</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>ja</value>
</metadata>
</root>

View File

@ -117,409 +117,394 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="SendEmailNoteLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="SendEmailNoteLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="EmailNotificationCheckBox" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="groupBox1" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,Percent,100,Absolute,20" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="EmailAddressLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="EmailNotificationCheckBox.Size" type="System.Drawing.Size, System.Drawing">
<value>160, 17</value>
</data>
<data name="EmailNotificationCheckBox.Text" xml:space="preserve">
<value>Send &amp;email alert notifications</value>
<data name="SendEmailNoteLabel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="SendEmailNoteLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.ZOrder" xml:space="preserve">
<value>2</value>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="SendEmailNoteLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
<data name="SendEmailNoteLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 10</value>
</data>
<data name="groupBox1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>22, 5, 3, 3</value>
<data name="SendEmailNoteLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>485, 26</value>
</data>
<data name="&gt;&gt;MailLanguageComboBox.ZOrder" xml:space="preserve">
<data name="SendEmailNoteLabel.TabIndex" type="System.Int32, mscorlib">
<value>32</value>
</data>
<data name="SendEmailNoteLabel.Text" xml:space="preserve">
<value>If you want to be notified via email when alerts are generated for your system's resources, enter an address where email notifications will be sent.</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.Name" xml:space="preserve">
<value>SendEmailNoteLabel</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;SmtpServerPortTextBox.Name" xml:space="preserve">
<value>SmtpServerPortTextBox</value>
<data name="EmailNotificationCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="SmtpServerLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>74, 13</value>
<data name="EmailNotificationCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="EmailNotificationCheckBox.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 39</value>
</data>
<data name="EmailNotificationCheckBox.Size" type="System.Drawing.Size, System.Drawing">
<value>160, 17</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="EmailNotificationCheckBox.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;SmtpServerLabel.Name" xml:space="preserve">
<value>SmtpServerLabel</value>
<data name="EmailNotificationCheckBox.Text" xml:space="preserve">
<value>Send email alert &amp;notifications</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>PerfmonAlertOptionsPage</value>
<data name="&gt;&gt;EmailNotificationCheckBox.Name" xml:space="preserve">
<value>EmailNotificationCheckBox</value>
</data>
<data name="SmtpServerPortTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>368, 45</value>
<data name="&gt;&gt;EmailNotificationCheckBox.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;EmailNotificationCheckBox.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;EmailNotificationCheckBox.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="groupBox1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="groupBox1.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="MailLanguageComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>100, 71</value>
</data>
<data name="MailLanguageComboBox.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
<value>No</value>
</data>
<data name="MailLanguageComboBox.Size" type="System.Drawing.Size, System.Drawing">
<value>220, 21</value>
</data>
<data name="MailLanguageComboBox.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
</data>
<data name="MailLanguageComboBox.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="SmtpPortLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="SmtpServerPortTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>79, 20</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="MailLanguageLabel.Text" xml:space="preserve">
<value>Mail &amp;language:</value>
</data>
<data name="&gt;&gt;MailLanguageComboBox.Name" xml:space="preserve">
<value>MailLanguageComboBox</value>
</data>
<data name="tableLayoutPanel1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
<data name="&gt;&gt;MailLanguageComboBox.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SendEmailNoteLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
<data name="&gt;&gt;MailLanguageComboBox.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;MailLanguageComboBox.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="MailLanguageLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="MailLanguageLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="MailLanguageLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 74</value>
</data>
<data name="MailLanguageLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>76, 13</value>
</data>
<data name="tableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
<value>485, 333</value>
<data name="MailLanguageLabel.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.Parent" xml:space="preserve">
<data name="MailLanguageLabel.Text" xml:space="preserve">
<value>&amp;Mail language:</value>
</data>
<data name="MailLanguageLabel.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.Name" xml:space="preserve">
<value>MailLanguageLabel</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="SmtpServerLabel.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
<data name="SmtpPortLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="MailLanguageLabel.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="groupBox1.Text" xml:space="preserve">
<value>Delivery address</value>
</data>
<data name="tableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="SmtpServerAddrTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>220, 20</value>
</data>
<data name="SmtpServerLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;SmtpServerLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SmtpPortLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>29, 13</value>
</data>
<data name="SmtpServerPortTextBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 0</value>
</data>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>31</value>
</data>
<data name="SmtpServerLabel.AutoSize" type="System.Boolean, mscorlib">
<data name="SmtpPortLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="MailLanguageLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="MailLanguageLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="EmailAddressLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="EmailAddressLabel.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="groupBox1.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="MailLanguageComboBox.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
</data>
<data name="EmailNotificationCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="SmtpServerPortTextBox.Text" xml:space="preserve">
<value>25</value>
</data>
<data name="SmtpServerAddrTextBox.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Type" xml:space="preserve">
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="MailLanguageLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<data name="SmtpPortLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="&gt;&gt;SmtpServerPortTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SmtpPortLabel.Text" xml:space="preserve">
<value>&amp;Port:</value>
<data name="SmtpPortLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>330, 48</value>
</data>
<data name="SmtpPortLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.Name" xml:space="preserve">
<value>EmailAddressLabel</value>
<data name="SmtpPortLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>29, 13</value>
</data>
<data name="&gt;&gt;MailLanguageComboBox.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="SmtpPortLabel.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="SmtpPortLabel.Text" xml:space="preserve">
<value>&amp;Port:</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.Name" xml:space="preserve">
<value>SmtpPortLabel</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="SmtpServerPortTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="SmtpServerPortTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>368, 45</value>
</data>
<data name="SmtpServerPortTextBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 0</value>
</data>
<data name="SmtpServerPortTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>79, 20</value>
</data>
<data name="SmtpServerPortTextBox.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="SmtpServerPortTextBox.Text" xml:space="preserve">
<value>25</value>
</data>
<data name="&gt;&gt;SmtpServerPortTextBox.Name" xml:space="preserve">
<value>SmtpServerPortTextBox</value>
</data>
<data name="&gt;&gt;SmtpServerPortTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;SmtpServerPortTextBox.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="MailLanguageComboBox.Size" type="System.Drawing.Size, System.Drawing">
<value>220, 21</value>
<data name="&gt;&gt;SmtpServerPortTextBox.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SmtpServerLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 48</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.Name" xml:space="preserve">
<value>SmtpServerAddrTextBox</value>
</data>
<data name="groupBox1.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>5, 9, 5, 0</value>
</data>
<data name="&gt;&gt;EmailNotificationCheckBox.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;SendEmailNoteLabel.Name" xml:space="preserve">
<value>SendEmailNoteLabel</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;groupBox1.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>22, 77</value>
</data>
<data name="SmtpServerLabel.Text" xml:space="preserve">
<value>&amp;SMTP Server:</value>
</data>
<data name="&gt;&gt;MailLanguageLabel.Name" xml:space="preserve">
<value>MailLanguageLabel</value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>455, 108</value>
</data>
<data name="SmtpServerLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="SmtpServerAddrTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<data name="EmailAddressTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="&gt;&gt;SmtpServerLabel.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="SendEmailNoteLabel.Text" xml:space="preserve">
<value>The server can update you by email regarding system alerts that are being generated by your managed servers. To enable this feature, enter an address where email notifications will be sent for the servers and VMs in this pool (or for this standalone server).</value>
</data>
<data name="SendEmailNoteLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 10</value>
</data>
<data name="EmailAddressTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>100, 19</value>
</data>
<data name="MailLanguageComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>100, 71</value>
<data name="EmailAddressTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>347, 20</value>
</data>
<data name="EmailAddressTextBox.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.Name" xml:space="preserve">
<value>EmailAddressTextBox</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="EmailAddressLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Name" xml:space="preserve">
<value>tableLayoutPanel1</value>
<data name="EmailAddressLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="&gt;&gt;MailLanguageComboBox.Parent" xml:space="preserve">
<data name="EmailAddressLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 22</value>
</data>
<data name="EmailAddressLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 13</value>
</data>
<data name="EmailAddressLabel.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="EmailAddressLabel.Text" xml:space="preserve">
<value>&amp;Email address:</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.Name" xml:space="preserve">
<value>EmailAddressLabel</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="SmtpServerAddrTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="SmtpServerAddrTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>100, 45</value>
</data>
<data name="SmtpServerAddrTextBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 0</value>
</data>
<data name="SmtpServerAddrTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>220, 20</value>
</data>
<data name="SmtpServerAddrTextBox.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.Name" xml:space="preserve">
<value>SmtpServerAddrTextBox</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;SmtpServerAddrTextBox.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="&gt;&gt;groupBox1.Type" xml:space="preserve">
<value>XenAdmin.Controls.DecentGroupBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<data name="SmtpServerLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;EmailNotificationCheckBox.ZOrder" xml:space="preserve">
<value>1</value>
<data name="SmtpServerLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="SmtpServerPortTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
<data name="SmtpServerLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 48</value>
</data>
<data name="EmailAddressTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
<data name="SmtpServerLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>74, 13</value>
</data>
<data name="SmtpServerLabel.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="SmtpServerLabel.Text" xml:space="preserve">
<value>&amp;SMTP Server:</value>
</data>
<data name="&gt;&gt;SmtpServerLabel.Name" xml:space="preserve">
<value>SmtpServerLabel</value>
</data>
<data name="&gt;&gt;SmtpServerLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;SmtpServerLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="EmailNotificationCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.Name" xml:space="preserve">
<value>SmtpPortLabel</value>
</data>
<data name="MailLanguageLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 74</value>
</data>
<data name="SmtpServerPortTextBox.TabIndex" type="System.Int32, mscorlib">
<data name="&gt;&gt;SmtpServerLabel.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="EmailAddressLabel.Text" xml:space="preserve">
<value>E&amp;mail address:</value>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>22, 64</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>485, 333</value>
<data name="groupBox1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>22, 5, 3, 3</value>
</data>
<data name="MailLanguageLabel.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
<data name="groupBox1.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>5, 9, 5, 0</value>
</data>
<data name="&gt;&gt;EmailAddressLabel.ZOrder" xml:space="preserve">
<value>5</value>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>455, 108</value>
</data>
<data name="SmtpPortLabel.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>31</value>
</data>
<data name="SmtpPortLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>330, 48</value>
</data>
<data name="EmailAddressTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>347, 20</value>
</data>
<data name="SmtpServerAddrTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>100, 45</value>
</data>
<data name="EmailAddressLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 13</value>
</data>
<data name="SendEmailNoteLabel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="SendEmailNoteLabel.TabIndex" type="System.Int32, mscorlib">
<value>32</value>
</data>
<data name="EmailAddressTextBox.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="SendEmailNoteLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;SmtpPortLabel.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="groupBox1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;EmailNotificationCheckBox.Name" xml:space="preserve">
<value>EmailNotificationCheckBox</value>
<data name="groupBox1.Text" xml:space="preserve">
<value>Delivery address</value>
</data>
<data name="&gt;&gt;groupBox1.Name" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="SmtpPortLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
<data name="&gt;&gt;groupBox1.Type" xml:space="preserve">
<value>XenAdmin.Controls.DecentGroupBox, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;EmailNotificationCheckBox.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SmtpPortLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;SmtpServerPortTextBox.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="SmtpServerAddrTextBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 0</value>
<data name="&gt;&gt;groupBox1.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;groupBox1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="EmailAddressLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 22</value>
<data name="tableLayoutPanel1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="MailLanguageComboBox.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
<value>No</value>
<data name="tableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="SendEmailNoteLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>485, 39</value>
<data name="tableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
<value>485, 333</value>
</data>
<data name="tableLayoutPanel1.TabIndex" type="System.Int32, mscorlib">
<value>32</value>
</data>
<data name="EmailNotificationCheckBox.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 52</value>
<data name="&gt;&gt;tableLayoutPanel1.Name" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;EmailAddressTextBox.Name" xml:space="preserve">
<value>EmailAddressTextBox</value>
<data name="&gt;&gt;tableLayoutPanel1.Type" xml:space="preserve">
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SmtpPortLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
<data name="&gt;&gt;tableLayoutPanel1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>96, 96</value>
<data name="&gt;&gt;tableLayoutPanel1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="SendEmailNoteLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="EmailNotificationCheckBox" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="groupBox1" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,Percent,100,Absolute,20" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>ja</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>96, 96</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>485, 333</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>PerfmonAlertOptionsPage</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@ -469,7 +469,6 @@ namespace XenAdmin.Wizards.CrossPoolMigrateWizard
summary = new VmTitleSummary(summary, pair.Value);
summary = new DestinationPoolSummary(summary, pair.Value, TargetConnection);
summary = new TargetServerSummary(summary, pair.Value, TargetConnection);
summary = new TransferNetworkSummary(summary, m_pageTransferNetwork.NetworkUuid.Value);
summary = new StorageSummary(summary, pair.Value, xenConnection);
summary = new NetworkSummary(summary, pair.Value, xenConnection);

View File

@ -129,8 +129,8 @@
//
// pictureBox1
//
resources.ApplyResources(this.pictureBox1, "pictureBox1");
this.pictureBox1.Image = global::XenAdmin.Properties.Resources._000_WarningAlert_h32bit_32;
resources.ApplyResources(this.pictureBox1, "pictureBox1");
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.TabStop = false;
//

View File

@ -49,7 +49,6 @@ namespace XenAdmin.Wizards.GenericPages
internal abstract partial class SelectMultipleVMDestinationPage : XenTabPage
{
private Dictionary<string, VmMapping> m_vmMappings;
public IXenObject SelectedTarget { get; set; }
private bool updatingDestinationCombobox;
private bool restoreGridHomeServerSelection;
private bool updatingHomeServerList;
@ -58,6 +57,7 @@ namespace XenAdmin.Wizards.GenericPages
private readonly CollectionChangeEventHandler Host_CollectionChangedWithInvoke;
private string _preferredHomeRef;
private IXenObject _selectedTargetPool;
private IXenObject _selectedTarget;
#region Nested classes
@ -121,8 +121,24 @@ namespace XenAdmin.Wizards.GenericPages
get => _selectedTargetPool;
private set
{
var oldTargetPool = _selectedTargetPool;
_selectedTargetPool = value;
OnChosenItemChanged();
if (oldTargetPool?.opaque_ref != _selectedTargetPool?.opaque_ref)
OnSelectedTargetPoolChanged();
}
}
public IXenObject SelectedTarget
{
get => _selectedTarget;
set
{
var oldTarget = _selectedTarget;
_selectedTarget = value;
if (oldTarget?.opaque_ref != SelectedTarget?.opaque_ref)
OnSelectedTargetChanged();
}
}
@ -143,9 +159,14 @@ namespace XenAdmin.Wizards.GenericPages
/// </summary>
protected abstract string TargetServerSelectionIntroText { get; }
protected virtual void OnChosenItemChanged()
protected virtual void OnSelectedTargetPoolChanged()
{ }
protected virtual void OnSelectedTargetChanged()
{
}
protected void ShowWarning(string warningText)
{
if (string.IsNullOrEmpty(warningText))
@ -208,15 +229,15 @@ namespace XenAdmin.Wizards.GenericPages
{
foreach (DataGridViewRow row in m_dataGridView.Rows)
{
string sysId = (string)row.Cells[0].Tag;
var sysId = (string)row.Cells[0].Tag;
if (m_vmMappings.ContainsKey(sysId))
{
var mapping = m_vmMappings[sysId];
DataGridViewEnableableComboBoxCell cbCell = row.Cells[m_colTarget.Index] as DataGridViewEnableableComboBoxCell;
var cbCell = row.Cells[m_colTarget.Index] as DataGridViewEnableableComboBoxCell;
System.Diagnostics.Debug.Assert(cbCell != null, "ComboBox cell was not found");
IEnableableXenObjectComboBoxItem selectedItem = cbCell.Value as IEnableableXenObjectComboBoxItem;
var selectedItem = cbCell.Value as IEnableableXenObjectComboBoxItem;
System.Diagnostics.Debug.Assert(selectedItem != null, "Vm has no target mapped");
var type = selectedItem.Item.GetType();
@ -231,7 +252,7 @@ namespace XenAdmin.Wizards.GenericPages
return m_vmMappings;
}
set { m_vmMappings = value; }
set => m_vmMappings = value;
}
#endregion
@ -257,8 +278,7 @@ namespace XenAdmin.Wizards.GenericPages
foreach (var item in m_comboBoxConnection.Items)
{
DelayLoadingOptionComboBoxItem tempItem = item as DelayLoadingOptionComboBoxItem;
if (tempItem != null)
if (item is DelayLoadingOptionComboBoxItem tempItem)
tempItem.ReasonUpdated -= DelayLoadedComboBoxItem_ReasonChanged;
}
m_comboBoxConnection.Items.Clear();
@ -290,11 +310,11 @@ namespace XenAdmin.Wizards.GenericPages
{
DelayLoadingOptionComboBoxItem item = null;
Pool pool = Helpers.GetPool(xenConnection);
var pool = Helpers.GetPool(xenConnection);
if (pool == null)
{
Host host = Helpers.GetCoordinator(xenConnection);
var host = Helpers.GetCoordinator(xenConnection);
if (host != null)
{
@ -345,7 +365,7 @@ namespace XenAdmin.Wizards.GenericPages
{
foreach (DataGridViewRow row in m_dataGridView.Rows)
{
string sysId = (string)row.Cells[m_colVmName.Index].Tag;
var sysId = (string)row.Cells[m_colVmName.Index].Tag;
if (m_vmMappings.TryGetValue(sysId, out var mapping) &&
row.Cells[m_colTarget.Index] is DataGridViewEnableableComboBoxCell cbCell)
@ -485,17 +505,16 @@ namespace XenAdmin.Wizards.GenericPages
Program.Invoke(this, () =>
{
int index = m_comboBoxConnection.Items.IndexOf(item);
var index = m_comboBoxConnection.Items.IndexOf(item);
if (index < 0 || index >= m_comboBoxConnection.Items.Count)
return;
if (updatingDestinationCombobox || updatingHomeServerList)
return;
int selectedIndex = m_comboBoxConnection.SelectedIndex;
var selectedIndex = m_comboBoxConnection.SelectedIndex;
var tempItem = m_comboBoxConnection.Items[index] as DelayLoadingOptionComboBoxItem;
if (tempItem == null)
if (!(m_comboBoxConnection.Items[index] is DelayLoadingOptionComboBoxItem tempItem))
throw new NullReferenceException("Trying to update delay loaded reason but failed to extract reason");
tempItem.CopyFrom(item);
@ -527,8 +546,7 @@ namespace XenAdmin.Wizards.GenericPages
if (item == null)
throw new NullReferenceException("Trying to update delay loaded reason but failed to extract reason");
var cb = item.ParentComboBox as DataGridViewEnableableComboBoxCell;
if (cb == null)
if (!(item.ParentComboBox is DataGridViewEnableableComboBoxCell cb))
return;
Program.Invoke(this, () =>
@ -595,7 +613,7 @@ namespace XenAdmin.Wizards.GenericPages
//If the item is delay loading and them item is disabled, null the selection made
//and clear the table containing server data
IEnableableXenObjectComboBoxItem item = m_comboBoxConnection.SelectedItem as IEnableableXenObjectComboBoxItem;
var item = m_comboBoxConnection.SelectedItem as IEnableableXenObjectComboBoxItem;
if (item != null && !item.Enabled)
{
m_comboBoxConnection.SelectedIndex = -1;
@ -604,8 +622,7 @@ namespace XenAdmin.Wizards.GenericPages
return;
}
AddHostRunningComboBoxItem exeItem = m_comboBoxConnection.SelectedItem as AddHostRunningComboBoxItem;
if (exeItem != null && !updatingDestinationCombobox)
if (m_comboBoxConnection.SelectedItem is AddHostRunningComboBoxItem exeItem && !updatingDestinationCombobox)
exeItem.RunCommand(this);
else if (!updatingDestinationCombobox)
@ -643,8 +660,7 @@ namespace XenAdmin.Wizards.GenericPages
m_dataGridView.BeginEdit(false);
var editingControl = m_dataGridView.EditingControl as ComboBox;
if (editingControl != null)
if (m_dataGridView.EditingControl is ComboBox editingControl)
editingControl.DroppedDown = true;
}
@ -699,8 +715,7 @@ namespace XenAdmin.Wizards.GenericPages
{
foreach (var item in m_comboBoxConnection.Items)
{
DelayLoadingOptionComboBoxItem comboBoxItem = item as DelayLoadingOptionComboBoxItem;
if (comboBoxItem != null)
if (item is DelayLoadingOptionComboBoxItem comboBoxItem)
comboBoxItem.CancelFilters();
}
}

View File

@ -300,9 +300,6 @@
<data name="tableLayoutPanelWarning.ColumnCount" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="pictureBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 3</value>
</data>

View File

@ -166,46 +166,6 @@ namespace XenAdmin.Wizards.GenericPages
}
}
public class TargetServerSummary : MappingSummaryDecorator
{
private readonly VmMapping mapping;
private readonly IXenConnection connection;
public TargetServerSummary(MappingSummary summary, VmMapping mapping, IXenConnection connection)
: base(summary)
{
this.mapping = mapping;
this.connection = connection;
}
public override List<SummaryDetails> Details
{
get
{
List<SummaryDetails> decoratedSummary = summary.Details;
decoratedSummary.Add(new SummaryDetails(Messages.CPM_SUMMARY_KEY_HOME_SERVER, ResolveLabel()));
return decoratedSummary;
}
}
private string ResolveLabel()
{
if (mapping.XenRef is XenRef<Host>)
{
Host targetHost = connection.Resolve(mapping.XenRef as XenRef<Host>);
if (targetHost == null)
{
return Messages.UNKNOWN;
}
return mapping.TargetName;
}
return Messages.CPM_SUMMARY_UNSET;
}
}
public class StorageSummary : MappingSummaryDecorator
{
private readonly VmMapping mapping;
@ -355,9 +315,6 @@ namespace XenAdmin.Wizards.GenericPages
this.summary = summary;
}
public override List<SummaryDetails> Details
{
get { return summary != null ? summary.Details : new List<SummaryDetails>(); }
}
public override List<SummaryDetails> Details => summary != null ? summary.Details : new List<SummaryDetails>();
}
}

View File

@ -87,10 +87,17 @@ namespace XenAdmin.Wizards.ImportWizard
public Func<IEnumerable<KeyValuePair<string, string>>> SummaryRetriever { private get; set; }
private bool _canStartVmsAutomatically = true;
public bool CanStartVmsAutomatically
{
get => _canStartVmsAutomatically;
set => _canStartVmsAutomatically = m_checkBoxStartVms.Enabled = m_checkBoxStartVms.Checked = value;
}
/// <summary>
/// Do the action described after the import/export has finished?
/// </summary>
public bool StartVmsAutomatically => m_checkBoxStartVms.Visible && m_checkBoxStartVms.Checked;
public bool StartVmsAutomatically => CanStartVmsAutomatically && m_checkBoxStartVms.Visible && m_checkBoxStartVms.Checked;
public bool ShowStartVmsGroupBox
{

View File

@ -33,6 +33,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using XenAdmin.Actions.OvfActions;
using XenAdmin.Core;
using XenAdmin.Network;
using XenAdmin.Wizards.GenericPages;
using XenAdmin.Wizards.ImportWizard.Filters;
@ -49,12 +50,16 @@ namespace XenAdmin.Wizards.ImportWizard
private List<Xen_ConfigurationSettingData_Type> vgpuSettings = new List<Xen_ConfigurationSettingData_Type>();
private List<Xen_ConfigurationSettingData_Type> hardwarePlatformSettings = new List<Xen_ConfigurationSettingData_Type>();
private List<Xen_ConfigurationSettingData_Type> vendorDeviceSettings = new List<Xen_ConfigurationSettingData_Type>();
private int _ovfMaxVCpusCount;
private long _ovfMemory;
private readonly List<long> _ovfVCpusCount;
public event Action<IXenConnection> ConnectionSelectionChanged;
public ImportSelectHostPage()
{
InitializeText();
ShowWarning(null);
_ovfVCpusCount = new List<long>();
}
#region XenTabPage overrides
@ -108,6 +113,52 @@ namespace XenAdmin.Wizards.ImportWizard
if (data == null)
continue;
_ovfVCpusCount.Clear();
foreach (var rasdType in vhs.Item)
{
// Processor
if (rasdType.ResourceType.Value == 3 &&
int.TryParse(rasdType.VirtualQuantity.Value.ToString(), out var vCpusCount))
{
_ovfVCpusCount.Add(vCpusCount);
if (_ovfMaxVCpusCount < vCpusCount)
{
_ovfMaxVCpusCount = vCpusCount;
}
}
// Memory
if (rasdType.ResourceType.Value == 4 && double.TryParse(rasdType.VirtualQuantity.Value.ToString(), out var memory))
{
//The default memory unit is MB (2^20), however, the RASD may contain a different
//one with format byte*memoryBase^memoryPower (byte being a literal string)
double memoryBase = 2.0;
double memoryPower = 20.0;
if (rasdType.AllocationUnits.Value.ToLower().StartsWith("byte"))
{
string[] a1 = rasdType.AllocationUnits.Value.Split('*', '^');
if (a1.Length == 3)
{
if (!double.TryParse(a1[1].Trim(), out memoryBase))
memoryBase = 2.0;
if (!double.TryParse(a1[2].Trim(), out memoryPower))
memoryPower = 20.0;
}
}
double memoryMultiplier = Math.Pow(memoryBase, memoryPower);
memory *= memoryMultiplier;
if (memory > long.MaxValue)
memory = long.MaxValue;
if (_ovfMemory < memory)
_ovfMemory = (long)memory;
}
}
foreach (var s in data)
{
if (s.Name == "vgpu")
@ -127,7 +178,7 @@ namespace XenAdmin.Wizards.ImportWizard
protected override string TargetServerSelectionIntroText => Messages.IMPORT_WIZARD_DESTINATION_TABLE_INTRO;
protected override void OnChosenItemChanged()
protected override void OnSelectedTargetPoolChanged()
{
var warnings = new List<string>();
@ -150,12 +201,36 @@ namespace XenAdmin.Wizards.ImportWizard
else if (VmMappings.Count > 1)
warnings.Add(Messages.IMPORT_VM_WITH_VGPU_WARNING_MANY);
}
var ovfCountsAboveLimit = _ovfVCpusCount.Count(vCpusCount => vCpusCount > VM.MAX_VCPUS_FOR_NON_TRUSTED_VMS);
if (ovfCountsAboveLimit > 0)
{
warnings.Add(string.Format(Messages.IMPORT_VM_CPUS_COUNT_UNTRUSTED_WARNING, ovfCountsAboveLimit, VM.MAX_VCPUS_FOR_NON_TRUSTED_VMS, BrandManager.BrandConsole));
}
}
ShowWarning(string.Join("\n", warnings));
ApplianceCanBeStarted = true;
if (ConnectionSelectionChanged != null)
ConnectionSelectionChanged(SelectedTargetPool?.Connection);
if (!CheckDestinationHasEnoughPhysicalCpus(out var physicalCpusWarningMessage))
{
warnings.Add(physicalCpusWarningMessage);
ApplianceCanBeStarted = false;
}
if (!CheckDestinationHasEnoughMemory(out var memoryWarningMessage))
{
warnings.Add(memoryWarningMessage);
ApplianceCanBeStarted = false;
}
ShowWarning(string.Join("\n\n", warnings));
ConnectionSelectionChanged?.Invoke(SelectedTargetPool?.Connection);
}
protected override void OnSelectedTargetChanged()
{
OnSelectedTargetPoolChanged();
}
protected override DelayLoadingOptionComboBoxItem CreateDelayLoadingOptionComboBoxItem(IXenObject xenItem)
@ -207,6 +282,120 @@ namespace XenAdmin.Wizards.ImportWizard
return true;
}
/// <summary>
/// Check if the appliance can be started on the selected host or pool. Note that if the user selects
/// a shared SR in other pages, the VM could still start. The check considers both vCPU count and memory requirements
/// of the appliance.
/// </summary>
public bool ApplianceCanBeStarted { get; private set; } = true;
private bool CheckDestinationHasEnoughPhysicalCpus(out string warningMessage)
{
warningMessage = string.Empty;
var selectedTarget = SelectedTarget ?? SelectedTargetPool;
var physicalCpusCount = GetPhysicalCpus(selectedTarget);
if (physicalCpusCount < 0 || physicalCpusCount >= _ovfMaxVCpusCount)
return true;
if (selectedTarget is Pool)
warningMessage = string.Format(Messages.IMPORT_WIZARD_CPUS_COUNT_MISMATCH_POOL, _ovfMaxVCpusCount, physicalCpusCount);
else if (selectedTarget is Host)
warningMessage = string.Format(Messages.IMPORT_WIZARD_CPUS_COUNT_MISMATCH_HOST, _ovfMaxVCpusCount, physicalCpusCount);
else
return true;
return false;
}
private bool CheckDestinationHasEnoughMemory(out string warningMessage)
{
warningMessage = string.Empty;
var selectedTarget = SelectedTarget ?? SelectedTargetPool;
var memory = GetFreeMemory(selectedTarget);
if (memory >= _ovfMemory)
return true;
if (selectedTarget is Pool)
warningMessage = string.Format(Messages.IMPORT_WIZARD_INSUFFICIENT_MEMORY_POOL, Util.MemorySizeStringSuitableUnits(_ovfMemory, true), Util.MemorySizeStringSuitableUnits(memory, true));
else if (selectedTarget is Host)
warningMessage = string.Format(Messages.IMPORT_WIZARD_INSUFFICIENT_MEMORY_HOST, Util.MemorySizeStringSuitableUnits(_ovfMemory, true), Util.MemorySizeStringSuitableUnits(memory, true));
else
return true;
return false;
}
/// <summary>
/// Returns the number of physical CPUs on the specified <paramref name="xenObject"/> (<see cref="Host"/> or <see cref="Pool"/>) or -1 if the value cannot be determined.
/// </summary>
/// <param name="xenObject">The XenObject for which to determine the number of physical CPUs.</param>
/// <returns>The number of physical CPUs on the specified <paramref name="xenObject"/> or -1 if the value cannot be determined.</returns>
private int GetPhysicalCpus(IXenObject xenObject)
{
var physicalCpusCount = -1;
switch (xenObject)
{
case Host host:
{
var hostCpuCount = host.CpuCount();
if(hostCpuCount > 0)
physicalCpusCount = hostCpuCount;
break;
}
case Pool pool:
{
var hosts = pool.Connection.Cache.Hosts;
var maxCpuCounts = hosts
.Select(h => h.CpuCount())
.ToList();
if (maxCpuCounts.Count > 0)
{
physicalCpusCount = maxCpuCounts.Max();
}
break;
}
}
return physicalCpusCount;
}
private long GetFreeMemory(IXenObject xenObject)
{
long memory = 0;
switch (xenObject)
{
case Host host:
{
var hostMemory = host.memory_available_calc();
if (hostMemory > 0)
memory = hostMemory;
break;
}
case Pool pool:
{
var hosts = pool.Connection.Cache.Hosts;
var maxMemories = hosts
.Select(h => h.memory_available_calc())
.ToList();
if (maxMemories.Count > 0)
{
memory = maxMemories.Max();
}
break;
}
}
return memory;
}
private bool CheckDestinationSupportsVendorDevice()
{
var dundeeOrNewerHosts = SelectedTargetPool.Connection.Cache.Hosts;

View File

@ -372,6 +372,21 @@ namespace XenAdmin.Wizards.ImportWizard
&& lunPerVdiMappingPage.MapLunsToVdisRequired
&& m_typeOfImport == ImportType.Ovf)
AddAfterPage(m_pageStorage, lunPerVdiMappingPage);
// If the user has selected shared SRs, we cannot be sure that the VMs can't be started.
// m_pageHost.ApplianceCanBeStarted only checks the number of pCPUs on the selected target.
// We therefore allow users to selected "Start VMs automatically", as they will be shown
// an error message in case their configuration isn't valid.
var canStartVMsAutomatically = m_pageHost.ApplianceCanBeStarted ||
m_pageStorage.VmMappings.Values
.SelectMany(mapping => mapping.Storage.Values)
.Any(sr => sr != null && sr.shared);
if(canStartVMsAutomatically != m_pageFinish.CanStartVmsAutomatically)
{
m_pageFinish.CanStartVmsAutomatically = canStartVMsAutomatically;
NotifyNextPagesOfChange(m_pageFinish);
}
}
else if (type == typeof(LunPerVdiImportPage))
{
@ -567,7 +582,7 @@ namespace XenAdmin.Wizards.ImportWizard
{
var temp = new List<Tuple>();
temp.Add(new Tuple(Messages.FINISH_PAGE_VMNAME, m_pageXvaStorage.ImportedVm.Name()));
temp.Add(new Tuple(Messages.FINISH_PAGE_TARGET, m_pageXvaHost.SelectedHost == null ? m_pageXvaHost.SelectedConnection.Name : m_pageXvaHost.SelectedHost.Name()));
temp.Add(new Tuple(Messages.FINISH_PAGE_TARGET_FOR_VM, m_pageXvaHost.SelectedHost == null ? m_pageXvaHost.SelectedConnection.Name : m_pageXvaHost.SelectedHost.Name()));
temp.Add(new Tuple(Messages.FINISH_PAGE_STORAGE, m_pageXvaStorage.SR.Name()));
var con = m_pageXvaHost.SelectedHost == null ? m_pageXvaHost.SelectedConnection : m_pageXvaHost.SelectedHost.Connection;
@ -632,11 +647,9 @@ namespace XenAdmin.Wizards.ImportWizard
foreach (var mapping in m_vmMappings.Values)
{
var targetLbl = m_vmMappings.Count == 1 ? Messages.FINISH_PAGE_TARGET : string.Format(Messages.FINISH_PAGE_TARGET_FOR_VM, mapping.VmNameLabel);
var storageLbl = m_vmMappings.Count == 1 ? Messages.FINISH_PAGE_STORAGE : string.Format(Messages.FINISH_PAGE_STORAGE_FOR_VM, mapping.VmNameLabel);
var networkLbl = m_vmMappings.Count == 1 ? Messages.FINISH_PAGE_NETWORK : string.Format(Messages.FINISH_PAGE_NETWORK_FOR_VM, mapping.VmNameLabel);
temp.Add(new Tuple(targetLbl, mapping.TargetName));
bool first = true;
foreach (var sr in mapping.Storage)
{

View File

@ -62,7 +62,7 @@ namespace XenAdmin.Wizards.NewVMWizard
private readonly Page_CloudConfigParameters page_CloudConfigParameters;
private Host m_affinity;
private bool BlockAffinitySelection = false;
private bool BlockAffinitySelection;
private bool gpuCapability;
public AsyncAction Action;
@ -131,7 +131,7 @@ namespace XenAdmin.Wizards.NewVMWizard
}
#endregion
page_8_Finish.SummaryRetreiver = GetSummary;
page_8_Finish.SummaryRetriever = GetSummary;
AddPages(page_1_Template, page_2_Name, page_3_InstallationMedia, page_4_HomeServer,
page_5_CpuMem, page_6_Storage, page_7_Networking, page_8_Finish);
@ -161,8 +161,8 @@ namespace XenAdmin.Wizards.NewVMWizard
page_3_InstallationMedia.SelectedUrl,
page_3_InstallationMedia.SelectedBootMode,
m_affinity,
page_5_CpuMem.SelectedVcpusMax,
page_5_CpuMem.SelectedVcpusAtStartup,
page_5_CpuMem.SelectedVCpusMax,
page_5_CpuMem.SelectedVCpusAtStartup,
(long)page_5_CpuMem.SelectedMemoryDynamicMin,
(long)page_5_CpuMem.SelectedMemoryDynamicMax,
(long)page_5_CpuMem.SelectedMemoryStaticMax,
@ -185,13 +185,14 @@ namespace XenAdmin.Wizards.NewVMWizard
base.FinishWizard();
}
protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (page_CloudConfigParameters != null && page_CloudConfigParameters.ActiveControl is TextBox && e.KeyChar == (char)Keys.Enter)
return;
base.OnKeyPress(e);
}
protected override void UpdateWizardContent(XenTabPage senderPage)
{
var prevPageType = senderPage.GetType();
@ -284,6 +285,10 @@ namespace XenAdmin.Wizards.NewVMWizard
AddAfterPage(page_6_Storage, page_6b_LunPerVdi);
}
}
else if (prevPageType == typeof(Page_CpuMem))
{
page_8_Finish.CanStartImmediately = CanStartVm();
}
}
protected override string WizardPaneHelpID()
@ -291,6 +296,22 @@ namespace XenAdmin.Wizards.NewVMWizard
return CurrentStepTabPage is RBACWarningPage ? FormatHelpId("Rbac") : base.WizardPaneHelpID();
}
private bool CanStartVm()
{
var homeHost = page_6_Storage.FullCopySR?.Home();
if (homeHost != null)
{
if (homeHost.CpuCount() < page_5_CpuMem.SelectedVCpusMax)
return false;
if (homeHost.memory_available_calc() < page_5_CpuMem.SelectedMemoryDynamicMin)
return false;
}
return page_5_CpuMem.CanStartVm;
}
private void ShowXenAppXenDesktopWarning(IXenConnection connection)
{
if (connection != null && connection.Cache.Hosts.Any(h => h.DesktopFeaturesEnabled() || h.DesktopPlusFeaturesEnabled() || h.DesktopCloudFeaturesEnabled()))

View File

@ -29,63 +29,104 @@ namespace XenAdmin.Wizards.NewVMWizard
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Page_CpuMem));
this.labelVCPUs = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.ErrorLabel = new System.Windows.Forms.Label();
this.ErrorPanel = new System.Windows.Forms.Panel();
this.spinnerDynMin = new XenAdmin.Controls.Ballooning.MemorySpinner();
this.spinnerDynMax = new XenAdmin.Controls.Ballooning.MemorySpinner();
this.spinnerStatMax = new XenAdmin.Controls.Ballooning.MemorySpinner();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.vCPUWarningLabel = new System.Windows.Forms.Label();
this.initialVCPUWarningLabel = new System.Windows.Forms.Label();
this.comboBoxInitialVCPUs = new System.Windows.Forms.ComboBox();
this.labelInitialVCPUs = new System.Windows.Forms.Label();
this.labelInvalidVCPUWarning = new System.Windows.Forms.Label();
this.comboBoxTopology = new XenAdmin.Controls.CPUTopologyComboBox();
this.labelTopology = new System.Windows.Forms.Label();
this.comboBoxVCPUs = new System.Windows.Forms.ComboBox();
this.labelDynMin = new System.Windows.Forms.Label();
this.labelDynMax = new System.Windows.Forms.Label();
this.labelStatMax = new System.Windows.Forms.Label();
this.labelDynMinInfo = new System.Windows.Forms.Label();
this.labelDynMaxInfo = new System.Windows.Forms.Label();
this.warningsTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.cpuWarningPictureBox = new System.Windows.Forms.PictureBox();
this.cpuWarningLabel = new System.Windows.Forms.Label();
this.memoryWarningLabel = new System.Windows.Forms.Label();
this.memoryPictureBox = new System.Windows.Forms.PictureBox();
this.labelStatMaxInfo = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.ErrorPanel.SuspendLayout();
this.labelDynMaxInfo = new System.Windows.Forms.Label();
this.labelDynMinInfo = new System.Windows.Forms.Label();
this.labelStatMax = new System.Windows.Forms.Label();
this.labelDynMax = new System.Windows.Forms.Label();
this.labelDynMin = new System.Windows.Forms.Label();
this.spinnerDynMin = new XenAdmin.Controls.Ballooning.MemorySpinner();
this.comboBoxVCPUs = new System.Windows.Forms.ComboBox();
this.labelTopology = new System.Windows.Forms.Label();
this.spinnerDynMax = new XenAdmin.Controls.Ballooning.MemorySpinner();
this.labelVCPUs = new System.Windows.Forms.Label();
this.spinnerStatMax = new XenAdmin.Controls.Ballooning.MemorySpinner();
this.label5 = new System.Windows.Forms.Label();
this.comboBoxTopology = new XenAdmin.Controls.CPUTopologyComboBox();
this.labelInitialVCPUs = new System.Windows.Forms.Label();
this.comboBoxInitialVCPUs = new System.Windows.Forms.ComboBox();
this.initialVCPUWarningLabel = new System.Windows.Forms.Label();
this.vCPUWarningLabel = new System.Windows.Forms.Label();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.pictureBoxTopology = new System.Windows.Forms.PictureBox();
this.labelTopologyWarning = new System.Windows.Forms.Label();
this.warningsTableLayoutPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cpuWarningPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.memoryPictureBox)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTopology)).BeginInit();
this.SuspendLayout();
//
// labelVCPUs
// warningsTableLayoutPanel
//
resources.ApplyResources(this.labelVCPUs, "labelVCPUs");
this.labelVCPUs.Name = "labelVCPUs";
resources.ApplyResources(this.warningsTableLayoutPanel, "warningsTableLayoutPanel");
this.tableLayoutPanel1.SetColumnSpan(this.warningsTableLayoutPanel, 4);
this.warningsTableLayoutPanel.Controls.Add(this.pictureBoxTopology, 0, 2);
this.warningsTableLayoutPanel.Controls.Add(this.cpuWarningPictureBox, 0, 0);
this.warningsTableLayoutPanel.Controls.Add(this.cpuWarningLabel, 1, 0);
this.warningsTableLayoutPanel.Controls.Add(this.memoryWarningLabel, 1, 4);
this.warningsTableLayoutPanel.Controls.Add(this.memoryPictureBox, 0, 4);
this.warningsTableLayoutPanel.Controls.Add(this.labelTopologyWarning, 1, 2);
this.warningsTableLayoutPanel.Name = "warningsTableLayoutPanel";
//
// label5
// cpuWarningPictureBox
//
resources.ApplyResources(this.label5, "label5");
this.tableLayoutPanel1.SetColumnSpan(this.label5, 4);
this.label5.Name = "label5";
this.cpuWarningPictureBox.Image = global::XenAdmin.Properties.Resources._000_Alert2_h32bit_16;
resources.ApplyResources(this.cpuWarningPictureBox, "cpuWarningPictureBox");
this.cpuWarningPictureBox.Name = "cpuWarningPictureBox";
this.cpuWarningPictureBox.TabStop = false;
//
// pictureBox1
// cpuWarningLabel
//
this.pictureBox1.Image = global::XenAdmin.Properties.Resources._000_Alert2_h32bit_16;
resources.ApplyResources(this.pictureBox1, "pictureBox1");
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.TabStop = false;
resources.ApplyResources(this.cpuWarningLabel, "cpuWarningLabel");
this.cpuWarningLabel.Name = "cpuWarningLabel";
//
// ErrorLabel
// memoryWarningLabel
//
resources.ApplyResources(this.ErrorLabel, "ErrorLabel");
this.ErrorLabel.Name = "ErrorLabel";
resources.ApplyResources(this.memoryWarningLabel, "memoryWarningLabel");
this.memoryWarningLabel.Name = "memoryWarningLabel";
//
// ErrorPanel
// memoryPictureBox
//
this.ErrorPanel.Controls.Add(this.ErrorLabel);
this.ErrorPanel.Controls.Add(this.pictureBox1);
resources.ApplyResources(this.ErrorPanel, "ErrorPanel");
this.ErrorPanel.Name = "ErrorPanel";
this.memoryPictureBox.Image = global::XenAdmin.Properties.Resources._000_Alert2_h32bit_16;
resources.ApplyResources(this.memoryPictureBox, "memoryPictureBox");
this.memoryPictureBox.Name = "memoryPictureBox";
this.memoryPictureBox.TabStop = false;
//
// labelStatMaxInfo
//
resources.ApplyResources(this.labelStatMaxInfo, "labelStatMaxInfo");
this.labelStatMaxInfo.Name = "labelStatMaxInfo";
//
// labelDynMaxInfo
//
resources.ApplyResources(this.labelDynMaxInfo, "labelDynMaxInfo");
this.labelDynMaxInfo.Name = "labelDynMaxInfo";
//
// labelDynMinInfo
//
resources.ApplyResources(this.labelDynMinInfo, "labelDynMinInfo");
this.labelDynMinInfo.Name = "labelDynMinInfo";
//
// labelStatMax
//
resources.ApplyResources(this.labelStatMax, "labelStatMax");
this.labelStatMax.Name = "labelStatMax";
//
// labelDynMax
//
resources.ApplyResources(this.labelDynMax, "labelDynMax");
this.labelDynMax.Name = "labelDynMax";
//
// labelDynMin
//
resources.ApplyResources(this.labelDynMin, "labelDynMin");
this.labelDynMin.Name = "labelDynMin";
//
// spinnerDynMin
//
@ -95,6 +136,19 @@ namespace XenAdmin.Wizards.NewVMWizard
this.spinnerDynMin.Name = "spinnerDynMin";
this.spinnerDynMin.SpinnerValueChanged += new System.EventHandler(this.memory_ValueChanged);
//
// comboBoxVCPUs
//
this.comboBoxVCPUs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxVCPUs.FormattingEnabled = true;
resources.ApplyResources(this.comboBoxVCPUs, "comboBoxVCPUs");
this.comboBoxVCPUs.Name = "comboBoxVCPUs";
this.comboBoxVCPUs.SelectedIndexChanged += new System.EventHandler(this.vCPU_ValueChanged);
//
// labelTopology
//
resources.ApplyResources(this.labelTopology, "labelTopology");
this.labelTopology.Name = "labelTopology";
//
// spinnerDynMax
//
resources.ApplyResources(this.spinnerDynMax, "spinnerDynMax");
@ -103,6 +157,11 @@ namespace XenAdmin.Wizards.NewVMWizard
this.spinnerDynMax.Name = "spinnerDynMax";
this.spinnerDynMax.SpinnerValueChanged += new System.EventHandler(this.memory_ValueChanged);
//
// labelVCPUs
//
resources.ApplyResources(this.labelVCPUs, "labelVCPUs");
this.labelVCPUs.Name = "labelVCPUs";
//
// spinnerStatMax
//
resources.ApplyResources(this.spinnerStatMax, "spinnerStatMax");
@ -111,63 +170,11 @@ namespace XenAdmin.Wizards.NewVMWizard
this.spinnerStatMax.Name = "spinnerStatMax";
this.spinnerStatMax.SpinnerValueChanged += new System.EventHandler(this.memory_ValueChanged);
//
// tableLayoutPanel1
// label5
//
resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
this.tableLayoutPanel1.Controls.Add(this.vCPUWarningLabel, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.initialVCPUWarningLabel, 2, 4);
this.tableLayoutPanel1.Controls.Add(this.comboBoxInitialVCPUs, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.labelInitialVCPUs, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.labelInvalidVCPUWarning, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.comboBoxTopology, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.spinnerStatMax, 1, 8);
this.tableLayoutPanel1.Controls.Add(this.labelVCPUs, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.spinnerDynMax, 1, 7);
this.tableLayoutPanel1.Controls.Add(this.labelTopology, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.comboBoxVCPUs, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.spinnerDynMin, 1, 6);
this.tableLayoutPanel1.Controls.Add(this.labelDynMin, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.labelDynMax, 0, 7);
this.tableLayoutPanel1.Controls.Add(this.labelStatMax, 0, 8);
this.tableLayoutPanel1.Controls.Add(this.labelDynMinInfo, 3, 6);
this.tableLayoutPanel1.Controls.Add(this.labelDynMaxInfo, 3, 7);
this.tableLayoutPanel1.Controls.Add(this.labelStatMaxInfo, 3, 8);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
//
// vCPUWarningLabel
//
resources.ApplyResources(this.vCPUWarningLabel, "vCPUWarningLabel");
this.tableLayoutPanel1.SetColumnSpan(this.vCPUWarningLabel, 2);
this.vCPUWarningLabel.ForeColor = System.Drawing.Color.Red;
this.vCPUWarningLabel.Name = "vCPUWarningLabel";
//
// initialVCPUWarningLabel
//
resources.ApplyResources(this.initialVCPUWarningLabel, "initialVCPUWarningLabel");
this.tableLayoutPanel1.SetColumnSpan(this.initialVCPUWarningLabel, 2);
this.initialVCPUWarningLabel.ForeColor = System.Drawing.Color.Red;
this.initialVCPUWarningLabel.Name = "initialVCPUWarningLabel";
//
// comboBoxInitialVCPUs
//
this.comboBoxInitialVCPUs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxInitialVCPUs.FormattingEnabled = true;
resources.ApplyResources(this.comboBoxInitialVCPUs, "comboBoxInitialVCPUs");
this.comboBoxInitialVCPUs.Name = "comboBoxInitialVCPUs";
this.comboBoxInitialVCPUs.SelectedIndexChanged += new System.EventHandler(this.comboBoxInitialVCPUs_SelectedIndexChanged);
//
// labelInitialVCPUs
//
resources.ApplyResources(this.labelInitialVCPUs, "labelInitialVCPUs");
this.labelInitialVCPUs.Name = "labelInitialVCPUs";
//
// labelInvalidVCPUWarning
//
resources.ApplyResources(this.labelInvalidVCPUWarning, "labelInvalidVCPUWarning");
this.tableLayoutPanel1.SetColumnSpan(this.labelInvalidVCPUWarning, 3);
this.labelInvalidVCPUWarning.ForeColor = System.Drawing.Color.Red;
this.labelInvalidVCPUWarning.Name = "labelInvalidVCPUWarning";
resources.ApplyResources(this.label5, "label5");
this.tableLayoutPanel1.SetColumnSpan(this.label5, 4);
this.label5.Name = "label5";
//
// comboBoxTopology
//
@ -178,89 +185,113 @@ namespace XenAdmin.Wizards.NewVMWizard
this.comboBoxTopology.Name = "comboBoxTopology";
this.comboBoxTopology.SelectedIndexChanged += new System.EventHandler(this.comboBoxTopology_SelectedIndexChanged);
//
// labelTopology
// labelInitialVCPUs
//
resources.ApplyResources(this.labelTopology, "labelTopology");
this.labelTopology.Name = "labelTopology";
resources.ApplyResources(this.labelInitialVCPUs, "labelInitialVCPUs");
this.labelInitialVCPUs.Name = "labelInitialVCPUs";
//
// comboBoxVCPUs
// comboBoxInitialVCPUs
//
this.comboBoxVCPUs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxVCPUs.FormattingEnabled = true;
resources.ApplyResources(this.comboBoxVCPUs, "comboBoxVCPUs");
this.comboBoxVCPUs.Name = "comboBoxVCPUs";
this.comboBoxVCPUs.SelectedIndexChanged += new System.EventHandler(this.vCPU_ValueChanged);
this.comboBoxInitialVCPUs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxInitialVCPUs.FormattingEnabled = true;
resources.ApplyResources(this.comboBoxInitialVCPUs, "comboBoxInitialVCPUs");
this.comboBoxInitialVCPUs.Name = "comboBoxInitialVCPUs";
this.comboBoxInitialVCPUs.SelectedIndexChanged += new System.EventHandler(this.comboBoxInitialVCPUs_SelectedIndexChanged);
//
// labelDynMin
// initialVCPUWarningLabel
//
resources.ApplyResources(this.labelDynMin, "labelDynMin");
this.labelDynMin.Name = "labelDynMin";
resources.ApplyResources(this.initialVCPUWarningLabel, "initialVCPUWarningLabel");
this.tableLayoutPanel1.SetColumnSpan(this.initialVCPUWarningLabel, 2);
this.initialVCPUWarningLabel.ForeColor = System.Drawing.Color.Red;
this.initialVCPUWarningLabel.Name = "initialVCPUWarningLabel";
//
// labelDynMax
// vCPUWarningLabel
//
resources.ApplyResources(this.labelDynMax, "labelDynMax");
this.labelDynMax.Name = "labelDynMax";
resources.ApplyResources(this.vCPUWarningLabel, "vCPUWarningLabel");
this.tableLayoutPanel1.SetColumnSpan(this.vCPUWarningLabel, 2);
this.vCPUWarningLabel.ForeColor = System.Drawing.Color.Red;
this.vCPUWarningLabel.Name = "vCPUWarningLabel";
//
// labelStatMax
// tableLayoutPanel1
//
resources.ApplyResources(this.labelStatMax, "labelStatMax");
this.labelStatMax.Name = "labelStatMax";
resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
this.tableLayoutPanel1.Controls.Add(this.vCPUWarningLabel, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.initialVCPUWarningLabel, 2, 3);
this.tableLayoutPanel1.Controls.Add(this.comboBoxInitialVCPUs, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.labelInitialVCPUs, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.comboBoxTopology, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.spinnerStatMax, 1, 7);
this.tableLayoutPanel1.Controls.Add(this.labelVCPUs, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.spinnerDynMax, 1, 6);
this.tableLayoutPanel1.Controls.Add(this.labelTopology, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.comboBoxVCPUs, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.spinnerDynMin, 1, 5);
this.tableLayoutPanel1.Controls.Add(this.labelDynMin, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.labelDynMax, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.labelStatMax, 0, 7);
this.tableLayoutPanel1.Controls.Add(this.labelDynMinInfo, 3, 5);
this.tableLayoutPanel1.Controls.Add(this.labelDynMaxInfo, 3, 6);
this.tableLayoutPanel1.Controls.Add(this.labelStatMaxInfo, 3, 7);
this.tableLayoutPanel1.Controls.Add(this.warningsTableLayoutPanel, 0, 8);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
//
// labelDynMinInfo
// pictureBoxTopology
//
resources.ApplyResources(this.labelDynMinInfo, "labelDynMinInfo");
this.labelDynMinInfo.Name = "labelDynMinInfo";
this.pictureBoxTopology.Image = global::XenAdmin.Properties.Resources._000_Alert2_h32bit_16;
resources.ApplyResources(this.pictureBoxTopology, "pictureBoxTopology");
this.pictureBoxTopology.Name = "pictureBoxTopology";
this.pictureBoxTopology.TabStop = false;
//
// labelDynMaxInfo
// labelTopologyWarning
//
resources.ApplyResources(this.labelDynMaxInfo, "labelDynMaxInfo");
this.labelDynMaxInfo.Name = "labelDynMaxInfo";
//
// labelStatMaxInfo
//
resources.ApplyResources(this.labelStatMaxInfo, "labelStatMaxInfo");
this.labelStatMaxInfo.Name = "labelStatMaxInfo";
resources.ApplyResources(this.labelTopologyWarning, "labelTopologyWarning");
this.labelTopologyWarning.Name = "labelTopologyWarning";
//
// Page_CpuMem
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.ErrorPanel);
this.Name = "Page_CpuMem";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ErrorPanel.ResumeLayout(false);
this.ErrorPanel.PerformLayout();
this.warningsTableLayoutPanel.ResumeLayout(false);
this.warningsTableLayoutPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.cpuWarningPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.memoryPictureBox)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTopology)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label labelVCPUs;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label ErrorLabel;
private System.Windows.Forms.Panel ErrorPanel;
private XenAdmin.Controls.Ballooning.MemorySpinner spinnerDynMin;
private XenAdmin.Controls.Ballooning.MemorySpinner spinnerDynMax;
private XenAdmin.Controls.Ballooning.MemorySpinner spinnerStatMax;
private System.Windows.Forms.TableLayoutPanel warningsTableLayoutPanel;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label labelTopology;
private Controls.CPUTopologyComboBox comboBoxTopology;
private System.Windows.Forms.ComboBox comboBoxVCPUs;
private System.Windows.Forms.Label vCPUWarningLabel;
private System.Windows.Forms.Label initialVCPUWarningLabel;
private System.Windows.Forms.ComboBox comboBoxInitialVCPUs;
private System.Windows.Forms.Label labelInitialVCPUs;
private System.Windows.Forms.Label labelInvalidVCPUWarning;
private Controls.CPUTopologyComboBox comboBoxTopology;
private System.Windows.Forms.Label label5;
private Controls.Ballooning.MemorySpinner spinnerStatMax;
private System.Windows.Forms.Label labelVCPUs;
private Controls.Ballooning.MemorySpinner spinnerDynMax;
private System.Windows.Forms.Label labelTopology;
private System.Windows.Forms.ComboBox comboBoxVCPUs;
private Controls.Ballooning.MemorySpinner spinnerDynMin;
private System.Windows.Forms.Label labelDynMin;
private System.Windows.Forms.Label labelDynMax;
private System.Windows.Forms.Label labelStatMax;
private System.Windows.Forms.Label labelDynMinInfo;
private System.Windows.Forms.Label labelDynMaxInfo;
private System.Windows.Forms.Label labelStatMaxInfo;
private System.Windows.Forms.Label vCPUWarningLabel;
private System.Windows.Forms.Label initialVCPUWarningLabel;
private System.Windows.Forms.PictureBox cpuWarningPictureBox;
private System.Windows.Forms.Label cpuWarningLabel;
private System.Windows.Forms.Label memoryWarningLabel;
private System.Windows.Forms.PictureBox memoryPictureBox;
private System.Windows.Forms.PictureBox pictureBoxTopology;
private System.Windows.Forms.Label labelTopologyWarning;
}
}

View File

@ -41,21 +41,27 @@ namespace XenAdmin.Wizards.NewVMWizard
{
public partial class Page_CpuMem : XenTabPage
{
private VM Template;
private VM _template;
// number of spinners to show
enum MemoryMode
private enum MemoryMode
{
JustMemory = 1,
MinimumAndMaximum = 2,
MinimumMaximumAndStaticMax = 3
}
MemoryMode memoryMode = MemoryMode.JustMemory;
double memoryRatio = 0.0; // the permitted ratio of dynamic_min / static_max
bool initialising = true;
private bool isVcpuHotplugSupported;
private int minVCPUs;
private MemoryMode _memoryMode = MemoryMode.JustMemory;
private double _memoryRatio; // the permitted ratio of dynamic_min / static_max
private bool _initializing = true;
private bool _isVCpuHotplugSupported;
private int _minVCpus;
private long _maxVCpus;
private long _maxMemTotal;
private long _maxMemFree;
private long _prevVCpusMax;
public VM SelectedTemplate { private get; set; }
// Please note that the comboBoxVCPUs control can represent two different VM properties, depending whether the VM supports vCPU hotplug or not:
// When vCPU hotplug is not supported, comboBoxVCPUs represents the initial number of vCPUs (VCPUs_at_startup). In this case we will also set the VM property VCPUs_max to the same value.
@ -66,72 +72,90 @@ namespace XenAdmin.Wizards.NewVMWizard
InitializeComponent();
}
public override string Text
public override string Text => Messages.NEWVMWIZARD_CPUMEMPAGE_NAME;
public override string PageTitle => Messages.NEWVMWIZARD_CPUMEMPAGE_TITLE;
public override string HelpID => "CPU&Memory";
public double SelectedMemoryDynamicMin => spinnerDynMin.Value;
public double SelectedMemoryDynamicMax => _memoryMode == MemoryMode.JustMemory ? spinnerDynMin.Value : spinnerDynMax.Value;
public bool CanStartVm => _maxVCpus > 0 && SelectedVCpusMax <= _maxVCpus && _maxMemFree > 0 && SelectedMemoryDynamicMin <= _maxMemFree && _maxMemTotal > 0 && SelectedMemoryDynamicMin <= _maxMemTotal;
public double SelectedMemoryStaticMax =>
_memoryMode == MemoryMode.JustMemory ? spinnerDynMin.Value :
_memoryMode == MemoryMode.MinimumAndMaximum ? spinnerDynMax.Value :
spinnerStatMax.Value;
public long SelectedVCpusMax => comboBoxVCPUs.SelectedItem == null ? -1 : (long)comboBoxVCPUs.SelectedItem;
public long SelectedVCpusAtStartup
{
get { return Messages.NEWVMWIZARD_CPUMEMPAGE_NAME; }
get
{
if (_isVCpuHotplugSupported)
return comboBoxInitialVCPUs.SelectedItem == null ? -1 : (long)comboBoxInitialVCPUs.SelectedItem;
return comboBoxVCPUs.SelectedItem == null ? -1 : (long)comboBoxVCPUs.SelectedItem;
}
}
public override string PageTitle
{
get { return Messages.NEWVMWIZARD_CPUMEMPAGE_TITLE; }
}
public override string HelpID
{
get { return "CPU&Memory"; }
}
public long SelectedCoresPerSocket => comboBoxTopology.CoresPerSocket;
protected override void PageLoadedCore(PageLoadedDirection direction)
{
if (SelectedTemplate == Template)
if (SelectedTemplate == _template)
return;
initialising = true;
_initializing = true;
Template = SelectedTemplate;
if (Template.SupportsBallooning() && !Helpers.FeatureForbidden(Template, Host.RestrictDMC))
memoryMode = Template.memory_dynamic_max == Template.memory_static_max ? MemoryMode.MinimumAndMaximum : MemoryMode.MinimumMaximumAndStaticMax;
_template = SelectedTemplate;
if (_template.SupportsBallooning() && !Helpers.FeatureForbidden(_template, Host.RestrictDMC))
_memoryMode = _template.memory_dynamic_max == _template.memory_static_max ? MemoryMode.MinimumAndMaximum : MemoryMode.MinimumMaximumAndStaticMax;
else
memoryMode = MemoryMode.JustMemory;
_memoryMode = MemoryMode.JustMemory;
memoryRatio = VMMemoryControlsEdit.GetMemoryRatio(Template);
_memoryRatio = VMMemoryControlsEdit.GetMemoryRatio(_template);
FreeSpinnerLimits();
if (memoryMode == MemoryMode.JustMemory)
if (_memoryMode == MemoryMode.JustMemory)
{
spinnerDynMin.Initialize(Template.memory_static_max, Template.memory_static_max);
spinnerDynMin.Initialize(_template.memory_static_max, _template.memory_static_max);
labelDynMin.Text = Messages.MEMORY_COLON;
}
else
{
labelDynMin.Text = Messages.DYNAMIC_MIN_COLON;
spinnerDynMin.Initialize(Template.memory_dynamic_min, Template.memory_static_max);
spinnerDynMin.Initialize(_template.memory_dynamic_min, _template.memory_static_max);
FreeSpinnerLimits(); // same as CA-33831
spinnerDynMax.Initialize(Template.memory_dynamic_max, Template.memory_static_max);
if (memoryMode == MemoryMode.MinimumMaximumAndStaticMax)
spinnerDynMax.Initialize(_template.memory_dynamic_max, _template.memory_static_max);
if (_memoryMode == MemoryMode.MinimumMaximumAndStaticMax)
{
FreeSpinnerLimits();
spinnerStatMax.Initialize(Template.memory_static_max, Template.memory_static_max);
spinnerStatMax.Initialize(_template.memory_static_max, _template.memory_static_max);
}
}
labelDynMaxInfo.Visible = labelDynMax.Visible = spinnerDynMax.Visible = memoryMode == MemoryMode.MinimumAndMaximum || memoryMode == MemoryMode.MinimumMaximumAndStaticMax;
labelStatMaxInfo.Visible = labelStatMax.Visible = spinnerStatMax.Visible = memoryMode == MemoryMode.MinimumMaximumAndStaticMax;
labelDynMaxInfo.Visible = labelDynMax.Visible = spinnerDynMax.Visible = _memoryMode == MemoryMode.MinimumAndMaximum || _memoryMode == MemoryMode.MinimumMaximumAndStaticMax;
labelStatMaxInfo.Visible = labelStatMax.Visible = spinnerStatMax.Visible = _memoryMode == MemoryMode.MinimumMaximumAndStaticMax;
isVcpuHotplugSupported = Template.SupportsVcpuHotplug();
minVCPUs = Template.MinVCPUs();
_isVCpuHotplugSupported = _template.SupportsVcpuHotplug();
_minVCpus = _template.MinVCPUs();
_prevVCPUsMax = Template.VCPUs_max; // we use variable in RefreshCurrentVCPUs for checking if VcpusAtStartup and VcpusMax were equal before VcpusMax changed
_prevVCpusMax = _template.VCPUs_max; // we use variable in RefreshCurrentVCPUs for checking if VcpusAtStartup and VcpusMax were equal before VcpusMax changed
label5.Text = GetRubric();
InitialiseVcpuControls();
InitialiseVCpuControls();
SetSpinnerLimitsAndIncrement();
ValidateMemorySettings();
ValidateVCpuSettings();
ValidateInitialVCpuSettings();
OnPageUpdated();
ValuesUpdated();
initialising = false;
_initializing = false;
}
public override void SelectDefaultControl()
@ -139,27 +163,27 @@ namespace XenAdmin.Wizards.NewVMWizard
comboBoxVCPUs.Select();
}
private void InitialiseVcpuControls()
private void InitialiseVCpuControls()
{
labelVCPUs.Text = isVcpuHotplugSupported
labelVCPUs.Text = _isVCpuHotplugSupported
? Messages.VM_CPUMEMPAGE_MAX_VCPUS_LABEL
: Messages.VM_CPUMEMPAGE_VCPUS_LABEL;
labelInitialVCPUs.Text = Messages.VM_CPUMEMPAGE_INITIAL_VCPUS_LABEL;
labelInitialVCPUs.Visible = comboBoxInitialVCPUs.Visible = isVcpuHotplugSupported;
labelInitialVCPUs.Visible = comboBoxInitialVCPUs.Visible = _isVCpuHotplugSupported;
comboBoxTopology.Populate(Template.VCPUs_at_startup, Template.VCPUs_max, Template.GetCoresPerSocket(), Template.MaxCoresPerSocket());
PopulateVCPUs(Template.MaxVCPUsAllowed(), isVcpuHotplugSupported ? Template.VCPUs_max : Template.VCPUs_at_startup);
comboBoxTopology.Populate(_template.VCPUs_at_startup, _template.VCPUs_max, _template.GetCoresPerSocket(), _template.MaxCoresPerSocket());
PopulateVCpus(_template.MaxVCPUsAllowed(), _isVCpuHotplugSupported ? _template.VCPUs_max : _template.VCPUs_at_startup);
if (isVcpuHotplugSupported)
PopulateVCPUsAtStartup(Template.VCPUs_max, Template.VCPUs_at_startup);
if (_isVCpuHotplugSupported)
PopulateVCpusAtStartup(_template.VCPUs_max, _template.VCPUs_at_startup);
}
private void PopulateVCPUComboBox(ComboBox comboBox, long min, long max, long currentValue, Predicate<long> isValid)
private void PopulateVCpuComboBox(ComboBox comboBox, long min, long max, long currentValue, Predicate<long> isValid)
{
comboBox.BeginUpdate();
comboBox.Items.Clear();
for (long i = min; i <= max; ++i)
for (var i = min; i <= max; ++i)
{
if (i == currentValue || isValid(i))
comboBox.Items.Add(i);
@ -170,43 +194,41 @@ namespace XenAdmin.Wizards.NewVMWizard
comboBox.EndUpdate();
}
private void PopulateVCPUs(long maxVCPUs, long currentVCPUs)
private void PopulateVCpus(long maxVCpus, long currentVCpus)
{
PopulateVCPUComboBox(comboBoxVCPUs, 1, maxVCPUs, currentVCPUs, i => comboBoxTopology.IsValidVCPU(i));
PopulateVCpuComboBox(comboBoxVCPUs, 1, maxVCpus, currentVCpus, i => comboBoxTopology.IsValidVCPU(i));
}
private void PopulateVCPUsAtStartup(long max, long currentValue)
private void PopulateVCpusAtStartup(long max, long currentValue)
{
PopulateVCPUComboBox(comboBoxInitialVCPUs, 1, max, currentValue, i => true);
PopulateVCpuComboBox(comboBoxInitialVCPUs, 1, max, currentValue, i => true);
}
private string GetRubric()
{
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
sb.Append(Messages.NEWVMWIZARD_CPUMEMPAGE_RUBRIC);
// add hotplug text
if (isVcpuHotplugSupported)
if (_isVCpuHotplugSupported)
sb.Append(Messages.VM_CPUMEMPAGE_RUBRIC_HOTPLUG);
return sb.ToString();
}
public VM SelectedTemplate { private get; set; }
// Return the larger of the template's MaxMemAllowed and the template's static max,
// to avoid crashes in the spinners (CA-40041).
private long MaxMemAllowed
{
get
{
long msm = Template.memory_static_max;
long mma = Template.MaxMemAllowed();
var msm = _template.memory_static_max;
var mma = _template.MaxMemAllowed();
return (msm > mma ? msm : mma);
}
}
private void FreeSpinnerLimits()
{
long maxMemAllowed = MaxMemAllowed;
var maxMemAllowed = MaxMemAllowed;
spinnerDynMin.SetRange(0, maxMemAllowed);
spinnerDynMax.SetRange(0, maxMemAllowed);
spinnerStatMax.SetRange(0, maxMemAllowed);
@ -214,29 +236,29 @@ namespace XenAdmin.Wizards.NewVMWizard
private void SetSpinnerLimitsAndIncrement()
{
spinnerDynMin.Increment = spinnerDynMax.Increment = spinnerStatMax.Increment = VMMemoryControlsEdit.CalcIncrement(Template.memory_static_max, spinnerDynMin.Units);
long maxMemAllowed = MaxMemAllowed;
double min = Template.memory_static_min;
if (memoryMode == MemoryMode.JustMemory)
spinnerDynMin.Increment = spinnerDynMax.Increment = spinnerStatMax.Increment = VMMemoryControlsEdit.CalcIncrement(_template.memory_static_max, spinnerDynMin.Units);
var maxMemAllowed = MaxMemAllowed;
double min = _template.memory_static_min;
if (_memoryMode == MemoryMode.JustMemory)
{
spinnerDynMin.SetRange(min, maxMemAllowed);
ShowMemoryMinMaxInformation(labelDynMinInfo, min, maxMemAllowed);
return;
}
long min2 = (long)(SelectedMemoryStaticMax * memoryRatio);
var min2 = (long)(SelectedMemoryStaticMax * _memoryRatio);
if (min < min2)
min = min2;
double max = SelectedMemoryDynamicMax;
var max = SelectedMemoryDynamicMax;
if (max < min)
max = min;
spinnerDynMin.SetRange(min, max);
ShowMemoryMinMaxInformation(labelDynMinInfo, min, max);
spinnerDynMax.SetRange(SelectedMemoryDynamicMin,
memoryMode == MemoryMode.MinimumAndMaximum ? maxMemAllowed : SelectedMemoryStaticMax);
_memoryMode == MemoryMode.MinimumAndMaximum ? maxMemAllowed : SelectedMemoryStaticMax);
ShowMemoryMinMaxInformation(labelDynMaxInfo, SelectedMemoryDynamicMin,
memoryMode == MemoryMode.MinimumAndMaximum ? maxMemAllowed : SelectedMemoryStaticMax);
_memoryMode == MemoryMode.MinimumAndMaximum ? maxMemAllowed : SelectedMemoryStaticMax);
spinnerStatMax.SetRange(SelectedMemoryDynamicMax, maxMemAllowed);
ShowMemoryMinMaxInformation(labelStatMaxInfo, SelectedMemoryDynamicMax, maxMemAllowed);
@ -249,159 +271,174 @@ namespace XenAdmin.Wizards.NewVMWizard
spinnerStatMax.Enabled = false;
}
public double SelectedMemoryDynamicMin
{
get
{
return spinnerDynMin.Value;
}
}
public double SelectedMemoryDynamicMax
{
get
{
return memoryMode == MemoryMode.JustMemory ? spinnerDynMin.Value : spinnerDynMax.Value;
}
}
public double SelectedMemoryStaticMax
{
get
{
return
memoryMode == MemoryMode.JustMemory ? spinnerDynMin.Value :
memoryMode == MemoryMode.MinimumAndMaximum ? spinnerDynMax.Value :
spinnerStatMax.Value;
}
}
public long SelectedVcpusMax
{
get
{
return (long)comboBoxVCPUs.SelectedItem;
}
}
public long SelectedVcpusAtStartup
{
get
{
return isVcpuHotplugSupported ? (long)comboBoxInitialVCPUs.SelectedItem : (long)comboBoxVCPUs.SelectedItem;
}
}
public long SelectedCoresPerSocket
{
get
{
return comboBoxTopology.CoresPerSocket;
}
}
public override List<KeyValuePair<string, string>> PageSummary
{
get
{
List<KeyValuePair<string, string>> sum = new List<KeyValuePair<string, string>>();
var sum = new List<KeyValuePair<string, string>>();
if (isVcpuHotplugSupported)
if (_isVCpuHotplugSupported)
{
sum.Add(new KeyValuePair<string, string>(Messages.NEWVMWIZARD_CPUMEMPAGE_MAX_VCPUS, SelectedVcpusMax.ToString()));
sum.Add(new KeyValuePair<string, string>(Messages.NEWVMWIZARD_CPUMEMPAGE_INITIAL_VCPUS, SelectedVcpusAtStartup.ToString()));
sum.Add(new KeyValuePair<string, string>(Messages.NEWVMWIZARD_CPUMEMPAGE_MAX_VCPUS, SelectedVCpusMax.ToString()));
sum.Add(new KeyValuePair<string, string>(Messages.NEWVMWIZARD_CPUMEMPAGE_INITIAL_VCPUS, SelectedVCpusAtStartup.ToString()));
}
else
{
sum.Add(new KeyValuePair<string, string>(Messages.NEWVMWIZARD_CPUMEMPAGE_VCPUS, SelectedVcpusAtStartup.ToString()));
sum.Add(new KeyValuePair<string, string>(Messages.NEWVMWIZARD_CPUMEMPAGE_VCPUS, SelectedVCpusAtStartup.ToString()));
}
sum.Add(new KeyValuePair<string, string>(Messages.NEWVMWIZARD_CPUMEMPAGE_TOPOLOGY, comboBoxTopology.Text));
if (memoryMode == MemoryMode.JustMemory)
if (_memoryMode == MemoryMode.JustMemory)
sum.Add(new KeyValuePair<string, string>(Messages.MEMORY, Util.MemorySizeStringSuitableUnits(SelectedMemoryStaticMax, false)));
else
{
sum.Add(new KeyValuePair<string, string>(Messages.DYNAMIC_MIN, Util.MemorySizeStringSuitableUnits(SelectedMemoryDynamicMin, false)));
sum.Add(new KeyValuePair<string, string>(Messages.DYNAMIC_MAX, Util.MemorySizeStringSuitableUnits(SelectedMemoryDynamicMax, false)));
if (memoryMode == MemoryMode.MinimumMaximumAndStaticMax)
if (_memoryMode == MemoryMode.MinimumMaximumAndStaticMax)
sum.Add(new KeyValuePair<string, string>(Messages.STATIC_MAX, Util.MemorySizeStringSuitableUnits(SelectedMemoryStaticMax, false)));
}
return sum;
}
}
private void ValuesUpdated()
private void ValidateMemorySettings()
{
CheckForError();
OnPageUpdated();
}
private void CheckForError()
{
long max_mem_total = 0;
long max_mem_free = 0;
long max_vcpus = 0;
Host max_mem_total_host = null;
Host max_mem_free_host = null;
Host max_vcpus_host = null;
foreach (Host host in Connection.Cache.Hosts)
Host maxMemTotalHost = null;
Host maxMemFreeHost = null;
_maxMemTotal = 0;
_maxMemFree = 0;
foreach (var host in Connection.Cache.Hosts)
{
long host_cpus = 0;
var metrics = Connection.Resolve(host.metrics);
foreach (Host_cpu cpu in Connection.Cache.Host_cpus)
if (metrics != null && metrics.memory_total > _maxMemTotal)
{
if (cpu.host.opaque_ref.Equals(host.opaque_ref))
host_cpus++;
}
Host_metrics metrics = Connection.Resolve(host.metrics);
if (host_cpus > max_vcpus)
{
max_vcpus = host_cpus;
max_vcpus_host = host;
}
if (metrics != null && metrics.memory_total > max_mem_total)
{
max_mem_total = metrics.memory_total;
max_mem_total_host = host;
_maxMemTotal = metrics.memory_total;
maxMemTotalHost = host;
}
// The available memory of a server is taken to be the current memory_free,
// plus however much we can squeeze down the existing VMs. This assumes
// that the overhead won't increase when we create the new VM, so it
// has false negatives.
long memory_free = host.memory_available_calc();
var memoryFree = host.memory_available_calc();
if (metrics != null && memory_free > max_mem_free)
if (metrics != null && memoryFree > _maxMemFree)
{
max_mem_free = memory_free;
max_mem_free_host = host;
_maxMemFree = memoryFree;
maxMemFreeHost = host;
}
}
if (max_mem_total_host != null && SelectedMemoryDynamicMin > max_mem_total)
if (maxMemTotalHost != null && SelectedMemoryDynamicMin > _maxMemTotal)
{
ErrorPanel.Visible = true;
ErrorLabel.Text = string.Format(Messages.NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN1, Helpers.GetName(max_mem_total_host).Ellipsise(50), Util.MemorySizeStringSuitableUnits(max_mem_total, false));
ShowMemoryWarning(string.Format(Messages.NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN_TOTAL, Util.MemorySizeStringSuitableUnits(_maxMemTotal, false)));
}
else if (max_mem_free_host != null && SelectedMemoryDynamicMin > max_mem_free)
else if (maxMemFreeHost != null && SelectedMemoryDynamicMin > _maxMemFree)
{
ErrorPanel.Visible = true;
ErrorLabel.Text = string.Format(Messages.NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN2, Helpers.GetName(max_mem_free_host).Ellipsise(50), Util.MemorySizeStringSuitableUnits(max_mem_free, false));
}
else if (max_vcpus_host != null && SelectedVcpusMax > max_vcpus)
{
ErrorPanel.Visible = true;
ErrorLabel.Text = string.Format(Messages.NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN, Helpers.GetName(max_vcpus_host).Ellipsise(50), max_vcpus);
ShowMemoryWarning(string.Format(Messages.NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN_FREE, Util.MemorySizeStringSuitableUnits(_maxMemFree, false)));
}
else
{
ErrorPanel.Visible = false;
ShowMemoryWarning();
}
}
private void ValidateVCpuSettings()
{
Host maxVCpusHost = null;
_maxVCpus = 0;
var warnings = new List<string>();
foreach (var host in Connection.Cache.Hosts)
{
long hostCpus = 0;
foreach (var cpu in Connection.Cache.Host_cpus)
{
if (cpu.host.opaque_ref.Equals(host.opaque_ref))
hostCpus++;
}
if (hostCpus > _maxVCpus)
{
_maxVCpus = hostCpus;
maxVCpusHost = host;
}
}
if (maxVCpusHost != null && SelectedVCpusMax > _maxVCpus)
{
var isStandAloneHost = Helpers.GetPool(maxVCpusHost.Connection) == null;
if (isStandAloneHost)
{
warnings.Add(string.Format(Messages.NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN_STANDALONE_HOST, SelectedVCpusMax, _maxVCpus));
}
else
{
warnings.Add(string.Format(Messages.NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN_POOL, SelectedVCpusMax, _maxVCpus));
}
}
if (SelectedVCpusMax > VM.MAX_VCPUS_FOR_NON_TRUSTED_VMS)
{
warnings.Add(string.Format(Messages.VCPUS_UNTRUSTED_VM_WARNING, VM.MAX_VCPUS_FOR_NON_TRUSTED_VMS, BrandManager.BrandConsole));
}
ShowCpuWarning(string.Join("\n\n", warnings));
if (SelectedVCpusMax < _minVCpus)
{
vCPUWarningLabel.Text = string.Format(Messages.VM_CPUMEMPAGE_VCPU_MIN_WARNING, _minVCpus);
vCPUWarningLabel.Visible = true;
}
else
{
vCPUWarningLabel.Visible = false;
}
}
private void ValidateInitialVCpuSettings()
{
if (SelectedVCpusAtStartup < _minVCpus)
{
initialVCPUWarningLabel.Text = string.Format(Messages.VM_CPUMEMPAGE_VCPU_MIN_WARNING, _minVCpus);
initialVCPUWarningLabel.Visible = true;
}
else
{
initialVCPUWarningLabel.Visible = false;
}
}
private void ValidateTopologySettings()
{
if (comboBoxVCPUs.SelectedItem != null)
ShowTopologyWarning(VM.ValidVCPUConfiguration((long)comboBoxVCPUs.SelectedItem, comboBoxTopology.CoresPerSocket));
}
private void ShowMemoryWarning(string text = null)
{
var show = !string.IsNullOrEmpty(text);
memoryWarningLabel.Text = show ? text : null;
memoryPictureBox.Visible = memoryWarningLabel.Visible = show;
}
private void ShowTopologyWarning(string text = null)
{
var show = !string.IsNullOrEmpty(text);
labelTopologyWarning.Text = show ? text : null;
pictureBoxTopology.Visible = labelTopologyWarning.Visible = show;
}
private void ShowCpuWarning(string text = null)
{
var show = !string.IsNullOrEmpty(text);
cpuWarningLabel.Text = show ? text : null;
cpuWarningPictureBox.Visible = cpuWarningLabel.Visible = show;
}
private void ShowMemoryMinMaxInformation(Label label, double min, double max)
{
label.Text = string.Format(
@ -415,55 +452,27 @@ namespace XenAdmin.Wizards.NewVMWizard
return Util.MemorySizeStringSuitableUnits(numberOfBytes, true);
}
#region Control event handlers
private void vCPU_ValueChanged(object sender, EventArgs e)
{
comboBoxTopology.Update((long)comboBoxVCPUs.SelectedItem);
ValuesUpdated();
ValidateVCPUSettings();
RefreshCurrentVCPUs();
ValidateVCpuSettings();
RefreshCurrentVCpus();
OnPageUpdated();
}
private void memory_ValueChanged(object sender, EventArgs e)
{
if (initialising)
if (_initializing)
return;
SetSpinnerLimitsAndIncrement();
ValuesUpdated();
}
private void ValidateVCPUSettings()
{
if (comboBoxVCPUs.SelectedItem != null && SelectedVcpusMax < minVCPUs)
{
vCPUWarningLabel.Text = string.Format(Messages.VM_CPUMEMPAGE_VCPU_MIN_WARNING, minVCPUs);
vCPUWarningLabel.Visible = true;
}
else
{
vCPUWarningLabel.Visible = false;
}
if (comboBoxInitialVCPUs.SelectedItem != null && SelectedVcpusAtStartup < minVCPUs)
{
initialVCPUWarningLabel.Text = string.Format(Messages.VM_CPUMEMPAGE_VCPU_MIN_WARNING, minVCPUs);
initialVCPUWarningLabel.Visible = true;
}
else
{
initialVCPUWarningLabel.Visible = false;
}
ValidateMemorySettings();
OnPageUpdated();
}
private void ValidateTopologySettings()
{
if (comboBoxVCPUs.SelectedItem != null)
labelInvalidVCPUWarning.Text = VM.ValidVCPUConfiguration((long)comboBoxVCPUs.SelectedItem, comboBoxTopology.CoresPerSocket);
}
private long _prevVCPUsMax;
private void RefreshCurrentVCPUs()
private void RefreshCurrentVCpus()
{
// refresh comboBoxInitialVCPUs if it's visible and populated
if (comboBoxInitialVCPUs.Visible && comboBoxInitialVCPUs.Items.Count > 0)
@ -472,15 +481,15 @@ namespace XenAdmin.Wizards.NewVMWizard
// So if VcpusMax is decreased below VcpusAtStartup, then VcpusAtStartup is decreased to that number too
// If VcpusAtStartup and VcpusMax are equal, and VcpusMax is changed, then VcpusAtStartup is changed to match
// But if the numbers are unequal, and VcpusMax is changed but is still higher than VcpusAtStartup, then VcpusAtStartup is unchanged
var newValue = SelectedVcpusAtStartup;
var newValue = SelectedVCpusAtStartup;
if (SelectedVcpusMax < SelectedVcpusAtStartup)
newValue = SelectedVcpusMax;
else if (SelectedVcpusAtStartup == _prevVCPUsMax && SelectedVcpusMax != _prevVCPUsMax)
newValue = SelectedVcpusMax;
if (SelectedVCpusMax < SelectedVCpusAtStartup)
newValue = SelectedVCpusMax;
else if (SelectedVCpusAtStartup == _prevVCpusMax && SelectedVCpusMax != _prevVCpusMax)
newValue = SelectedVCpusMax;
PopulateVCPUsAtStartup(SelectedVcpusMax, newValue);
_prevVCPUsMax = SelectedVcpusMax;
PopulateVCpusAtStartup(SelectedVCpusMax, newValue);
_prevVCpusMax = SelectedVCpusMax;
}
}
@ -491,7 +500,9 @@ namespace XenAdmin.Wizards.NewVMWizard
private void comboBoxInitialVCPUs_SelectedIndexChanged(object sender, EventArgs e)
{
ValidateVCPUSettings();
ValidateInitialVCpuSettings();
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@ -31,22 +31,16 @@ namespace XenAdmin.Wizards.NewVMWizard
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Page_Finish));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.AutoStartCheckBox = new System.Windows.Forms.CheckBox();
this.SummaryGridView = new XenAdmin.Controls.DataGridViewEx.DataGridViewEx();
this.PropertyColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ValueColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.SummaryGridView)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// richTextBox1
//
resources.ApplyResources(this.richTextBox1, "richTextBox1");
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.TabStop = false;
//
// AutoStartCheckBox
//
resources.ApplyResources(this.AutoStartCheckBox, "AutoStartCheckBox");
@ -57,9 +51,9 @@ namespace XenAdmin.Wizards.NewVMWizard
//
// SummaryGridView
//
resources.ApplyResources(this.SummaryGridView, "SummaryGridView");
this.SummaryGridView.BackgroundColor = System.Drawing.SystemColors.Control;
this.SummaryGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
this.SummaryGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.SummaryGridView.ColumnHeadersVisible = false;
this.SummaryGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.PropertyColumn,
@ -72,6 +66,7 @@ namespace XenAdmin.Wizards.NewVMWizard
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.SummaryGridView.DefaultCellStyle = dataGridViewCellStyle1;
resources.ApplyResources(this.SummaryGridView, "SummaryGridView");
this.SummaryGridView.Name = "SummaryGridView";
this.SummaryGridView.ReadOnly = true;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
@ -94,26 +89,38 @@ namespace XenAdmin.Wizards.NewVMWizard
this.ValueColumn.Name = "ValueColumn";
this.ValueColumn.ReadOnly = true;
//
// tableLayoutPanel1
//
resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.AutoStartCheckBox, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.SummaryGridView, 0, 1);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// Page_Finish
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.SummaryGridView);
this.Controls.Add(this.AutoStartCheckBox);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "Page_Finish";
((System.ComponentModel.ISupportInitialize)(this.SummaryGridView)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.CheckBox AutoStartCheckBox;
private XenAdmin.Controls.DataGridViewEx.DataGridViewEx SummaryGridView;
private System.Windows.Forms.DataGridViewTextBoxColumn PropertyColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn ValueColumn;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label1;
}
}

View File

@ -40,54 +40,47 @@ namespace XenAdmin.Wizards.NewVMWizard
public Page_Finish()
{
InitializeComponent();
richTextBox1.Text = Messages.NEWVMWIZARD_FINISHPAGE;
}
public override string Text
{
get { return Messages.NEWVMWIZARD_FINISHPAGE_NAME; }
}
public override string Text => Messages.NEWVMWIZARD_FINISHPAGE_NAME;
public override string PageTitle
{
get { return Messages.NEWVMWIZARD_FINISHPAGE_TITLE; }
}
public override string PageTitle => Messages.NEWVMWIZARD_FINISHPAGE_TITLE;
public override string HelpID
{
get { return "Finish"; }
}
public override string HelpID => "Finish";
public override string NextText(bool isLastPage)
{
return Messages.NEWVMWIZARD_FINISHPAGE_CREATE;
}
public bool StartImmediately
public bool StartImmediately => AutoStartCheckBox.Checked;
private bool _canStartImmediately = true;
public bool CanStartImmediately
{
get
{
return AutoStartCheckBox.Checked;
}
get => _canStartImmediately;
set => _canStartImmediately = AutoStartCheckBox.Checked = AutoStartCheckBox.Enabled = value;
}
protected override void PageLoadedCore(PageLoadedDirection direction)
{
SummaryGridView.Rows.Clear();
if (SummaryRetreiver == null)
if (SummaryRetriever == null)
return;
var entries = SummaryRetreiver.Invoke();
foreach (KeyValuePair<string, string> pair in entries)
var entries = SummaryRetriever.Invoke();
foreach (var pair in entries)
SummaryGridView.Rows.Add(pair.Key, pair.Value);
}
public override void SelectDefaultControl()
{
AutoStartCheckBox.Select();
if(CanStartImmediately)
AutoStartCheckBox.Select();
}
public Func<IEnumerable<KeyValuePair<string, string>>> SummaryRetreiver { private get; set; }
public Func<IEnumerable<KeyValuePair<string, string>>> SummaryRetriever { private get; set; }
}
}

View File

@ -112,50 +112,23 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="richTextBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="richTextBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 4</value>
</data>
<data name="richTextBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>508, 86</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="richTextBox1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="richTextBox1.Text" xml:space="preserve">
<value />
</data>
<data name="&gt;&gt;richTextBox1.Name" xml:space="preserve">
<value>richTextBox1</value>
</data>
<data name="&gt;&gt;richTextBox1.Type" xml:space="preserve">
<value>System.Windows.Forms.RichTextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;richTextBox1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;richTextBox1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="AutoStartCheckBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="AutoStartCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="AutoStartCheckBox.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 288</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="AutoStartCheckBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 10, 3, 3</value>
</data>
<data name="AutoStartCheckBox.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 17</value>
</data>
@ -169,18 +142,15 @@
<value>AutoStartCheckBox</value>
</data>
<data name="&gt;&gt;AutoStartCheckBox.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;AutoStartCheckBox.Parent" xml:space="preserve">
<value>$this</value>
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;AutoStartCheckBox.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="SummaryGridView.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
</data>
<metadata name="PropertyColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="PropertyColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PropertyColumn.HeaderText" xml:space="preserve">
@ -189,17 +159,20 @@
<data name="PropertyColumn.Width" type="System.Int32, mscorlib">
<value>5</value>
</data>
<metadata name="ValueColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="ValueColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="ValueColumn.HeaderText" xml:space="preserve">
<value>Value</value>
</data>
<data name="SummaryGridView.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="SummaryGridView.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 97</value>
<value>3, 44</value>
</data>
<data name="SummaryGridView.Size" type="System.Drawing.Size, System.Drawing">
<value>508, 142</value>
<value>509, 231</value>
</data>
<data name="SummaryGridView.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
@ -208,15 +181,81 @@
<value>SummaryGridView</value>
</data>
<data name="&gt;&gt;SummaryGridView.Type" xml:space="preserve">
<value>XenAdmin.Controls.DataGridViewEx.DataGridViewEx, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.DataGridViewEx.DataGridViewEx, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;SummaryGridView.Parent" xml:space="preserve">
<value>$this</value>
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;SummaryGridView.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 0</value>
</data>
<data name="label1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 0, 3, 15</value>
</data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>509, 26</value>
</data>
<data name="label1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<data name="label1.Text" xml:space="preserve">
<value>All the necessary information has been collected and the wizard is ready to provision the new virtual machine using the settings shown below.</value>
</data>
<data name="&gt;&gt;label1.Name" xml:space="preserve">
<value>label1</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="tableLayoutPanel1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="tableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="tableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
<value>515, 308</value>
</data>
<data name="tableLayoutPanel1.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Name" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Type" xml:space="preserve">
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="AutoStartCheckBox" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="SummaryGridView" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,Percent,100,AutoSize,0" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
@ -229,18 +268,18 @@
<value>PropertyColumn</value>
</data>
<data name="&gt;&gt;PropertyColumn.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;ValueColumn.Name" xml:space="preserve">
<value>ValueColumn</value>
</data>
<data name="&gt;&gt;ValueColumn.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>Page_Finish</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>XenAdmin.Controls.XenTabPage, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.XenTabPage, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

View File

@ -1391,11 +1391,11 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="SettingsPanels\BootDevice.cs" />
<Compile Include="SettingsPanels\CPUMemoryEditPage.cs">
<Compile Include="SettingsPanels\CpuMemoryEditPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SettingsPanels\CPUMemoryEditPage.Designer.cs">
<DependentUpon>CPUMemoryEditPage.cs</DependentUpon>
<Compile Include="SettingsPanels\CpuMemoryEditPage.Designer.cs">
<DependentUpon>CpuMemoryEditPage.cs</DependentUpon>
</Compile>
<Compile Include="SettingsPanels\GeneralEditPage.cs">
<SubType>UserControl</SubType>
@ -2667,8 +2667,8 @@
<DependentUpon>VMHAEditPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="SettingsPanels\CPUMemoryEditPage.resx">
<DependentUpon>CPUMemoryEditPage.cs</DependentUpon>
<EmbeddedResource Include="SettingsPanels\CpuMemoryEditPage.resx">
<DependentUpon>CpuMemoryEditPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="SettingsPanels\GeneralEditPage.resx">
@ -5660,12 +5660,12 @@
<EmbeddedResource Include="SettingsPanels\BootOptionsEditPage.zh-CN.resx">
<DependentUpon>BootOptionsEditPage.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SettingsPanels\CPUMemoryEditPage.ja.resx">
<DependentUpon>CPUMemoryEditPage.cs</DependentUpon>
<EmbeddedResource Include="SettingsPanels\CpuMemoryEditPage.ja.resx">
<DependentUpon>CpuMemoryEditPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="SettingsPanels\CPUMemoryEditPage.zh-CN.resx">
<DependentUpon>CPUMemoryEditPage.cs</DependentUpon>
<EmbeddedResource Include="SettingsPanels\CpuMemoryEditPage.zh-CN.resx">
<DependentUpon>CpuMemoryEditPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="SettingsPanels\CustomFieldsDisplayPage.ja.resx">

View File

@ -490,20 +490,23 @@ namespace XenAdmin.Actions.OvfActions
if (rasds != null && rasds.Length > 0)
{
//The default memory unit is MB (2^20), however, the RASD may contain a different
//one with format Bytes*memoryBase^memoryPower (Bytes being a literal string)
//one with format byte*memoryBase^memoryPower (byte being a literal string)
double memoryPower = 20.0;
double memoryBase = 2.0;
double memoryPower = 20.0;
foreach (RASD_Type rasd in rasds)
{
if (rasd.AllocationUnits.Value.ToLower().StartsWith("bytes"))
if (rasd.AllocationUnits.Value.ToLower().StartsWith("byte"))
{
string[] a1 = rasd.AllocationUnits.Value.Split('*', '^');
if (a1.Length == 3)
{
memoryBase = Convert.ToDouble(a1[1]);
memoryPower = Convert.ToDouble(a1[2]);
if (!double.TryParse(a1[1].Trim(), out memoryBase))
memoryBase = 2.0;
if (!double.TryParse(a1[2].Trim(), out memoryPower))
memoryPower = 20.0;
}
}

View File

@ -28,7 +28,6 @@
* SUCH DAMAGE.
*/
using XenAdmin.Alerts;
using XenAdmin.Core;
using XenAdmin.Network;
using XenAPI;
@ -38,49 +37,54 @@ namespace XenAdmin.Actions
{
public class PerfmonOptionsDefinitionAction : AsyncAction
{
private readonly Pool pool;
private readonly PerfmonOptionsDefinition perfmonOptions;
private readonly Pool _pool;
private readonly string _mailDestination;
private readonly string _mailHub;
private readonly string _mailLangCode;
public PerfmonOptionsDefinitionAction(IXenConnection connection, PerfmonOptionsDefinition perfmonOptions, bool suppressHistory)
public PerfmonOptionsDefinitionAction(IXenConnection connection, string mailDestination, string mailHub, string mailLangCode, bool suppressHistory)
: base(connection, Messages.ACTION_CHANGE_EMAIL_OPTIONS, suppressHistory)
{
this.perfmonOptions = perfmonOptions;
pool = Helpers.GetPoolOfOne(connection);
Description = string.Format(Messages.ACTION_CHANGING_EMAIL_OPTIONS_FOR, pool);
_mailDestination = mailDestination;
_mailHub = mailHub;
_mailLangCode = mailLangCode;
_pool = Helpers.GetPoolOfOne(connection);
ApiMethodsToRoleCheck.AddWithKey("pool.remove_from_other_config", PerfmonOptionsDefinition.MAIL_DESTINATION_KEY_NAME);
ApiMethodsToRoleCheck.AddWithKey("pool.remove_from_other_config", PerfmonOptionsDefinition.SMTP_MAILHUB_KEY_NAME);
ApiMethodsToRoleCheck.AddWithKey("pool.remove_from_other_config", PerfmonOptionsDefinition.MAIL_LANGUAGE_KEY_NAME);
Description = string.Format(Messages.ACTION_CHANGING_EMAIL_OPTIONS_FOR, _pool);
if (perfmonOptions != null)
ApiMethodsToRoleCheck.AddWithKey("pool.remove_from_other_config", Pool.MAIL_DESTINATION_KEY_NAME);
ApiMethodsToRoleCheck.AddWithKey("pool.remove_from_other_config", Pool.SMTP_MAILHUB_KEY_NAME);
ApiMethodsToRoleCheck.AddWithKey("pool.remove_from_other_config", Pool.MAIL_LANGUAGE_KEY_NAME);
if (_mailDestination != null && _mailHub != null)
{
ApiMethodsToRoleCheck.AddWithKey("pool.add_to_other_config", PerfmonOptionsDefinition.MAIL_DESTINATION_KEY_NAME);
ApiMethodsToRoleCheck.AddWithKey("pool.add_to_other_config", PerfmonOptionsDefinition.SMTP_MAILHUB_KEY_NAME);
ApiMethodsToRoleCheck.AddWithKey("pool.add_to_other_config", Pool.MAIL_DESTINATION_KEY_NAME);
ApiMethodsToRoleCheck.AddWithKey("pool.add_to_other_config", Pool.SMTP_MAILHUB_KEY_NAME);
if (perfmonOptions.MailLanguageCode != null)
ApiMethodsToRoleCheck.AddWithKey("pool.add_to_other_config", PerfmonOptionsDefinition.MAIL_LANGUAGE_KEY_NAME);
if (_mailLangCode != null)
ApiMethodsToRoleCheck.AddWithKey("pool.add_to_other_config", Pool.MAIL_LANGUAGE_KEY_NAME);
}
}
protected override void Run()
{
if (pool == null)
if (_pool == null)
return;
Pool.remove_from_other_config(Session, pool.opaque_ref, PerfmonOptionsDefinition.MAIL_DESTINATION_KEY_NAME);
Pool.remove_from_other_config(Session, _pool.opaque_ref, Pool.MAIL_DESTINATION_KEY_NAME);
if (perfmonOptions != null)
Pool.add_to_other_config(Session, pool.opaque_ref, PerfmonOptionsDefinition.MAIL_DESTINATION_KEY_NAME, perfmonOptions.MailDestination);
if (_mailDestination != null)
Pool.add_to_other_config(Session, _pool.opaque_ref, Pool.MAIL_DESTINATION_KEY_NAME, _mailDestination);
Pool.remove_from_other_config(Session, pool.opaque_ref, PerfmonOptionsDefinition.SMTP_MAILHUB_KEY_NAME);
Pool.remove_from_other_config(Session, _pool.opaque_ref, Pool.SMTP_MAILHUB_KEY_NAME);
if (perfmonOptions != null)
Pool.add_to_other_config(Session, pool.opaque_ref, PerfmonOptionsDefinition.SMTP_MAILHUB_KEY_NAME, perfmonOptions.MailHub);
if (_mailHub != null)
Pool.add_to_other_config(Session, _pool.opaque_ref, Pool.SMTP_MAILHUB_KEY_NAME, _mailHub);
Pool.remove_from_other_config(Session, pool.opaque_ref, PerfmonOptionsDefinition.MAIL_LANGUAGE_KEY_NAME);
Pool.remove_from_other_config(Session, _pool.opaque_ref, Pool.MAIL_LANGUAGE_KEY_NAME);
if (perfmonOptions?.MailLanguageCode != null)
Pool.add_to_other_config(Session, pool.opaque_ref, PerfmonOptionsDefinition.MAIL_LANGUAGE_KEY_NAME, perfmonOptions.MailLanguageCode);
if (_mailLangCode != null)
Pool.add_to_other_config(Session, _pool.opaque_ref, Pool.MAIL_LANGUAGE_KEY_NAME, _mailLangCode);
}
}
}

View File

@ -35,9 +35,9 @@ using XenAPI;
namespace XenAdmin.Actions
{
/// <summary>
/// Saves changes on a VBD, then tries to plug the VBD into a VM.
/// Creates a VBD, then tries to plug it into a VM.
/// </summary>
public class VbdSaveAndPlugAction : AsyncAction
public class VbdCreateAndPlugAction : AsyncAction
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@ -48,24 +48,21 @@ namespace XenAdmin.Actions
/// </summary>
public event Action<string> ShowUserInstruction;
public VbdSaveAndPlugAction(VM vm, VBD vbd, string vdiName, Session session, bool suppress)
public VbdCreateAndPlugAction(VM vm, VBD vbd, string vdiName, bool suppress)
: base(vm.Connection, string.Format(Messages.ATTACHING_VIRTUAL_DISK, vdiName, vm.Name()), "", suppress)
{
VM = vm;
this.vbd = vbd;
// Preserve existing session if provided.
if (session != null)
this.Session = session;
ApiMethodsToRoleCheck.Add("vbd.async_plug");
ApiMethodsToRoleCheck.Add("vbd.set_userdevice");
ApiMethodsToRoleCheck.Add("vbd.create");
if (VM.IsHVM() || !vbd.empty)
ApiMethodsToRoleCheck.AddRange("vbd.get_allowed_operations", "vbd.async_plug");
}
protected override void Run()
{
// First, save changes to the VBD.
string vbdServerRef = vbd.SaveChanges(Session, null, null);
string vbdServerRef = VBD.create(Session, vbd);
if (!VM.IsHVM() && vbd.empty)
{
@ -79,13 +76,13 @@ namespace XenAdmin.Actions
{
log.DebugFormat("Attempting to hot plug VBD {0}.", vbd.uuid);
this.RelatedTask = XenAPI.VBD.async_plug(Session, vbdServerRef);
RelatedTask = VBD.async_plug(Session, vbdServerRef);
PollToCompletion();
this.Description = Messages.ATTACHDISKWIZARD_ATTACHED;
Description = Messages.ATTACHDISKWIZARD_ATTACHED;
}
else
{
VM vm = this.Connection.Resolve(vbd.VM);
VM vm = Connection.Resolve(vbd.VM);
if (vm != null && vm.power_state != vm_power_state.Halted)
{
if (vbd.type == vbd_type.CD)

View File

@ -49,42 +49,42 @@ namespace XenAdmin.Actions
#region RBAC Dependencies
ApiMethodsToRoleCheck.Add("vm.assert_agile");
ApiMethodsToRoleCheck.AddRange(XenAPI.Role.CommonSessionApiList);
ApiMethodsToRoleCheck.AddRange(Role.CommonSessionApiList);
#endregion
}
protected override void Run()
{
VBD cdrom = VM.FindVMCDROM();
if (cdrom == null)
{
Description = Messages.NEW_DVD_DRIVE_CREATING;
// could not find a cd, try and make one
if (VM.VBDs.Count >= VM.MaxVBDsAllowed())
{
throw new Exception(Messages.CDDRIVE_MAX_ALLOWED_VBDS);
}
List<String> allowedDevices = new List<String>(XenAPI.VM.get_allowed_VBD_devices(Session, VM.opaque_ref));
var allowedDevices = new List<string>(VM.get_allowed_VBD_devices(Session, VM.opaque_ref));
if (allowedDevices == null || allowedDevices.Count == 0)
{
throw new Exception(Messages.CDDRIVE_MAX_ALLOWED_VBDS);
}
XenAPI.VBD cdDrive = new XenAPI.VBD
VBD cdDrive = new VBD
{
VM = new XenAPI.XenRef<XenAPI.VM>(VM.opaque_ref),
VM = new XenRef<VM>(VM.opaque_ref),
bootable = false,
device = "",
userdevice = allowedDevices.Contains("3") ? "3" : allowedDevices[0],
empty = true,
type = XenAPI.vbd_type.CD,
mode = XenAPI.vbd_mode.RO
type = vbd_type.CD,
mode = vbd_mode.RO
};
var cdCreate = new VbdSaveAndPlugAction(VM, cdDrive, Messages.DVD_DRIVE, Session, true);
var cdCreate = new VbdCreateAndPlugAction(VM, cdDrive, Messages.DVD_DRIVE, true);
cdCreate.ShowUserInstruction += msg => ShowUserInstruction?.Invoke(msg);
cdCreate.RunSync(Session);
Description = Messages.NEW_DVD_DRIVE_DONE;

View File

@ -1,284 +0,0 @@
/* Copyright (c) Cloud Software Group, Inc.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using XenAPI;
using XenAdmin.Network;
using XenAdmin.Core;
namespace XenAdmin.Alerts
{
public class PerfmonOptionsDefinition
{
public const String MAIL_DESTINATION_KEY_NAME = "mail-destination";
public const String SMTP_MAILHUB_KEY_NAME = "ssmtp-mailhub";
public const String MAIL_LANGUAGE_KEY_NAME = "mail-language";
private class MailLanguageList
{
private Dictionary<String, String> _list;
public MailLanguageList(Dictionary<String, String> initList)
{
_list = new Dictionary<String, String>(initList);
}
public String CodeFromName(String name)
{
String ret = null;
if (null == name)
return ret;
foreach(KeyValuePair<String, String> pair in _list)
{
if(pair.Value == name)
{
ret = pair.Key;
break;
}
}
return ret;
}
public String NameFromCode(String code)
{
String ret = null;
if (null == code)
return ret;
foreach (KeyValuePair<String, String> pair in _list)
{
if (pair.Key == code)
{
ret = pair.Value;
break;
}
}
return ret;
}
public bool HasCode(String code)
{
return null == code ? false : _list.ContainsKey(code);
}
public Dictionary<String, String> dataSource()
{
return new Dictionary<String, String>(_list);
}
}
private static readonly char[] mailHubDelim = new char[] { ':' };
private readonly String mailHub;
private readonly String mailDestination;
private readonly String mailLanguageCode;
private static MailLanguageList ml_list = new MailLanguageList(new Dictionary<String, String>() {
{Messages.MAIL_LANGUAGE_ENGLISH_CODE, Messages.MAIL_LANGUAGE_ENGLISH_NAME},
{Messages.MAIL_LANGUAGE_CHINESE_CODE, Messages.MAIL_LANGUAGE_CHINESE_NAME},
{Messages.MAIL_LANGUAGE_JAPANESE_CODE, Messages.MAIL_LANGUAGE_JAPANESE_NAME}
});
public PerfmonOptionsDefinition(String mailHub, String mailDestination, String mailLanguageCode)
{
this.mailHub = mailHub;
this.mailDestination = mailDestination;
this.mailLanguageCode = mailLanguageCode;
}
public String MailHub
{
get
{
return mailHub;
}
}
public String MailDestination
{
get
{
return mailDestination;
}
}
public String MailLanguageCode
{
get
{
return mailLanguageCode;
}
}
public String MailLanguageName
{
get
{
return ml_list.NameFromCode(mailLanguageCode);
}
}
public static String GetSmtpServerAddress(string mailHub)
{
try
{
string[] words = mailHub.Split(mailHubDelim);
if (words.Length > 0)
{
return words[0];
}
}
catch
{
// ignored
}
return "";
}
public static String GetSmtpPort(string mailHub)
{
try
{
string[] words = mailHub.Split(mailHubDelim);
if (words.Length > 1)
{
return words[1];
}
}
catch
{
// ignored
}
return "25";
}
public override string ToString()
{
return String.Format("mail-destination: {0} ssmtp-mailhub: {1}", MailDestination, MailHub);
}
public static PerfmonOptionsDefinition GetPerfmonOptionsDefinitions(IXenObject xmo)
{
if (xmo == null)
return null;
IXenConnection connection = xmo.Connection;
if (connection == null)
return null;
string mailDestination = GetMailDestination(connection);
string mailHub = GetSmtpMailHub(connection);
string mailLanguageCode = GetMailLanguageCode(connection);
if (mailDestination == null || mailHub == null)
return null;
return new PerfmonOptionsDefinition(mailHub, mailDestination, mailLanguageCode);
}
public static string GetMailDestination(IXenConnection connection)
{
var pool = Helpers.GetPoolOfOne(connection);
if (pool == null)
return null;
var otherConfig = Helpers.GetOtherConfig(pool);
if (otherConfig == null)
return null;
if (!otherConfig.ContainsKey(MAIL_DESTINATION_KEY_NAME))
return null;
var mailAddress = otherConfig[MAIL_DESTINATION_KEY_NAME]?.Trim();
return string.IsNullOrEmpty(mailAddress) ? null : mailAddress;
}
public static string GetSmtpMailHub(IXenConnection connection)
{
var pool = Helpers.GetPoolOfOne(connection);
if (pool == null)
return null;
var otherConfig = Helpers.GetOtherConfig(pool);
if (otherConfig == null)
return null;
if (!otherConfig.ContainsKey(SMTP_MAILHUB_KEY_NAME))
return null;
var mailHub = otherConfig[SMTP_MAILHUB_KEY_NAME]?.Trim();
return string.IsNullOrEmpty(mailHub) ? null : mailHub;
}
public static string GetMailLanguageCode(IXenConnection connection)
{
var pool = Helpers.GetPoolOfOne(connection);
if (pool == null)
return null;
var otherConfig = Helpers.GetOtherConfig(pool);
if (otherConfig == null)
return null;
if (!otherConfig.ContainsKey(MAIL_LANGUAGE_KEY_NAME))
return null;
var mailLanguageCode = otherConfig[MAIL_LANGUAGE_KEY_NAME]?.Trim();
return string.IsNullOrEmpty(mailLanguageCode) ? null : mailLanguageCode;
}
public static String MailLanguageNameFromCode(String code)
{
return ml_list.NameFromCode(code);
}
public static String MailLanguageCodeFromName(String name)
{
return ml_list.CodeFromName(name);
}
public static bool MailLanguageHasCode(String code)
{
return ml_list.HasCode(code);
}
public static object MailLanguageDataSource()
{
return PerfmonOptionsDefinition.ml_list.dataSource();
}
}
}

View File

@ -10702,15 +10702,6 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Home Server:.
/// </summary>
public static string CPM_SUMMARY_KEY_HOME_SERVER {
get {
return ResourceManager.GetString("CPM_SUMMARY_KEY_HOME_SERVER", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Template:.
/// </summary>
@ -10765,15 +10756,6 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Unset.
/// </summary>
public static string CPM_SUMMARY_UNSET {
get {
return ResourceManager.GetString("CPM_SUMMARY_UNSET", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Pl&amp;ace all virtual disks on the same SR:.
/// </summary>
@ -11203,24 +11185,6 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to CPU and Memory.
/// </summary>
public static string CPU_AND_MEMORY {
get {
return ResourceManager.GetString("CPU_AND_MEMORY", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} vCPU(s) &amp; {1} MB RAM.
/// </summary>
public static string CPU_AND_MEMORY_SUB {
get {
return ResourceManager.GetString("CPU_AND_MEMORY_SUB", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} vCPU(s).
/// </summary>
@ -17544,16 +17508,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to Target:.
/// </summary>
public static string FINISH_PAGE_TARGET {
get {
return ResourceManager.GetString("FINISH_PAGE_TARGET", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} target:.
/// Looks up a localized string similar to Home server:.
/// </summary>
public static string FINISH_PAGE_TARGET_FOR_VM {
get {
@ -20945,6 +20900,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to The appliance contains {0} VM(s) with more than {1} vCPUs. Where a VM may be running actively hostile privileged code {2} recommends that the vCPU limit is set to {1} to prevent impact on system availability..
/// </summary>
public static string IMPORT_VM_CPUS_COUNT_UNTRUSTED_WARNING {
get {
return ResourceManager.GetString("IMPORT_VM_CPUS_COUNT_UNTRUSTED_WARNING", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Import VM from....
/// </summary>
@ -21035,6 +20999,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to The imported appliance requires a minimum of {0} vCPUs, while the number of physical CPUs in the selected server is {1}. You will not be able to start the appliance on the selected server..
/// </summary>
public static string IMPORT_WIZARD_CPUS_COUNT_MISMATCH_HOST {
get {
return ResourceManager.GetString("IMPORT_WIZARD_CPUS_COUNT_MISMATCH_HOST", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The imported appliance requires a minimum of {0} vCPUs, while the maximum number of physical CPUs in the pool is {1}. You will not be able to start the appliance on the selected pool..
/// </summary>
public static string IMPORT_WIZARD_CPUS_COUNT_MISMATCH_POOL {
get {
return ResourceManager.GetString("IMPORT_WIZARD_CPUS_COUNT_MISMATCH_POOL", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &amp;Import to:.
/// </summary>
@ -21089,6 +21071,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to The imported appliance requires a minimum of {0} of memory, while the available memory on the server is {1}. You will not be able to start the VM on the selected server..
/// </summary>
public static string IMPORT_WIZARD_INSUFFICIENT_MEMORY_HOST {
get {
return ResourceManager.GetString("IMPORT_WIZARD_INSUFFICIENT_MEMORY_HOST", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The imported appliance requires a minimum of {0} of memory, while the maximum available memory on the pool is {1}. You will not be able to start the VM on the selected pool..
/// </summary>
public static string IMPORT_WIZARD_INSUFFICIENT_MEMORY_POOL {
get {
return ResourceManager.GetString("IMPORT_WIZARD_INSUFFICIENT_MEMORY_POOL", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Map the virtual network interfaces in the VMs you are importing to networks in the destination pool or standalone server..
/// </summary>
@ -26994,28 +26994,20 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to The amount of memory allocated to the new VM is greater than the amount of physical memory on any server in the pool.
///
///Server &apos;{0}&apos; has {1} of physical memory in total.
///
///You will not be able to start this VM without increasing the amount of physical memory on one of the servers in the pool..
/// Looks up a localized string similar to The amount of memory allocated to the new VM is greater than the amount of physical memory available on any server in the pool ({0})..
/// </summary>
public static string NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN1 {
public static string NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN_FREE {
get {
return ResourceManager.GetString("NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN1", resourceCulture);
return ResourceManager.GetString("NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN_FREE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The amount of memory allocated to the new VM is greater than the amount of physical memory available on any server in the pool.
///
///Server &apos;{0}&apos; has {1} of physical memory available.
///
///You will not be able to start this VM without freeing some space on one of the servers..
/// Looks up a localized string similar to The amount of memory allocated to the new VM is greater than the amount of physical memory on any server in the pool ({0})..
/// </summary>
public static string NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN2 {
public static string NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN_TOTAL {
get {
return ResourceManager.GetString("NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN2", resourceCulture);
return ResourceManager.GetString("NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN_TOTAL", resourceCulture);
}
}
@ -27029,7 +27021,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to Specify the number of virtual CPUs, their topology, and the amount of memory that will be allocated to the new virtual machine. .
/// Looks up a localized string similar to Specify the number of vCPUs, their topology, and the amount of memory that will be allocated to the new virtual machine. .
/// </summary>
public static string NEWVMWIZARD_CPUMEMPAGE_RUBRIC {
get {
@ -27065,26 +27057,20 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to The number of vCPUs given to the new VM is greater than the number of physical CPUs on any server in the pool.
///
///Server &apos;{0}&apos; has {1} physical CPUs.
///
///Performance of this VM will be greatly reduced if it is started with this many vCPUs..
/// Looks up a localized string similar to You have specified {0} vCPUs, but none of the pool servers have more than {1} physical CPUs. You will not be able to start the VM..
/// </summary>
public static string NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN {
public static string NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN_POOL {
get {
return ResourceManager.GetString("NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN", resourceCulture);
return ResourceManager.GetString("NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN_POOL", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to All the necessary information has been collected and the wizard is ready to provision the new virtual machine using the settings shown below.
///
///Review these settings, then click Previous if you need to change anything. Otherwise, click Create Now to create the new VM. It may take several minutes to create the new VM..
/// Looks up a localized string similar to You have specified {0} vCPUs, but the server has only {1} physical CPUs. You will not be able to start the VM..
/// </summary>
public static string NEWVMWIZARD_FINISHPAGE {
public static string NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN_STANDALONE_HOST {
get {
return ResourceManager.GetString("NEWVMWIZARD_FINISHPAGE", resourceCulture);
return ResourceManager.GetString("NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN_STANDALONE_HOST", resourceCulture);
}
}
@ -38762,13 +38748,11 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to The number of VCPUs is greater than the number of physical CPUs on the host server. This will significantly reduce VM performance.
///
///To optimize VM performance, you should reduce the number of VCPUs to less than or equal to the number of physical CPUs..
/// Looks up a localized string similar to You have selected more than {0} vCPUs for the new VM. Where a VM may be running actively hostile privileged code {1} recommends that the vCPU limit is set to {0} to prevent impact on system availability..
/// </summary>
public static string VCPUS_MORE_THAN_PCPUS {
public static string VCPUS_UNTRUSTED_VM_WARNING {
get {
return ResourceManager.GetString("VCPUS_MORE_THAN_PCPUS", resourceCulture);
return ResourceManager.GetString("VCPUS_UNTRUSTED_VM_WARNING", resourceCulture);
}
}
@ -39420,6 +39404,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to The amount of physical memory allocated to this VM is greater than the total memory of its home server..
/// </summary>
public static string VM_CPUMEMPAGE_INSUFFICIENT_MEMORY_HOST {
get {
return ResourceManager.GetString("VM_CPUMEMPAGE_INSUFFICIENT_MEMORY_HOST", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The amount of physical memory allocated to this VM is greater than the total memory of any server in the pool..
/// </summary>
public static string VM_CPUMEMPAGE_INSUFFICIENT_MEMORY_POOL {
get {
return ResourceManager.GetString("VM_CPUMEMPAGE_INSUFFICIENT_MEMORY_POOL", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Maximum number of &amp;vCPUs:.
/// </summary>
@ -39457,7 +39459,16 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to It is recommended to allocate at least {0} vCPUs for this VM.
/// Looks up a localized string similar to The VM&apos;s home server does not have enough physical CPUs to start the VM. The VM will start on another server..
/// </summary>
public static string VM_CPUMEMPAGE_VCPU_HOME_HOST_WARNING {
get {
return ResourceManager.GetString("VM_CPUMEMPAGE_VCPU_HOME_HOST_WARNING", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to It is recommended to allocate at least {0} vCPUs for this VM..
/// </summary>
public static string VM_CPUMEMPAGE_VCPU_MIN_WARNING {
get {
@ -39466,7 +39477,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to More vCPUs than physical CPUs may lead to reduced VM performance.
/// Looks up a localized string similar to There are no servers with enough physical CPUs to start the VM..
/// </summary>
public static string VM_CPUMEMPAGE_VCPU_WARNING {
get {

View File

@ -3835,9 +3835,6 @@ This action cannot be undone. Are you sure you want to continue?</value>
<data name="CPM_SUMMARY_KEY_DESTINATION" xml:space="preserve">
<value>Destination:</value>
</data>
<data name="CPM_SUMMARY_KEY_HOME_SERVER" xml:space="preserve">
<value>Home Server:</value>
</data>
<data name="CPM_SUMMARY_KEY_MIGRATE_TEMPLATE" xml:space="preserve">
<value>Template:</value>
</data>
@ -3856,9 +3853,6 @@ This action cannot be undone. Are you sure you want to continue?</value>
<data name="CPM_SUMMARY_NETWORK_NOT_FOUND" xml:space="preserve">
<value>Network not found</value>
</data>
<data name="CPM_SUMMARY_UNSET" xml:space="preserve">
<value>Unset</value>
</data>
<data name="CPM_WIZARD_ALL_ON_SAME_SR_RADIO" xml:space="preserve">
<value>Pl&amp;ace all virtual disks on the same SR:</value>
</data>
@ -4006,12 +4000,6 @@ For optimal performance and reliability during VM migration, ensure that the net
<data name="CPU" xml:space="preserve">
<value>CPU</value>
</data>
<data name="CPU_AND_MEMORY" xml:space="preserve">
<value>CPU and Memory</value>
</data>
<data name="CPU_AND_MEMORY_SUB" xml:space="preserve">
<value>{0} vCPU(s) &amp; {1} MB RAM</value>
</data>
<data name="CPU_SUB" xml:space="preserve">
<value>{0} vCPU(s)</value>
</data>
@ -6140,11 +6128,8 @@ Would you like to eject these ISOs before continuing?</value>
<data name="FINISH_PAGE_STORAGE_FOR_VM" xml:space="preserve">
<value>{0} storage:</value>
</data>
<data name="FINISH_PAGE_TARGET" xml:space="preserve">
<value>Target:</value>
</data>
<data name="FINISH_PAGE_TARGET_FOR_VM" xml:space="preserve">
<value>{0} target:</value>
<value>Home server:</value>
</data>
<data name="FINISH_PAGE_TEXT" xml:space="preserve">
<value>Finish</value>
@ -7305,6 +7290,9 @@ This might result in failure to migrate VMs to this server during the RPU or to
<data name="IMPORT_VM_CONFIGURE_STORAGE" xml:space="preserve">
<value>Configure storage for the new VM</value>
</data>
<data name="IMPORT_VM_CPUS_COUNT_UNTRUSTED_WARNING" xml:space="preserve">
<value>The appliance contains {0} VM(s) with more than {1} vCPUs. Where a VM may be running actively hostile privileged code {2} recommends that the vCPU limit is set to {1} to prevent impact on system availability.</value>
</data>
<data name="IMPORT_VM_FROM" xml:space="preserve">
<value>Import VM from...</value>
</data>
@ -7335,6 +7323,12 @@ This might result in failure to migrate VMs to this server during the RPU or to
<data name="IMPORT_WIZARD_ALL_ON_SAME_SR_RADIO" xml:space="preserve">
<value>Place &amp;all imported virtual disks on this target SR:</value>
</data>
<data name="IMPORT_WIZARD_CPUS_COUNT_MISMATCH_HOST" xml:space="preserve">
<value>The imported appliance requires a minimum of {0} vCPUs, while the number of physical CPUs in the selected server is {1}. You will not be able to start the appliance on the selected server.</value>
</data>
<data name="IMPORT_WIZARD_CPUS_COUNT_MISMATCH_POOL" xml:space="preserve">
<value>The imported appliance requires a minimum of {0} vCPUs, while the maximum number of physical CPUs in the pool is {1}. You will not be able to start the appliance on the selected pool.</value>
</data>
<data name="IMPORT_WIZARD_DESTINATION_DESTINATION" xml:space="preserve">
<value>&amp;Import to:</value>
</data>
@ -7353,6 +7347,12 @@ This might result in failure to migrate VMs to this server during the RPU or to
<data name="IMPORT_WIZARD_FAILED_UNCOMPRESS" xml:space="preserve">
<value>Failed to uncompress file {0}. Please see the logs for more information.</value>
</data>
<data name="IMPORT_WIZARD_INSUFFICIENT_MEMORY_HOST" xml:space="preserve">
<value>The imported appliance requires a minimum of {0} of memory, while the available memory on the server is {1}. You will not be able to start the VM on the selected server.</value>
</data>
<data name="IMPORT_WIZARD_INSUFFICIENT_MEMORY_POOL" xml:space="preserve">
<value>The imported appliance requires a minimum of {0} of memory, while the maximum available memory on the pool is {1}. You will not be able to start the VM on the selected pool.</value>
</data>
<data name="IMPORT_WIZARD_NETWORKING_INTRO" xml:space="preserve">
<value>Map the virtual network interfaces in the VMs you are importing to networks in the destination pool or standalone server.</value>
</data>
@ -9399,25 +9399,17 @@ When you configure an NFS storage repository, you simply provide the host name o
<data name="NEWVMWIZARD_CPUMEMPAGE_MEMORYINFO" xml:space="preserve">
<value>(min = {0}, max = {1})</value>
</data>
<data name="NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN1" xml:space="preserve">
<value>The amount of memory allocated to the new VM is greater than the amount of physical memory on any server in the pool.
Server '{0}' has {1} of physical memory in total.
You will not be able to start this VM without increasing the amount of physical memory on one of the servers in the pool.</value>
<data name="NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN_FREE" xml:space="preserve">
<value>The amount of memory allocated to the new VM is greater than the amount of physical memory available on any server in the pool ({0}).</value>
</data>
<data name="NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN2" xml:space="preserve">
<value>The amount of memory allocated to the new VM is greater than the amount of physical memory available on any server in the pool.
Server '{0}' has {1} of physical memory available.
You will not be able to start this VM without freeing some space on one of the servers.</value>
<data name="NEWVMWIZARD_CPUMEMPAGE_MEMORYWARN_TOTAL" xml:space="preserve">
<value>The amount of memory allocated to the new VM is greater than the amount of physical memory on any server in the pool ({0}).</value>
</data>
<data name="NEWVMWIZARD_CPUMEMPAGE_NAME" xml:space="preserve">
<value>CPU &amp;&amp; Memory</value>
</data>
<data name="NEWVMWIZARD_CPUMEMPAGE_RUBRIC" xml:space="preserve">
<value>Specify the number of virtual CPUs, their topology, and the amount of memory that will be allocated to the new virtual machine. </value>
<value>Specify the number of vCPUs, their topology, and the amount of memory that will be allocated to the new virtual machine. </value>
</data>
<data name="NEWVMWIZARD_CPUMEMPAGE_TITLE" xml:space="preserve">
<value>Allocate processor and memory resources</value>
@ -9428,17 +9420,11 @@ You will not be able to start this VM without freeing some space on one of the s
<data name="NEWVMWIZARD_CPUMEMPAGE_VCPUS" xml:space="preserve">
<value>vCPUs</value>
</data>
<data name="NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN" xml:space="preserve">
<value>The number of vCPUs given to the new VM is greater than the number of physical CPUs on any server in the pool.
Server '{0}' has {1} physical CPUs.
Performance of this VM will be greatly reduced if it is started with this many vCPUs.</value>
<data name="NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN_POOL" xml:space="preserve">
<value>You have specified {0} vCPUs, but none of the pool servers have more than {1} physical CPUs. You will not be able to start the VM.</value>
</data>
<data name="NEWVMWIZARD_FINISHPAGE" xml:space="preserve">
<value>All the necessary information has been collected and the wizard is ready to provision the new virtual machine using the settings shown below.
Review these settings, then click Previous if you need to change anything. Otherwise, click Create Now to create the new VM. It may take several minutes to create the new VM.</value>
<data name="NEWVMWIZARD_CPUMEMPAGE_VCPUSWARN_STANDALONE_HOST" xml:space="preserve">
<value>You have specified {0} vCPUs, but the server has only {1} physical CPUs. You will not be able to start the VM.</value>
</data>
<data name="NEWVMWIZARD_FINISHPAGE_CREATE" xml:space="preserve">
<value>&amp;Create Now</value>
@ -13393,10 +13379,8 @@ To start a {0} trial, click the button below.</value>
<data name="VCPU_ONLY_WHEN_HALTED" xml:space="preserve">
<value>The vCPUs can only be changed when the VM is shut down.</value>
</data>
<data name="VCPUS_MORE_THAN_PCPUS" xml:space="preserve">
<value>The number of VCPUs is greater than the number of physical CPUs on the host server. This will significantly reduce VM performance.
To optimize VM performance, you should reduce the number of VCPUs to less than or equal to the number of physical CPUs.</value>
<data name="VCPUS_UNTRUSTED_VM_WARNING" xml:space="preserve">
<value>You have selected more than {0} vCPUs for the new VM. Where a VM may be running actively hostile privileged code {1} recommends that the vCPU limit is set to {0} to prevent impact on system availability.</value>
</data>
<data name="VDI" xml:space="preserve">
<value>VDI</value>
@ -13614,6 +13598,12 @@ To optimize VM performance, you should reduce the number of VCPUs to less than o
<data name="VM_CPUMEMPAGE_INITIAL_VCPUS_LABEL" xml:space="preserve">
<value>Initial number of v&amp;CPUs:</value>
</data>
<data name="VM_CPUMEMPAGE_INSUFFICIENT_MEMORY_HOST" xml:space="preserve">
<value>The amount of physical memory allocated to this VM is greater than the total memory of its home server.</value>
</data>
<data name="VM_CPUMEMPAGE_INSUFFICIENT_MEMORY_POOL" xml:space="preserve">
<value>The amount of physical memory allocated to this VM is greater than the total memory of any server in the pool.</value>
</data>
<data name="VM_CPUMEMPAGE_MAX_VCPUS_LABEL" xml:space="preserve">
<value>Maximum number of &amp;vCPUs:</value>
</data>
@ -13626,11 +13616,14 @@ To optimize VM performance, you should reduce the number of VCPUs to less than o
<data name="VM_CPUMEMPAGE_RUBRIC_HOTPLUG" xml:space="preserve">
<value>If the initial number of vCPUs is set lower than the maximum number, more vCPUs can be added to the virtual machine while it is running. </value>
</data>
<data name="VM_CPUMEMPAGE_VCPU_HOME_HOST_WARNING" xml:space="preserve">
<value>The VM's home server does not have enough physical CPUs to start the VM. The VM will start on another server.</value>
</data>
<data name="VM_CPUMEMPAGE_VCPU_MIN_WARNING" xml:space="preserve">
<value>It is recommended to allocate at least {0} vCPUs for this VM</value>
<value>It is recommended to allocate at least {0} vCPUs for this VM.</value>
</data>
<data name="VM_CPUMEMPAGE_VCPU_WARNING" xml:space="preserve">
<value>More vCPUs than physical CPUs may lead to reduced VM performance</value>
<value>There are no servers with enough physical CPUs to start the VM.</value>
</data>
<data name="VM_CPUMEMPAGE_VCPUS_LABEL" xml:space="preserve">
<value>&amp;Number of vCPUs:</value>

View File

@ -37,6 +37,16 @@ namespace XenAPI
{
public partial class Pool : IComparable<Pool>, IEquatable<Pool>
{
private const string ROLLING_UPGRADE_IN_PROGRESS = "rolling_upgrade_in_progress";
private const string FORBID_RPU_FOR_HCI = "hci-forbid-rpu";
private const string FAULT_TOLERANCE_LIMIT_FOR_HCI = "hci-limit-fault-tolerance";
private const string FORBID_UPDATE_AUTO_RESTARTS = "hci-forbid-update-auto-restart";
public const string HEALTH_CHECK_ENROLLMENT = "Enrollment";
public const string MAIL_DESTINATION_KEY_NAME = "mail-destination";
public const string SMTP_MAILHUB_KEY_NAME = "ssmtp-mailhub";
public const string MAIL_LANGUAGE_KEY_NAME = "mail-language";
public override string ToString()
{
return Name();
@ -106,12 +116,6 @@ namespace XenAPI
return Connection != null && (name_label != "" || Connection.Cache.HostCount > 1);
}
private const string ROLLING_UPGRADE_IN_PROGRESS = "rolling_upgrade_in_progress";
private const string FORBID_RPU_FOR_HCI = "hci-forbid-rpu";
private const string FAULT_TOLERANCE_LIMIT_FOR_HCI = "hci-limit-fault-tolerance";
private const string FORBID_UPDATE_AUTO_RESTARTS = "hci-forbid-update-auto-restart";
public const string HEALTH_CHECK_ENROLLMENT = "Enrollment";
public bool RollingUpgrade()
{
return other_config != null && other_config.ContainsKey(ROLLING_UPGRADE_IN_PROGRESS);

View File

@ -59,6 +59,8 @@ namespace XenAPI
public const long DEFAULT_MEM_MIN_IMG_IMPORT = 256 * Util.BINARY_MEGA;
public const int DEFAULT_CORES_PER_SOCKET = 1;
public const long MAX_SOCKETS = 16; // current hard limit in Xen: CA-198276
// CP-41825: > 32 vCPUs is only supported for trusted VMs
public const long MAX_VCPUS_FOR_NON_TRUSTED_VMS = 32;
private XmlDocument xdRecommendations = null;
public const int MAX_ALLOWED_VTPMS = 1;
@ -477,16 +479,6 @@ namespace XenAPI
other_config = SetDictionaryKey(other_config, "auto_poweron", value.ToString().ToLower());
}
public bool GetIgnoreExcessiveVcpus()
{
return BoolKey(other_config, "ignore_excessive_vcpus");
}
public void SetIgnoreExcessiveVcpus(bool value)
{
other_config = SetDictionaryKey(other_config, "ignore_excessive_vcpus", value.ToString().ToLower());
}
public string IsOnSharedStorage()
{
foreach (XenRef<VBD> vbdRef in VBDs)

View File

@ -139,7 +139,7 @@
<Compile Include="Actions\USB\DeleteVUSBAction.cs" />
<Compile Include="Actions\USB\SetUsbPassthroughAction.cs" />
<Compile Include="Actions\VBD\VbdEditAction.cs" />
<Compile Include="Actions\VBD\VbdSaveAndPlugAction.cs" />
<Compile Include="Actions\VBD\VbdCreateAndPlugAction.cs" />
<Compile Include="Actions\DR\VdiOpenDatabaseAction.cs" />
<Compile Include="Actions\VDI\CreateDiskAction.cs" />
<Compile Include="Actions\VDI\MigrateVirtualDiskAction.cs" />
@ -171,6 +171,11 @@
<Compile Include="Actions\StatusReport\ZipStatusReportAction.cs" />
<Compile Include="Alerts\Types\Alert.cs" />
<Compile Include="BrandManager.cs" />
<Compile Include="Messages.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Messages.resx</DependentUpon>
</Compile>
<Compile Include="SshConsole.cs" />
<Compile Include="FriendlyNames.Designer.cs">
<AutoGen>True</AutoGen>
@ -203,11 +208,6 @@
<Compile Include="FriendlyNameManager.cs" />
<Compile Include="InvokeHelper.cs" />
<Compile Include="Mappings\VmMapping.cs" />
<Compile Include="Messages.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Messages.resx</DependentUpon>
</Compile>
<Compile Include="Network\Cache.cs" />
<Compile Include="Network\ConnectTask.cs" />
<Compile Include="Network\Heartbeat.cs" />
@ -305,7 +305,6 @@
<Compile Include="Actions\WLB\SendWlbConfigurationAction.cs" />
<Compile Include="Actions\WLB\WlbRetrieveRecommendationsAction.cs" />
<Compile Include="Alerts\PerfmonDefinition.cs" />
<Compile Include="Alerts\PerfmonOptionsDefinition.cs" />
<Compile Include="InvisibleMessages.Designer.cs">
<DependentUpon>InvisibleMessages.resx</DependentUpon>
<AutoGen>True</AutoGen>