CP-28676: XC: Allow choosing boot options during new VM wizard

Signed-off-by: Tim Liu <tim.liu@citrix.com>
This commit is contained in:
Tim Liu 2018-08-20 18:24:20 +08:00 committed by Konstantina Chremmou
parent 25c0787238
commit 98207906d7
6 changed files with 304 additions and 8 deletions

View File

@ -173,6 +173,7 @@ namespace XenAdmin.Wizards.NewVMWizard
(long)page_5_CpuMem.SelectedMemoryDynamicMin,
(long)page_5_CpuMem.SelectedMemoryDynamicMax,
(long)page_5_CpuMem.SelectedMemoryStaticMax,
page_5_CpuMem.SelectedBootMode,
page_6b_LunPerVdi.MapLunsToVdisRequired
? page_6b_LunPerVdi.MappedDisks
: page_6_Storage.SelectedDisks,

View File

@ -44,9 +44,16 @@ namespace XenAdmin.Wizards.NewVMWizard
this.comboBoxTopology = new XenAdmin.Controls.CPUTopologyComboBox();
this.labelTopology = new System.Windows.Forms.Label();
this.comboBoxVCPUs = new System.Windows.Forms.ComboBox();
this.groupBoxBootMode = new System.Windows.Forms.GroupBox();
this.tableLayoutPanelBootMode = new System.Windows.Forms.TableLayoutPanel();
this.radioButtonUEFISecureBoot = new System.Windows.Forms.RadioButton();
this.radioButtonBIOSBoot = new System.Windows.Forms.RadioButton();
this.radioButtonUEFIBoot = new System.Windows.Forms.RadioButton();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.ErrorPanel.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.groupBoxBootMode.SuspendLayout();
this.tableLayoutPanelBootMode.SuspendLayout();
this.SuspendLayout();
//
// labelVCPUs
@ -117,6 +124,7 @@ namespace XenAdmin.Wizards.NewVMWizard
this.tableLayoutPanel1.Controls.Add(this.spinnerDynMin, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.labelTopology, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.comboBoxVCPUs, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.groupBoxBootMode, 0, 8);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
//
// comboBoxInitialVCPUs
@ -158,6 +166,42 @@ namespace XenAdmin.Wizards.NewVMWizard
this.comboBoxVCPUs.Name = "comboBoxVCPUs";
this.comboBoxVCPUs.SelectedIndexChanged += new System.EventHandler(this.vCPU_ValueChanged);
//
// groupBoxBootMode
//
this.tableLayoutPanel1.SetColumnSpan(this.groupBoxBootMode, 2);
this.groupBoxBootMode.Controls.Add(this.tableLayoutPanelBootMode);
resources.ApplyResources(this.groupBoxBootMode, "groupBoxBootMode");
this.groupBoxBootMode.Name = "groupBoxBootMode";
this.groupBoxBootMode.TabStop = false;
//
// tableLayoutPanelBootMode
//
this.tableLayoutPanelBootMode.Controls.Add(this.radioButtonUEFISecureBoot, 0, 2);
this.tableLayoutPanelBootMode.Controls.Add(this.radioButtonBIOSBoot, 0, 0);
this.tableLayoutPanelBootMode.Controls.Add(this.radioButtonUEFIBoot, 0, 1);
resources.ApplyResources(this.tableLayoutPanelBootMode, "tableLayoutPanelBootMode");
this.tableLayoutPanelBootMode.Name = "tableLayoutPanelBootMode";
//
// radioButtonUEFISecureBoot
//
resources.ApplyResources(this.radioButtonUEFISecureBoot, "radioButtonUEFISecureBoot");
this.radioButtonUEFISecureBoot.Name = "radioButtonUEFISecureBoot";
this.radioButtonUEFISecureBoot.UseVisualStyleBackColor = true;
//
// radioButtonBIOSBoot
//
resources.ApplyResources(this.radioButtonBIOSBoot, "radioButtonBIOSBoot");
this.radioButtonBIOSBoot.Name = "radioButtonBIOSBoot";
this.radioButtonBIOSBoot.TabStop = true;
this.radioButtonBIOSBoot.UseVisualStyleBackColor = true;
//
// radioButtonUEFIBoot
//
resources.ApplyResources(this.radioButtonUEFIBoot, "radioButtonUEFIBoot");
this.radioButtonUEFIBoot.Name = "radioButtonUEFIBoot";
this.radioButtonUEFIBoot.TabStop = true;
this.radioButtonUEFIBoot.UseVisualStyleBackColor = true;
//
// Page_CpuMem
//
resources.ApplyResources(this, "$this");
@ -170,6 +214,9 @@ namespace XenAdmin.Wizards.NewVMWizard
this.ErrorPanel.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.groupBoxBootMode.ResumeLayout(false);
this.tableLayoutPanelBootMode.ResumeLayout(false);
this.tableLayoutPanelBootMode.PerformLayout();
this.ResumeLayout(false);
}
@ -191,5 +238,10 @@ namespace XenAdmin.Wizards.NewVMWizard
private System.Windows.Forms.ComboBox comboBoxVCPUs;
private System.Windows.Forms.ComboBox comboBoxInitialVCPUs;
private System.Windows.Forms.Label labelInitialVCPUs;
private System.Windows.Forms.GroupBox groupBoxBootMode;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelBootMode;
private System.Windows.Forms.RadioButton radioButtonUEFISecureBoot;
private System.Windows.Forms.RadioButton radioButtonBIOSBoot;
private System.Windows.Forms.RadioButton radioButtonUEFIBoot;
}
}

View File

@ -33,11 +33,11 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using XenAPI;
using XenAdmin.Controls;
using XenAdmin.Controls.Ballooning;
using XenAdmin.Core;
using XenAPI;
using BootMode = XenAdmin.Actions.VMActions.BootMode;
namespace XenAdmin.Wizards.NewVMWizard
{
@ -119,6 +119,8 @@ namespace XenAdmin.Wizards.NewVMWizard
SetSpinnerLimitsAndIncrement();
InitialiseBootModeControls();
ValuesUpdated();
initialising = false;
@ -129,6 +131,42 @@ namespace XenAdmin.Wizards.NewVMWizard
comboBoxVCPUs.Select();
}
private void InitialiseBootModeControls()
{
if (Template.IsHVM())
{
groupBoxBootMode.Visible = true;
radioButtonBIOSBoot.Enabled = Template.CanSupportBIOSBoot();
radioButtonUEFIBoot.Enabled = Template.CanSupportUEFIBoot();
radioButtonUEFISecureBoot.Enabled = Template.CanSupportUEFISecureBoot();
var firmware = string.Empty;
if (Template.HVM_boot_params != null)
Template.HVM_boot_params.TryGetValue("firmware", out firmware);
var secureboot = string.Empty;
if (Template.platform != null)
Template.platform.TryGetValue("secureboot", out secureboot);
if (firmware != null && firmware.ToLower() == "uefi")
{
var isSecurebootEnabled = secureboot != null && secureboot.ToLower() == "true";
radioButtonUEFIBoot.Checked = !isSecurebootEnabled;
radioButtonUEFISecureBoot.Checked = isSecurebootEnabled;
}
else
{
radioButtonBIOSBoot.Checked = true;
}
}
else
{
groupBoxBootMode.Visible = false;
radioButtonBIOSBoot.Checked = false;
radioButtonUEFIBoot.Checked = false;
radioButtonUEFISecureBoot.Checked = false;
}
}
private void InitialiseVcpuControls()
{
labelVCPUs.Text = isVcpuHotplugSupported
@ -283,6 +321,14 @@ namespace XenAdmin.Wizards.NewVMWizard
}
}
public BootMode SelectedBootMode
{
get
{
return radioButtonUEFISecureBoot.Checked ? BootMode.UEFI_SECURE_BOOT : (radioButtonUEFIBoot.Checked ? BootMode.UEFI_BOOT : BootMode.BIOS_BOOT);
}
}
public override List<KeyValuePair<string, string>> PageSummary
{
get

View File

@ -414,6 +414,141 @@
<data name="&gt;&gt;comboBoxVCPUs.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="radioButtonUEFISecureBoot.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="radioButtonUEFISecureBoot.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 49</value>
</data>
<data name="radioButtonUEFISecureBoot.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 17</value>
</data>
<data name="radioButtonUEFISecureBoot.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="radioButtonUEFISecureBoot.Text" xml:space="preserve">
<value>UEFI &amp;Secure Boot</value>
</data>
<data name="&gt;&gt;radioButtonUEFISecureBoot.Name" xml:space="preserve">
<value>radioButtonUEFISecureBoot</value>
</data>
<data name="&gt;&gt;radioButtonUEFISecureBoot.Type" xml:space="preserve">
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;radioButtonUEFISecureBoot.Parent" xml:space="preserve">
<value>tableLayoutPanelBootMode</value>
</data>
<data name="&gt;&gt;radioButtonUEFISecureBoot.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="radioButtonBIOSBoot.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="radioButtonBIOSBoot.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 3</value>
</data>
<data name="radioButtonBIOSBoot.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 17</value>
</data>
<data name="radioButtonBIOSBoot.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="radioButtonBIOSBoot.Text" xml:space="preserve">
<value>&amp;BIOS Boot</value>
</data>
<data name="&gt;&gt;radioButtonBIOSBoot.Name" xml:space="preserve">
<value>radioButtonBIOSBoot</value>
</data>
<data name="&gt;&gt;radioButtonBIOSBoot.Type" xml:space="preserve">
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;radioButtonBIOSBoot.Parent" xml:space="preserve">
<value>tableLayoutPanelBootMode</value>
</data>
<data name="&gt;&gt;radioButtonBIOSBoot.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="radioButtonUEFIBoot.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="radioButtonUEFIBoot.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 26</value>
</data>
<data name="radioButtonUEFIBoot.Size" type="System.Drawing.Size, System.Drawing">
<value>74, 17</value>
</data>
<data name="radioButtonUEFIBoot.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="radioButtonUEFIBoot.Text" xml:space="preserve">
<value>&amp;UEFI Boot</value>
</data>
<data name="&gt;&gt;radioButtonUEFIBoot.Name" xml:space="preserve">
<value>radioButtonUEFIBoot</value>
</data>
<data name="&gt;&gt;radioButtonUEFIBoot.Type" xml:space="preserve">
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;radioButtonUEFIBoot.Parent" xml:space="preserve">
<value>tableLayoutPanelBootMode</value>
</data>
<data name="&gt;&gt;radioButtonUEFIBoot.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="tableLayoutPanelBootMode.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="tableLayoutPanelBootMode.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 16</value>
</data>
<data name="tableLayoutPanelBootMode.Size" type="System.Drawing.Size, System.Drawing">
<value>244, 75</value>
</data>
<data name="tableLayoutPanelBootMode.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;tableLayoutPanelBootMode.Name" xml:space="preserve">
<value>tableLayoutPanelBootMode</value>
</data>
<data name="&gt;&gt;tableLayoutPanelBootMode.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;tableLayoutPanelBootMode.Parent" xml:space="preserve">
<value>groupBoxBootMode</value>
</data>
<data name="&gt;&gt;tableLayoutPanelBootMode.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="tableLayoutPanelBootMode.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="radioButtonUEFISecureBoot" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="radioButtonBIOSBoot" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="radioButtonUEFIBoot" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Absolute,20" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="groupBoxBootMode.Location" type="System.Drawing.Point, System.Drawing">
<value>20, 259</value>
</data>
<data name="groupBoxBootMode.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>20, 3, 245, 3</value>
</data>
<data name="groupBoxBootMode.Size" type="System.Drawing.Size, System.Drawing">
<value>250, 94</value>
</data>
<data name="groupBoxBootMode.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
</data>
<data name="groupBoxBootMode.Text" xml:space="preserve">
<value>Boot Mode</value>
</data>
<data name="&gt;&gt;groupBoxBootMode.Name" xml:space="preserve">
<value>groupBoxBootMode</value>
</data>
<data name="&gt;&gt;groupBoxBootMode.Type" xml:space="preserve">
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;groupBoxBootMode.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;groupBoxBootMode.ZOrder" xml:space="preserve">
<value>11</value>
</data>
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
@ -421,10 +556,10 @@
<value>0, 0</value>
</data>
<data name="tableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
<value>9</value>
<value>10</value>
</data>
<data name="tableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
<value>515, 255</value>
<value>515, 355</value>
</data>
<data name="tableLayoutPanel1.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
@ -442,7 +577,7 @@
<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="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="labelInvalidVCPUWarning" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="comboBoxTopology" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="label5" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="spinnerStatMax" Row="7" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="labelVCPUs" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="spinnerDynMax" Row="6" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="spinnerDynMin" Row="5" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="labelTopology" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="comboBoxVCPUs" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Absolute,190,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,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="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="labelInvalidVCPUWarning" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="comboBoxTopology" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="label5" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="spinnerStatMax" Row="7" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="labelVCPUs" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="spinnerDynMax" Row="6" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="spinnerDynMin" Row="5" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="labelTopology" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="comboBoxVCPUs" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="groupBoxBootMode" Row="8" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Absolute,190,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Absolute,20" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="label5.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
@ -532,7 +667,7 @@
<value>Bottom</value>
</data>
<data name="ErrorPanel.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 255</value>
<value>0, 355</value>
</data>
<data name="ErrorPanel.Size" type="System.Drawing.Size, System.Drawing">
<value>515, 112</value>
@ -562,7 +697,7 @@
<value>96, 96</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>515, 367</value>
<value>515, 467</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>Page_CpuMem</value>

View File

@ -46,6 +46,9 @@ namespace XenAdmin.Actions.VMActions
CD,
Network
}
public enum BootMode { BIOS_BOOT, UEFI_BOOT, UEFI_SECURE_BOOT }
public class CreateVMAction : AsyncAction
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@ -60,6 +63,7 @@ namespace XenAdmin.Actions.VMActions
private readonly long VcpusMax;
private readonly long VcpusAtStartup;
private readonly long MemoryDynamicMin, MemoryDynamicMax, MemoryStaticMax;
private readonly BootMode BootMode;
private readonly List<DiskDescription> Disks;
private readonly List<VIF> Vifs;
private readonly bool StartAfter;
@ -114,7 +118,7 @@ namespace XenAdmin.Actions.VMActions
public CreateVMAction(IXenConnection connection, VM template, Host copyBiosStringsFrom,
string name, string description, InstallMethod installMethod,
string pvArgs, VDI cd, string url, Host homeServer, long vcpusMax, long vcpusAtStartup,
long memoryDynamicMin, long memoryDynamicMax, long memoryStaticMax,
long memoryDynamicMin, long memoryDynamicMax, long memoryStaticMax, BootMode bootMode,
List<DiskDescription> disks, SR fullCopySR, List<VIF> vifs, bool startAfter,
Action<VM, bool> warningDialogHAInvalidConfig,
Action<VMStartAbstractAction, Failure> startDiagnosisForm,
@ -137,6 +141,7 @@ namespace XenAdmin.Actions.VMActions
MemoryDynamicMin = memoryDynamicMin;
MemoryDynamicMax = memoryDynamicMax;
MemoryStaticMax = memoryStaticMax;
BootMode = bootMode;
Disks = disks;
Vifs = vifs;
StartAfter = startAfter;
@ -358,6 +363,23 @@ namespace XenAdmin.Actions.VMActions
{
XenAPI.VM.set_PV_args(Session, VM.opaque_ref, PvArgs);
}
else
{
var hvm_params = VM.HVM_boot_params;
var platform = VM.platform;
if (BootMode == BootMode.UEFI_SECURE_BOOT)
{
hvm_params["firmware"] = "uefi";
platform["secureboot"] = "true";
}
else
{
hvm_params["firmware"] = BootMode == BootMode.UEFI_BOOT ? "uefi" : "bios";
platform["secureboot"] = "false";
}
XenAPI.VM.set_HVM_boot_params(Session, VM.opaque_ref, hvm_params);
XenAPI.VM.set_platform(Session, VM.opaque_ref, platform);
}
}
private bool IsEli()

View File

@ -501,6 +501,46 @@ namespace XenAPI
}
}
#region Supported Boot Mode Recommendations
public bool CanSupportBIOSBoot()
{
return GetRecommendationByField("supports-bios") == "yes";
}
public bool CanSupportUEFIBoot()
{
return GetRecommendationByField("supports-uefi") == "yes";
}
public bool CanSupportUEFISecureBoot()
{
return GetRecommendationByField("supports-secure-boot") == "yes";
}
private string GetRecommendationByField(string fieldName)
{
XmlDocument xd = GetRecommendations();
if (xd == null)
return string.Empty;
try
{
XmlNode xn = xd.SelectSingleNode(@"restrictions/restriction[@field='" + fieldName + "']");
if (xn == null || xn.Attributes == null || xn.Attributes["value"] == null)
return string.Empty;
return xn.Attributes["value"].Value;
}
catch
{
return string.Empty;
}
}
#endregion
// AutoPowerOn is supposed to be unsupported. However, we advise customers how to
// enable it (http://support.citrix.com/article/CTX133910), so XenCenter has to be
// able to recognise it, and turn it off during Rolling Pool Upgrade.