Set Autostart for a VM in XCP-ng Center (like in XenCenter 5.6 and below)

https://github.com/xcp-ng/xenadmin/issues/132
This commit is contained in:
Alexander Schulz 2019-02-05 23:24:36 +01:00
parent 637a74748d
commit c4189cad2e
6 changed files with 58 additions and 12 deletions

View File

@ -42,6 +42,7 @@ namespace XenAdmin.SettingsPanels
this.m_tlpNonHvm = new System.Windows.Forms.TableLayoutPanel();
this.label2 = new System.Windows.Forms.Label();
this.m_comboBoxBootDevice = new System.Windows.Forms.ComboBox();
this.m_checkBoxAutoBoot = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel1.SuspendLayout();
this.m_tlpHvm.SuspendLayout();
this.m_tlpNonHvm.SuspendLayout();
@ -64,6 +65,7 @@ namespace XenAdmin.SettingsPanels
this.tableLayoutPanel1.Controls.Add(this.m_autoHeightLabelNonHvm, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.m_tlpHvm, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.m_tlpNonHvm, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.m_checkBoxAutoBoot, 0, 3);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
//
// m_autoHeightLabelHvm
@ -136,6 +138,12 @@ namespace XenAdmin.SettingsPanels
this.m_comboBoxBootDevice.Name = "m_comboBoxBootDevice";
this.m_comboBoxBootDevice.SelectedIndexChanged += new System.EventHandler(this.m_comboBoxBootDevice_SelectedIndexChanged);
//
// m_checkBoxAutoBoot
//
resources.ApplyResources(this.m_checkBoxAutoBoot, "m_checkBoxAutoBoot");
this.m_checkBoxAutoBoot.Name = "m_checkBoxAutoBoot";
this.m_checkBoxAutoBoot.UseVisualStyleBackColor = true;
//
// BootOptionsEditPage
//
resources.ApplyResources(this, "$this");
@ -169,6 +177,6 @@ namespace XenAdmin.SettingsPanels
private System.Windows.Forms.Button m_buttonUp;
private System.Windows.Forms.Button m_buttonDown;
private System.Windows.Forms.CheckedListBox m_checkedListBox;
private System.Windows.Forms.CheckBox m_checkBoxAutoBoot;
}
}

View File

@ -78,7 +78,8 @@ namespace XenAdmin.SettingsPanels
{
get
{
return (vm.IsHVM() && GetOrder() != vm.GetBootOrder()) || (m_textBoxOsParams.Text != vm.PV_args) || (VMPVBootableDVD() != bootFromCD);
bool autoBootChanged = m_checkBoxAutoBoot.Checked != vm.GetAutoPowerOn();
return autoBootChanged || (vm.IsHVM() && GetOrder() != vm.GetBootOrder()) || (m_textBoxOsParams.Text != vm.PV_args) || (VMPVBootableDVD() != bootFromCD);
}
}
@ -86,9 +87,11 @@ namespace XenAdmin.SettingsPanels
{
vm.SetBootOrder(GetOrder());
vm.PV_args = m_textBoxOsParams.Text;
return new DelegatedAsyncAction(vm.Connection, "Change VBDs bootable", "Change VBDs bootable", null,
vm.PV_args = m_textBoxOsParams.Text;
vm.SetAutoPowerOn(m_checkBoxAutoBoot.Checked);
return new DelegatedAsyncAction(vm.Connection, "Change VBDs bootable", "Change VBDs bootable", null,
delegate(Session session)
{
if (bootFromCD)
@ -156,9 +159,12 @@ namespace XenAdmin.SettingsPanels
driveLetters.Add(device.ToString());
}
string order = String.Join(", ", driveLetters.ToArray());
return String.Format(Messages.BOOTORDER, order);
string order = String.Join(", ", driveLetters.ToArray());
if (m_checkBoxAutoBoot.Checked)
return String.Format(Messages.BOOTORDER_AUTOSTART, order);
else
return String.Format(Messages.BOOTORDER, order);
}
return Messages.NONE_DEFINED;
@ -183,6 +189,8 @@ namespace XenAdmin.SettingsPanels
private void Repopulate()
{
m_checkBoxAutoBoot.Checked = vm.GetAutoPowerOn();
BootDeviceAndOrderEnabled(vm.IsHVM());
if (vm.IsHVM())

View File

@ -534,9 +534,9 @@
<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="m_autoHeightLabelHvm" Row="0" RowSpan="1" Column="0" ColumnSpan="4" /&gt;&lt;Control Name="m_autoHeightLabelNonHvm" Row="1" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="m_tlpHvm" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="m_tlpNonHvm" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,Absolute,20,AutoSize,0,AutoSize,0,Absolute,20,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">
<data name="$this.Localizable" type="System.Boolean, mscorlib">
<value>True</value>
</metadata>
</data>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>96, 96</value>
</data>
@ -552,4 +552,19 @@
<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="&gt;&gt;m_checkBoxAutoBoot.Name" xml:space="preserve">
<value>m_checkBoxAutoBoot</value>
</data>
<data name="&gt;&gt;m_checkBoxAutoBoot.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;m_checkBoxAutoBoot.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;m_checkBoxAutoBoot.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="m_checkBoxAutoBoot.Text" xml:space="preserve">
<value>Auto-start on server boot</value>
</data>
</root>

View File

@ -964,7 +964,10 @@ namespace XenAdmin.TabPages
PDSection s = pdSectionBootOptions;
if (vm.IsHVM())
s.AddEntry(FriendlyName("VM.auto_boot"), Helpers.BoolToString(vm.GetAutoPowerOn()),
new PropertiesToolStripMenuItem(new VmEditStartupOptionsCommand(Program.MainWindow, vm)));
if (vm.IsHVM())
{
s.AddEntry(FriendlyName("VM.BootOrder"), HVMBootOrder(vm),
new PropertiesToolStripMenuItem(new VmEditStartupOptionsCommand(Program.MainWindow, vm)));

View File

@ -6090,7 +6090,16 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to There are broken SRs after the upgrade. To solve this problem you should reattach the SRs..
/// Sucht eine lokalisierte Zeichenfolge, die Boot order: {0} (auto-start on server boot) ähnelt.
/// </summary>
public static string BOOTORDER_AUTOSTART {
get {
return ResourceManager.GetString("BOOTORDER_AUTOSTART", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die There are broken SRs after the upgrade. To solve this problem you should reattach the SRs. ähnelt.
/// </summary>
public static string BROKEN_SRS_AFTER_UPGRADE {
get {

View File

@ -2222,6 +2222,9 @@ Deleting this bond will disrupt traffic through the secondary interface on the b
<data name="BOOTORDER" xml:space="preserve">
<value>Boot order: {0}</value>
</data>
<data name="BOOTORDER_AUTOSTART" xml:space="preserve">
<value>Boot order: {0} (auto-start on server boot)</value>
</data>
<data name="BOOT_DEVICE_DISABLED_ROW_TEXT" xml:space="preserve">
<value>VM will not boot from devices below this line</value>
</data>