mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CP-25564: Changed clusteringEnabled variable (#1891)
* CP-25564: Changed clusteringEnabled variable * CP-26026: Added a link to enable clustering on SR Wizard * CP-26026: Tweaked according to PR feedback * CP-25967: Added license restriction for GFS2 Signed-off-by: serenc <seren.corbett@citrix.com>
This commit is contained in:
parent
8fe11d5bb2
commit
f4d501474a
@ -210,7 +210,7 @@ namespace XenAdmin.Dialogs
|
||||
if (is_pool_or_standalone && !Helpers.FeatureForbidden(xenObject.Connection, Host.RestrictIGMPSnooping) && Helpers.GetMaster(pool).vSwitchNetworkBackend())
|
||||
ShowTab(NetworkOptionsEditPage = new NetworkOptionsEditPage());
|
||||
|
||||
if (is_pool_or_standalone && !Helpers.FeatureForbidden(xenObject.Connection, Host.RestrictGfs2))
|
||||
if (is_pool_or_standalone && !Helpers.FeatureForbidden(xenObject.Connection, Host.RestrictCorosync))
|
||||
ShowTab(ClusteringEditPage = new ClusteringEditPage());
|
||||
|
||||
if (is_network)
|
||||
@ -601,6 +601,11 @@ namespace XenAdmin.Dialogs
|
||||
SelectPage(vdiSizeLocation);
|
||||
}
|
||||
|
||||
public void SelectClusteringEditPage()
|
||||
{
|
||||
SelectPage(ClusteringEditPage);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
@ -81,11 +81,10 @@ namespace XenAdmin.SettingsPanels
|
||||
public void SetXenObjects(IXenObject orig, IXenObject clone)
|
||||
{
|
||||
pool = Helpers.GetPoolOfOne(clone.Connection);
|
||||
var master = Helpers.GetMaster(clone.Connection);
|
||||
tableLayoutInfo.Visible = false;
|
||||
|
||||
clusteringEnabled = pool.Connection.Cache.Cluster_hosts.Any(cluster => cluster.host.opaque_ref == master.opaque_ref && cluster.enabled);
|
||||
var existingCluster = pool.Connection.Cache.Clusters.FirstOrDefault();
|
||||
clusteringEnabled = existingCluster != null;
|
||||
CheckBoxEnableClustering.Checked = clusteringEnabled;
|
||||
LoadNetworks(existingCluster);
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
this.tableLayoutInfo = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.labelWarning = new System.Windows.Forms.Label();
|
||||
this.pictureBoxInfo = new System.Windows.Forms.PictureBox();
|
||||
this.linkLabelPoolProperties = new System.Windows.Forms.LinkLabel();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.tableLayoutInfo.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxInfo)).BeginInit();
|
||||
@ -88,6 +89,7 @@
|
||||
resources.ApplyResources(this.tableLayoutInfo, "tableLayoutInfo");
|
||||
this.tableLayoutInfo.Controls.Add(this.labelWarning, 1, 0);
|
||||
this.tableLayoutInfo.Controls.Add(this.pictureBoxInfo, 0, 0);
|
||||
this.tableLayoutInfo.Controls.Add(this.linkLabelPoolProperties, 2, 0);
|
||||
this.tableLayoutInfo.Name = "tableLayoutInfo";
|
||||
//
|
||||
// labelWarning
|
||||
@ -102,6 +104,13 @@
|
||||
this.pictureBoxInfo.Name = "pictureBoxInfo";
|
||||
this.pictureBoxInfo.TabStop = false;
|
||||
//
|
||||
// linkLabelPoolProperties
|
||||
//
|
||||
resources.ApplyResources(this.linkLabelPoolProperties, "linkLabelPoolProperties");
|
||||
this.linkLabelPoolProperties.Name = "linkLabelPoolProperties";
|
||||
this.linkLabelPoolProperties.TabStop = true;
|
||||
this.linkLabelPoolProperties.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelPoolProperties_LinkClicked);
|
||||
//
|
||||
// ChooseSrProvisioningPage
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
@ -128,5 +137,6 @@
|
||||
private System.Windows.Forms.PictureBox pictureBoxInfo;
|
||||
private System.Windows.Forms.Label labelWarning;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutInfo;
|
||||
private System.Windows.Forms.LinkLabel linkLabelPoolProperties;
|
||||
}
|
||||
}
|
||||
|
@ -29,9 +29,11 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using XenAdmin.Controls;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Dialogs;
|
||||
using XenAPI;
|
||||
|
||||
namespace XenAdmin.Wizards.NewSRWizard_Pages
|
||||
@ -42,8 +44,9 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
|
||||
public ChooseSrProvisioningPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Cluster_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(Cluster_CollectionChanged);
|
||||
}
|
||||
|
||||
private readonly CollectionChangeEventHandler Cluster_CollectionChangedWithInvoke;
|
||||
#region XenTabPage overrides
|
||||
|
||||
public override string Text { get { return Messages.PROVISIONING; } }
|
||||
@ -64,17 +67,62 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
|
||||
}
|
||||
}
|
||||
|
||||
public override void PopulatePage()
|
||||
private void RefreshPage()
|
||||
{
|
||||
var master = Helpers.GetMaster(Connection);
|
||||
|
||||
var gfs2Allowed = !Helpers.FeatureForbidden(Connection, Host.RestrictGfs2) && Connection.Cache.Cluster_hosts.Any(cluster => cluster.host.opaque_ref == master.opaque_ref && cluster.enabled);
|
||||
var clusteringEnabled = Connection.Cache.Clusters.Any();
|
||||
var restrictGfs2 = Helpers.FeatureForbidden(Connection, Host.RestrictCorosync);
|
||||
var gfs2Allowed = !restrictGfs2 && clusteringEnabled;
|
||||
|
||||
radioButtonGfs2.Enabled = labelGFS2.Enabled = gfs2Allowed;
|
||||
tableLayoutInfo.Visible = radioButtonLvm.Checked = !gfs2Allowed;
|
||||
labelWarning.Text = Helpers.FeatureForbidden(Connection, Host.RestrictGfs2)
|
||||
|
||||
if (!gfs2Allowed)
|
||||
{
|
||||
radioButtonLvm.Checked = true;
|
||||
}
|
||||
|
||||
tableLayoutInfo.Visible = !gfs2Allowed;
|
||||
labelWarning.Text = restrictGfs2
|
||||
? Messages.GFS2_INCORRECT_POOL_LICENSE
|
||||
: Messages.GFS2_REQUIRES_CLUSTERING_ENABLED;
|
||||
linkLabelPoolProperties.Visible = !clusteringEnabled && !restrictGfs2;
|
||||
}
|
||||
|
||||
public override void PageLoaded(PageLoadedDirection direction)
|
||||
{
|
||||
base.PageLoaded(direction);
|
||||
RefreshPage();
|
||||
Connection.Cache.RegisterCollectionChanged<Cluster>(Cluster_CollectionChangedWithInvoke);
|
||||
}
|
||||
|
||||
public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
|
||||
{
|
||||
Connection.Cache.DeregisterCollectionChanged<Cluster>(Cluster_CollectionChangedWithInvoke);
|
||||
|
||||
base.PageLeave(direction, ref cancel);
|
||||
}
|
||||
|
||||
private void linkLabelPoolProperties_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
var pool = Helpers.GetPoolOfOne(Connection);
|
||||
|
||||
if (pool == null)
|
||||
return;
|
||||
|
||||
using (PropertiesDialog propertiesDialog = new PropertiesDialog(pool))
|
||||
{
|
||||
propertiesDialog.SelectClusteringEditPage();
|
||||
propertiesDialog.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the current IXenConnection's VM dictionary changes.
|
||||
/// </summary>
|
||||
private void Cluster_CollectionChanged(object sender, CollectionChangeEventArgs e)
|
||||
{
|
||||
Program.AssertOnEventThread();
|
||||
|
||||
RefreshPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +292,7 @@
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="tableLayoutInfo.ColumnCount" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="labelWarning.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -348,6 +348,36 @@
|
||||
<data name=">>pictureBoxInfo.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="linkLabelPoolProperties.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="linkLabelPoolProperties.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>28, 15</value>
|
||||
</data>
|
||||
<data name="linkLabelPoolProperties.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>0, 15, 3, 0</value>
|
||||
</data>
|
||||
<data name="linkLabelPoolProperties.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>97, 13</value>
|
||||
</data>
|
||||
<data name="linkLabelPoolProperties.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="linkLabelPoolProperties.Text" xml:space="preserve">
|
||||
<value>Enable clustering...</value>
|
||||
</data>
|
||||
<data name=">>linkLabelPoolProperties.Name" xml:space="preserve">
|
||||
<value>linkLabelPoolProperties</value>
|
||||
</data>
|
||||
<data name=">>linkLabelPoolProperties.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=">>linkLabelPoolProperties.Parent" xml:space="preserve">
|
||||
<value>tableLayoutInfo</value>
|
||||
</data>
|
||||
<data name=">>linkLabelPoolProperties.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="tableLayoutInfo.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 129</value>
|
||||
</data>
|
||||
@ -355,7 +385,7 @@
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="tableLayoutInfo.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>28, 38</value>
|
||||
<value>128, 38</value>
|
||||
</data>
|
||||
<data name="tableLayoutInfo.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
@ -373,7 +403,7 @@
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="tableLayoutInfo.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelWarning" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pictureBoxInfo" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="Percent,100" /></TableLayoutSettings></value>
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelWarning" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pictureBoxInfo" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="linkLabelPoolProperties" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100,AutoSize,0" /><Rows Styles="Percent,100" /></TableLayoutSettings></value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
@ -406,7 +436,7 @@
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="radioButtonGfs2" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelGFS2" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="radioButtonLvm" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="label3" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="tableLayoutInfo" Row="5" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /></TableLayoutSettings></value>
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="radioButtonGfs2" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelGFS2" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="radioButtonLvm" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="label3" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="tableLayoutInfo" Row="5" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,Absolute,20" /></TableLayoutSettings></value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
|
@ -430,9 +430,9 @@ namespace XenAPI
|
||||
: h.IsFreeLicenseOrExpired(); // restrict on Free edition or if the license has expired
|
||||
}
|
||||
|
||||
public static bool RestrictGfs2(Host h)
|
||||
public static bool RestrictCorosync(Host h)
|
||||
{
|
||||
return !Helpers.KolkataOrGreater(h); //BoolKeyPreferTrue(h.license_params, "restrict_gfs2");
|
||||
return BoolKeyPreferTrue(h.license_params, "restrict_corosync");
|
||||
}
|
||||
|
||||
public bool HasPBDTo(SR sr)
|
||||
|
Loading…
Reference in New Issue
Block a user