diff --git a/XenAdmin/SettingsPanels/BootOptionsEditPage.Designer.cs b/XenAdmin/SettingsPanels/BootOptionsEditPage.Designer.cs index a77d21a76..ac0b310a3 100644 --- a/XenAdmin/SettingsPanels/BootOptionsEditPage.Designer.cs +++ b/XenAdmin/SettingsPanels/BootOptionsEditPage.Designer.cs @@ -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 diff --git a/XenAdmin/SettingsPanels/BootOptionsEditPage.cs b/XenAdmin/SettingsPanels/BootOptionsEditPage.cs index 755f6b5a6..8e674fff6 100644 --- a/XenAdmin/SettingsPanels/BootOptionsEditPage.cs +++ b/XenAdmin/SettingsPanels/BootOptionsEditPage.cs @@ -92,10 +92,12 @@ 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) { - if (bootFromCD) + if (bootFromCD) { foreach (var vbd in vm.Connection.ResolveAll(vm.VBDs)) VBD.set_bootable(session, vbd.opaque_ref, vbd.IsCDROM()); @@ -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 } } diff --git a/XenAdmin/SettingsPanels/BootOptionsEditPage.resx b/XenAdmin/SettingsPanels/BootOptionsEditPage.resx index c3ece3ae0..afd1ceca7 100644 --- a/XenAdmin/SettingsPanels/BootOptionsEditPage.resx +++ b/XenAdmin/SettingsPanels/BootOptionsEditPage.resx @@ -214,7 +214,7 @@ m_autoHeightLabelHvm - XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.Common.AutoHeightLabel, XCP-ng Center, Version=99.99.99.29, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -247,7 +247,7 @@ m_autoHeightLabelNonHvm - XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.Common.AutoHeightLabel, XCP-ng Center, Version=99.99.99.29, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -316,7 +316,7 @@ m_autoHeightLabelAutoBoot - XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.Common.AutoHeightLabel, XCP-ng Center, Version=99.99.99.29, Culture=neutral, PublicKeyToken=null m_tlpAutoBoot @@ -349,7 +349,7 @@ m_autoHeightLabelAutoBootHAWarning - XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.Common.AutoHeightLabel, XCP-ng Center, Version=99.99.99.29, Culture=neutral, PublicKeyToken=null m_tlpAutoBoot @@ -397,10 +397,10 @@ 3, 16 - 2 + 4 - 438, 55 + 438, 75 7 @@ -418,7 +418,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="m_picInfoAutoBoot" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_autoHeightLabelAutoBoot" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="m_autoHeightLabelAutoBootHAWarning" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="m_checkBoxAutoBoot" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /></Controls><Columns Styles="AutoSize,0,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,Absolute,20" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="m_picInfoAutoBoot" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_autoHeightLabelAutoBoot" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="m_autoHeightLabelAutoBootHAWarning" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="m_checkBoxAutoBoot" Row="2" RowSpan="1" Column="0" ColumnSpan="2" /></Controls><Columns Styles="AutoSize,0,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,Absolute,20,Absolute,20" /></TableLayoutSettings> Fill @@ -427,7 +427,7 @@ 3, 101 - 444, 74 + 444, 94 8 @@ -598,7 +598,7 @@ Fill - 3, 181 + 3, 201 5 @@ -724,7 +724,7 @@ Fill - 3, 344 + 3, 364 5 diff --git a/XenAdmin/TabPages/GeneralTabPage.cs b/XenAdmin/TabPages/GeneralTabPage.cs index d5077ffbe..2f005fbc4 100644 --- a/XenAdmin/TabPages/GeneralTabPage.cs +++ b/XenAdmin/TabPages/GeneralTabPage.cs @@ -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) diff --git a/XenModel/XenAPI-Extensions/Host.cs b/XenModel/XenAPI-Extensions/Host.cs index 1c4d38f96..96e0168a4 100644 --- a/XenModel/XenAPI-Extensions/Host.cs +++ b/XenModel/XenAPI-Extensions/Host.cs @@ -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)) @@ -181,7 +191,7 @@ namespace XenAPI software_version.ContainsKey("product_brand") ? software_version["product_brand"] : BrandManager.ProductBrand); - + return name_description ?? ""; } @@ -204,8 +214,8 @@ namespace XenAPI /// public virtual DateTime? LicenseCssExpiry() { - if(license_params != null && - license_params.TryGetValue("css_expiry", out var cssExpiryValue) && + if (license_params != null && + license_params.TryGetValue("css_expiry", out var cssExpiryValue) && !string.IsNullOrEmpty(cssExpiryValue) && Util.TryParseNonIso8601DateTime(cssExpiryValue, out var result)) { @@ -268,9 +278,9 @@ namespace XenAPI public static bool RestrictVSwitchController(Host h) { - return BoolKeyPreferTrue(h.license_params, "restrict_vswitch_controller"); + return BoolKeyPreferTrue(h.license_params, "restrict_vswitch_controller"); } - + public static bool RestrictSriovNetwork(Host h) { return BoolKeyPreferTrue(h.license_params, "restrict_network_sriov"); @@ -425,12 +435,12 @@ namespace XenAPI public static bool RestrictExportResourceData(Host h) { - return BoolKeyPreferTrue(h.license_params, "restrict_export_resource_data"); - } + return BoolKeyPreferTrue(h.license_params, "restrict_export_resource_data"); + } public static bool RestrictIntraPoolMigrate(Host h) { - return BoolKey(h.license_params, "restrict_xen_motion"); + return BoolKey(h.license_params, "restrict_xen_motion"); } /// @@ -448,7 +458,7 @@ namespace XenAPI public static bool RestrictHealthCheck(Host h) { - return BoolKeyPreferTrue(h.license_params, "restrict_health_check"); + return BoolKeyPreferTrue(h.license_params, "restrict_health_check"); } /// @@ -456,7 +466,7 @@ namespace XenAPI /// public static bool RestrictVss(Host h) { - return BoolKey(h.license_params, "restrict_vss"); + return BoolKey(h.license_params, "restrict_vss"); } public static bool RestrictPoolSize(Host h) @@ -601,7 +611,7 @@ namespace XenAPI public String MultipathHandle() { - return Get(other_config, MULTIPATH_HANDLE); + return Get(other_config, MULTIPATH_HANDLE); } public override int CompareTo(Host other) @@ -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; @@ -1618,7 +1628,7 @@ namespace XenAPI out string platformVersion, out string productVersion) { platformVersion = productVersion = null; - + try { var result = call_plugin(host.Connection.Session, host.opaque_ref, diff --git a/XenModel/XenAPI-Extensions/Pool.cs b/XenModel/XenAPI-Extensions/Pool.cs index cba88e014..66cfd620a 100644 --- a/XenModel/XenAPI-Extensions/Pool.cs +++ b/XenModel/XenAPI-Extensions/Pool.cs @@ -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 } } diff --git a/XenModel/XenAPI-Extensions/VM.cs b/XenModel/XenAPI-Extensions/VM.cs index db204f793..e62850baa 100644 --- a/XenModel/XenAPI-Extensions/VM.cs +++ b/XenModel/XenAPI-Extensions/VM.cs @@ -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()