add information on general page of pool and vm; repair autoboot setting after merge from upstream

This commit is contained in:
Alexander Schulz 2024-01-04 14:26:45 +01:00
parent b4bba6b679
commit aa51937727
7 changed files with 67 additions and 28 deletions

View File

@ -91,7 +91,7 @@ namespace XenAdmin.SettingsPanels
this.m_tlpAutoBoot.Controls.Add(this.m_picInfoAutoBoot, 0, 0);
this.m_tlpAutoBoot.Controls.Add(this.m_autoHeightLabelAutoBoot, 1, 0);
this.m_tlpAutoBoot.Controls.Add(this.m_autoHeightLabelAutoBootHAWarning, 1, 0);
this.m_tlpAutoBoot.Controls.Add(this.m_checkBoxAutoBoot, 0, 1);
this.m_tlpAutoBoot.Controls.Add(this.m_checkBoxAutoBoot, 0, 2);
this.m_tlpAutoBoot.Name = "m_tlpAutoBoot";
//
// m_picInfoAutoBoot

View File

@ -92,6 +92,8 @@ namespace XenAdmin.SettingsPanels
vm.SetAutoPowerOn(m_checkBoxAutoBoot.Checked);
vm.PV_args = m_textBoxOsParams.Text;
return new DelegatedAsyncAction(vm.Connection, "Change VBDs bootable", "Change VBDs bootable", null,
delegate(Session session)
{
@ -187,7 +189,8 @@ namespace XenAdmin.SettingsPanels
m_picInfoAutoBoot.Visible = false;
m_autoHeightLabelAutoBoot.Visible = false;
m_autoHeightLabelAutoBootHAWarning.Visible = false;
m_checkBoxAutoBoot.Visible = false;
m_checkBoxAutoBoot.Checked = vm.GetAutoPowerOn();
BootDeviceAndOrderEnabled(vm.IsHVM());
@ -351,8 +354,8 @@ namespace XenAdmin.SettingsPanels
Convert(false);
}
#endregion
#endregion
}
}

View File

@ -214,7 +214,7 @@
<value>m_autoHeightLabelHvm</value>
</data>
<data name="&gt;&gt;m_autoHeightLabelHvm.Type" xml:space="preserve">
<value>XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.Common.AutoHeightLabel, XCP-ng Center, Version=99.99.99.29, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;m_autoHeightLabelHvm.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -247,7 +247,7 @@
<value>m_autoHeightLabelNonHvm</value>
</data>
<data name="&gt;&gt;m_autoHeightLabelNonHvm.Type" xml:space="preserve">
<value>XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.Common.AutoHeightLabel, XCP-ng Center, Version=99.99.99.29, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;m_autoHeightLabelNonHvm.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -316,7 +316,7 @@
<value>m_autoHeightLabelAutoBoot</value>
</data>
<data name="&gt;&gt;m_autoHeightLabelAutoBoot.Type" xml:space="preserve">
<value>XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.Common.AutoHeightLabel, XCP-ng Center, Version=99.99.99.29, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;m_autoHeightLabelAutoBoot.Parent" xml:space="preserve">
<value>m_tlpAutoBoot</value>
@ -349,7 +349,7 @@
<value>m_autoHeightLabelAutoBootHAWarning</value>
</data>
<data name="&gt;&gt;m_autoHeightLabelAutoBootHAWarning.Type" xml:space="preserve">
<value>XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.Common.AutoHeightLabel, XCP-ng Center, Version=99.99.99.29, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;m_autoHeightLabelAutoBootHAWarning.Parent" xml:space="preserve">
<value>m_tlpAutoBoot</value>
@ -397,10 +397,10 @@
<value>3, 16</value>
</data>
<data name="m_tlpAutoBoot.RowCount" type="System.Int32, mscorlib">
<value>2</value>
<value>4</value>
</data>
<data name="m_tlpAutoBoot.Size" type="System.Drawing.Size, System.Drawing">
<value>438, 55</value>
<value>438, 75</value>
</data>
<data name="m_tlpAutoBoot.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
@ -418,7 +418,7 @@
<value>0</value>
</data>
<data name="m_tlpAutoBoot.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_picInfoAutoBoot" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="m_autoHeightLabelAutoBoot" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="m_autoHeightLabelAutoBootHAWarning" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="m_checkBoxAutoBoot" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,AutoSize,0" /&gt;&lt;Rows Styles="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="m_picInfoAutoBoot" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="m_autoHeightLabelAutoBoot" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="m_autoHeightLabelAutoBootHAWarning" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="m_checkBoxAutoBoot" Row="2" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,AutoSize,0" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,Absolute,20,Absolute,20" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="m_groupBoxAutoBoot.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
@ -427,7 +427,7 @@
<value>3, 101</value>
</data>
<data name="m_groupBoxAutoBoot.Size" type="System.Drawing.Size, System.Drawing">
<value>444, 74</value>
<value>444, 94</value>
</data>
<data name="m_groupBoxAutoBoot.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
@ -598,7 +598,7 @@
<value>Fill</value>
</data>
<data name="m_tlpHvm.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 181</value>
<value>3, 201</value>
</data>
<data name="m_tlpHvm.RowCount" type="System.Int32, mscorlib">
<value>5</value>
@ -724,7 +724,7 @@
<value>Fill</value>
</data>
<data name="m_tlpNonHvm.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 344</value>
<value>3, 364</value>
</data>
<data name="m_tlpNonHvm.RowCount" type="System.Int32, mscorlib">
<value>5</value>

View File

@ -742,6 +742,9 @@ namespace XenAdmin.TabPages
PDSection s = pdSectionBootOptions;
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),
@ -974,6 +977,8 @@ namespace XenAdmin.TabPages
s.AddEntry(FriendlyName("host.enabled"), Messages.YES, item);
}
s.AddEntry("Autoboot of VMs enabled", Helpers.BoolToString(host.GetVmAutostartEnabled()));
if (Helpers.CloudOrGreater(host) && Helpers.XapiEqualOrGreater_1_290_0(host))
{
var pool = Helpers.GetPoolOfOne(xenObject.Connection);
@ -1115,6 +1120,8 @@ namespace XenAdmin.TabPages
{
s.AddEntry(Messages.NUMBER_OF_SOCKETS, p.CpuSockets().ToString());
s.AddEntry("Autoboot of VMs enabled", Helpers.BoolToString(p.GetVmAutostartEnabled()));
if (Helpers.CloudOrGreater(p.Connection) && Helpers.XapiEqualOrGreater_1_290_0(p.Connection))
{
if (p.tls_verification_enabled)

View File

@ -147,6 +147,16 @@ namespace XenAPI
}
}
public bool GetVmAutostartEnabled()
{
Pool p = Helpers.GetPoolOfOne(Connection);
if (p != null)
return p.GetVmAutostartEnabled();
else
return false;
}
public string GetIscsiIqn()
{
if (Helpers.KolkataOrGreater(this))
@ -204,7 +214,7 @@ namespace XenAPI
/// </summary>
public virtual DateTime? LicenseCssExpiry()
{
if(license_params != null &&
if (license_params != null &&
license_params.TryGetValue("css_expiry", out var cssExpiryValue) &&
!string.IsNullOrEmpty(cssExpiryValue) &&
Util.TryParseNonIso8601DateTime(cssExpiryValue, out var result))
@ -1436,7 +1446,7 @@ namespace XenAPI
var sockets = CpuSockets();
var cpuCount = CpuCount();
if (sockets > 0 && cpuCount > 0)
return (cpuCount/sockets);
return (cpuCount / sockets);
return 0;
}
@ -1549,7 +1559,7 @@ namespace XenAPI
description = value.Substring(0, x);
string val = value.Substring(x + 10);
string[] delims = new string[] {", "};
string[] delims = new string[] { ", " };
string[] splitValue = val.Split(delims, StringSplitOptions.None);
if (splitValue.Length == 0 || splitValue.Length > 3)
return;

View File

@ -287,6 +287,17 @@ namespace XenAPI
return base.Equals(other);
}
public bool GetVmAutostartEnabled()
{
string auto_poweron = Get(other_config, "auto_poweron");
if (auto_poweron == null)
{
return false;
}
return auto_poweron == "true" ? true : false;
}
#endregion
}
}

View File

@ -659,6 +659,14 @@ namespace XenAPI
public void SetAutoPowerOn(bool value)
{
other_config = SetDictionaryKey(other_config, "auto_poweron", value.ToString().ToLower());
//// set auto_poweron on pool
//Pool p = Helpers.GetPoolOfOne(Connection);
//if (p != null)
//{
// p.other_config = Pool.SetDictionaryKey(p.other_config, "auto_poweron", "true");
// p.SaveChanges(Connection.Session); // need to lock pool first, but how?!?
//}
}
public string IsOnSharedStorage()