From 9f9754c8b01deff73cbcce15bff9c82766c7b7fe Mon Sep 17 00:00:00 2001 From: serenc Date: Fri, 1 Dec 2017 14:47:50 +0000 Subject: [PATCH] CP-25563: Added Clustering page Signed-off-by: serenc --- XenAdmin/Dialogs/PropertiesDialog.cs | 4 + .../ClusteringEditPage.Designer.cs | 130 ++++++ XenAdmin/SettingsPanels/ClusteringEditPage.cs | 165 ++++++++ .../SettingsPanels/ClusteringEditPage.ja.resx | 381 ++++++++++++++++++ .../SettingsPanels/ClusteringEditPage.resx | 381 ++++++++++++++++++ .../ClusteringEditPage.zh-CN.resx | 381 ++++++++++++++++++ .../ChooseSrProvisioningPage.Designer.cs | 89 ++-- .../ChooseSrProvisioningPage.cs | 9 +- .../ChooseSrProvisioningPage.resx | 297 ++++++++++++++ XenAdmin/XenAdmin.csproj | 21 + .../Actions/Pool/DisableClusteringAction.cs | 52 +++ .../Actions/Pool/EnableClusteringAction.cs | 62 +++ XenModel/Messages.Designer.cs | 81 ++++ XenModel/Messages.resx | 27 ++ XenModel/XenModel.csproj | 2 + 15 files changed, 2009 insertions(+), 73 deletions(-) create mode 100644 XenAdmin/SettingsPanels/ClusteringEditPage.Designer.cs create mode 100644 XenAdmin/SettingsPanels/ClusteringEditPage.cs create mode 100644 XenAdmin/SettingsPanels/ClusteringEditPage.ja.resx create mode 100644 XenAdmin/SettingsPanels/ClusteringEditPage.resx create mode 100644 XenAdmin/SettingsPanels/ClusteringEditPage.zh-CN.resx create mode 100644 XenModel/Actions/Pool/DisableClusteringAction.cs create mode 100644 XenModel/Actions/Pool/EnableClusteringAction.cs diff --git a/XenAdmin/Dialogs/PropertiesDialog.cs b/XenAdmin/Dialogs/PropertiesDialog.cs index 03fb181c9..9001518e7 100644 --- a/XenAdmin/Dialogs/PropertiesDialog.cs +++ b/XenAdmin/Dialogs/PropertiesDialog.cs @@ -79,6 +79,7 @@ namespace XenAdmin.Dialogs private SecurityEditPage SecurityEditPage; private LivePatchingEditPage LivePatchingEditPage; private NetworkOptionsEditPage NetworkOptionsEditPage; + private ClusteringEditPage ClusteringEditPage; #endregion private IXenObject xenObject, xenObjectBefore, xenObjectCopy; @@ -206,6 +207,9 @@ 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)) + ShowTab(ClusteringEditPage = new ClusteringEditPage()); + if (is_network) ShowTab(editNetworkPage = new EditNetworkPage()); diff --git a/XenAdmin/SettingsPanels/ClusteringEditPage.Designer.cs b/XenAdmin/SettingsPanels/ClusteringEditPage.Designer.cs new file mode 100644 index 000000000..50fff6f60 --- /dev/null +++ b/XenAdmin/SettingsPanels/ClusteringEditPage.Designer.cs @@ -0,0 +1,130 @@ +namespace XenAdmin.SettingsPanels +{ + partial class ClusteringEditPage + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ClusteringEditPage)); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.labelTitle = new XenAdmin.Controls.Common.AutoHeightLabel(); + this.CheckBoxEnableClustering = new System.Windows.Forms.CheckBox(); + this.labelNetwork = new System.Windows.Forms.Label(); + this.flowLayoutInfo = new System.Windows.Forms.FlowLayoutPanel(); + this.pictureBoxInfo = new System.Windows.Forms.PictureBox(); + this.labelWarning = new System.Windows.Forms.Label(); + this.comboBoxNetwork = new XenAdmin.Controls.NetworkComboBox(); + this.tableLayoutPanel1.SuspendLayout(); + this.flowLayoutInfo.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxInfo)).BeginInit(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); + this.tableLayoutPanel1.Controls.Add(this.labelTitle, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.CheckBoxEnableClustering, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.labelNetwork, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutInfo, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.comboBoxNetwork, 1, 2); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + // + // labelTitle + // + resources.ApplyResources(this.labelTitle, "labelTitle"); + this.tableLayoutPanel1.SetColumnSpan(this.labelTitle, 2); + this.labelTitle.Name = "labelTitle"; + // + // CheckBoxEnableClustering + // + resources.ApplyResources(this.CheckBoxEnableClustering, "CheckBoxEnableClustering"); + this.tableLayoutPanel1.SetColumnSpan(this.CheckBoxEnableClustering, 2); + this.CheckBoxEnableClustering.Name = "CheckBoxEnableClustering"; + this.CheckBoxEnableClustering.UseVisualStyleBackColor = true; + // + // labelNetwork + // + resources.ApplyResources(this.labelNetwork, "labelNetwork"); + this.labelNetwork.Name = "labelNetwork"; + // + // flowLayoutInfo + // + resources.ApplyResources(this.flowLayoutInfo, "flowLayoutInfo"); + this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutInfo, 2); + this.flowLayoutInfo.Controls.Add(this.pictureBoxInfo); + this.flowLayoutInfo.Controls.Add(this.labelWarning); + this.flowLayoutInfo.Name = "flowLayoutInfo"; + // + // pictureBoxInfo + // + this.pictureBoxInfo.Image = global::XenAdmin.Properties.Resources._000_Info3_h32bit_16; + resources.ApplyResources(this.pictureBoxInfo, "pictureBoxInfo"); + this.pictureBoxInfo.Name = "pictureBoxInfo"; + this.pictureBoxInfo.TabStop = false; + // + // labelWarning + // + resources.ApplyResources(this.labelWarning, "labelWarning"); + this.labelWarning.Name = "labelWarning"; + // + // comboBoxNetwork + // + this.comboBoxNetwork.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxNetwork.FormattingEnabled = true; + this.comboBoxNetwork.IncludeOnlyEnabledNetworksInComboBox = false; + this.comboBoxNetwork.IncludeOnlyNetworksWithIPAddresses = false; + this.comboBoxNetwork.IncludePoolNameInComboBox = false; + resources.ApplyResources(this.comboBoxNetwork, "comboBoxNetwork"); + this.comboBoxNetwork.Name = "comboBoxNetwork"; + // + // ClusteringEditPage + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tableLayoutPanel1); + this.Name = "ClusteringEditPage"; + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.flowLayoutInfo.ResumeLayout(false); + this.flowLayoutInfo.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxInfo)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private Controls.Common.AutoHeightLabel labelTitle; + private System.Windows.Forms.CheckBox CheckBoxEnableClustering; + private System.Windows.Forms.Label labelNetwork; + private System.Windows.Forms.PictureBox pictureBoxInfo; + private System.Windows.Forms.Label labelWarning; + private System.Windows.Forms.FlowLayoutPanel flowLayoutInfo; + private Controls.NetworkComboBox comboBoxNetwork; + + } +} diff --git a/XenAdmin/SettingsPanels/ClusteringEditPage.cs b/XenAdmin/SettingsPanels/ClusteringEditPage.cs new file mode 100644 index 000000000..f47ec662b --- /dev/null +++ b/XenAdmin/SettingsPanels/ClusteringEditPage.cs @@ -0,0 +1,165 @@ +/* Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, + * with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using XenAdmin.Actions; +using XenAdmin.Controls; +using XenAdmin.Core; +using XenAPI; + +namespace XenAdmin.SettingsPanels +{ + public partial class ClusteringEditPage : UserControl, IEditPage + { + private Pool pool; + private bool clusteringEnabled; + + public ClusteringEditPage() + { + InitializeComponent(); + Text = Messages.CLUSTERING; + } + + public string SubText + { + get { return CheckBoxEnableClustering.Checked ? Messages.ENABLED : Messages.DISABLED; } + } + + public Image Image + { + get { return Properties.Resources._000_Storage_h32bit_16; } + } + + public AsyncAction SaveSettings() + { + if (CheckBoxEnableClustering.Checked) + { + var network = ((NetworkComboBoxItem)comboBoxNetwork.SelectedItem).Network; + if (network != null) + { + return new EnableClusteringAction(pool, network); + } + } + else + { + return new DisableClusteringAction(pool); + } + return null; + } + + public void SetXenObjects(IXenObject orig, IXenObject clone) + { + pool = Helpers.GetPoolOfOne(clone.Connection); + var master = Helpers.GetMaster(clone.Connection); + flowLayoutInfo.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(); + CheckBoxEnableClustering.Checked = clusteringEnabled; + LoadNetworks(existingCluster); + + if (clusteringEnabled) + { + comboBoxNetwork.Enabled = labelNetwork.Enabled = false; + } + + var gfs2Attached = clone.Connection.Cache.SRs.Any(sr => sr.type.ToLower() == "gfs2" && !sr.IsDetached()); + + if (clusteringEnabled && gfs2Attached) + { + DisableControls(Messages.GFS2_SR_ATTACHED); + } + + if (!clusteringEnabled && pool.ha_enabled) + { + DisableControls(Messages.GFS2_HA_ENABLED); + } + } + + public bool ValidToSave { get { return true; }} + + public void ShowLocalValidationMessages() + { + + } + + public void Cleanup() + { + + } + + public bool HasChanged + { + get + { + return clusteringEnabled != CheckBoxEnableClustering.Checked; + } + } + + #region PrivateMethods + private void LoadNetworks(Cluster cluster) + { + comboBoxNetwork.IncludeOnlyEnabledNetworksInComboBox = false; + comboBoxNetwork.IncludeOnlyNetworksWithIPAddresses = true; + comboBoxNetwork.PopulateComboBox(pool.Connection); + + if (comboBoxNetwork.Items.Count == 0) + { + DisableControls(Messages.GFS2_NO_NETWORK); + } + + if (cluster != null) + { + foreach (NetworkComboBoxItem item in comboBoxNetwork.Items.Cast()) + { + if (item.Network.opaque_ref == cluster.network.opaque_ref) + { + comboBoxNetwork.SelectedItem = item; + break; + } + } + } + + } + + private void DisableControls(string message) + { + comboBoxNetwork.Enabled = labelNetwork.Enabled = CheckBoxEnableClustering.Enabled = false; + flowLayoutInfo.Visible = true; + labelWarning.Text = message; + } + + #endregion + } +} diff --git a/XenAdmin/SettingsPanels/ClusteringEditPage.ja.resx b/XenAdmin/SettingsPanels/ClusteringEditPage.ja.resx new file mode 100644 index 000000000..281fb6f1d --- /dev/null +++ b/XenAdmin/SettingsPanels/ClusteringEditPage.ja.resx @@ -0,0 +1,381 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + 2 + + + True + + + + Fill + + + NoControl + + + + 3, 0 + + + 3, 0, 3, 20 + + + 484, 39 + + + 0 + + + Clustering allows you to create and use GFS2 storage repositories. Select whether you wish to enable clustering on this pool. When enabling clustering you need to provide a network which has an IP Address configured (the management interface or a secondary interface). + + + labelTitle + + + XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + tableLayoutPanel1 + + + 0 + + + True + + + NoControl + + + 7, 62 + + + 7, 3, 3, 3 + + + 107, 17 + + + 1 + + + &Enable clustering + + + CheckBoxEnableClustering + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 1 + + + True + + + NoControl + + + 22, 87 + + + 22, 5, 3, 0 + + + 50, 13 + + + 2 + + + &Network: + + + labelNetwork + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 2 + + + True + + + NoControl + + + 3, 6 + + + 3, 6, 3, 3 + + + 16, 16 + + + AutoSize + + + 4 + + + pictureBoxInfo + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutInfo + + + 0 + + + True + + + NoControl + + + 22, 6 + + + 0, 6, 3, 0 + + + 0, 13 + + + 5 + + + labelWarning + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutInfo + + + 1 + + + 3, 119 + + + 3, 10, 3, 3 + + + 25, 25 + + + 6 + + + flowLayoutInfo + + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 3 + + + 78, 85 + + + 223, 21 + + + 3 + + + comboBoxNetwork + + + XenAdmin.Controls.NetworkComboBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + tableLayoutPanel1 + + + 4 + + + Fill + + + 0, 0 + + + 4 + + + 490, 318 + + + 0 + + + tableLayoutPanel1 + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelTitle" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="CheckBoxEnableClustering" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelNetwork" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="flowLayoutInfo" Row="3" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="comboBoxNetwork" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /></TableLayoutSettings> + + + True + + + 6, 13 + + + 490, 318 + + + ClusteringEditPage + + + System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/XenAdmin/SettingsPanels/ClusteringEditPage.resx b/XenAdmin/SettingsPanels/ClusteringEditPage.resx new file mode 100644 index 000000000..281fb6f1d --- /dev/null +++ b/XenAdmin/SettingsPanels/ClusteringEditPage.resx @@ -0,0 +1,381 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + 2 + + + True + + + + Fill + + + NoControl + + + + 3, 0 + + + 3, 0, 3, 20 + + + 484, 39 + + + 0 + + + Clustering allows you to create and use GFS2 storage repositories. Select whether you wish to enable clustering on this pool. When enabling clustering you need to provide a network which has an IP Address configured (the management interface or a secondary interface). + + + labelTitle + + + XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + tableLayoutPanel1 + + + 0 + + + True + + + NoControl + + + 7, 62 + + + 7, 3, 3, 3 + + + 107, 17 + + + 1 + + + &Enable clustering + + + CheckBoxEnableClustering + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 1 + + + True + + + NoControl + + + 22, 87 + + + 22, 5, 3, 0 + + + 50, 13 + + + 2 + + + &Network: + + + labelNetwork + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 2 + + + True + + + NoControl + + + 3, 6 + + + 3, 6, 3, 3 + + + 16, 16 + + + AutoSize + + + 4 + + + pictureBoxInfo + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutInfo + + + 0 + + + True + + + NoControl + + + 22, 6 + + + 0, 6, 3, 0 + + + 0, 13 + + + 5 + + + labelWarning + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutInfo + + + 1 + + + 3, 119 + + + 3, 10, 3, 3 + + + 25, 25 + + + 6 + + + flowLayoutInfo + + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 3 + + + 78, 85 + + + 223, 21 + + + 3 + + + comboBoxNetwork + + + XenAdmin.Controls.NetworkComboBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + tableLayoutPanel1 + + + 4 + + + Fill + + + 0, 0 + + + 4 + + + 490, 318 + + + 0 + + + tableLayoutPanel1 + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelTitle" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="CheckBoxEnableClustering" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelNetwork" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="flowLayoutInfo" Row="3" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="comboBoxNetwork" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /></TableLayoutSettings> + + + True + + + 6, 13 + + + 490, 318 + + + ClusteringEditPage + + + System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/XenAdmin/SettingsPanels/ClusteringEditPage.zh-CN.resx b/XenAdmin/SettingsPanels/ClusteringEditPage.zh-CN.resx new file mode 100644 index 000000000..281fb6f1d --- /dev/null +++ b/XenAdmin/SettingsPanels/ClusteringEditPage.zh-CN.resx @@ -0,0 +1,381 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + 2 + + + True + + + + Fill + + + NoControl + + + + 3, 0 + + + 3, 0, 3, 20 + + + 484, 39 + + + 0 + + + Clustering allows you to create and use GFS2 storage repositories. Select whether you wish to enable clustering on this pool. When enabling clustering you need to provide a network which has an IP Address configured (the management interface or a secondary interface). + + + labelTitle + + + XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + tableLayoutPanel1 + + + 0 + + + True + + + NoControl + + + 7, 62 + + + 7, 3, 3, 3 + + + 107, 17 + + + 1 + + + &Enable clustering + + + CheckBoxEnableClustering + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 1 + + + True + + + NoControl + + + 22, 87 + + + 22, 5, 3, 0 + + + 50, 13 + + + 2 + + + &Network: + + + labelNetwork + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 2 + + + True + + + NoControl + + + 3, 6 + + + 3, 6, 3, 3 + + + 16, 16 + + + AutoSize + + + 4 + + + pictureBoxInfo + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutInfo + + + 0 + + + True + + + NoControl + + + 22, 6 + + + 0, 6, 3, 0 + + + 0, 13 + + + 5 + + + labelWarning + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutInfo + + + 1 + + + 3, 119 + + + 3, 10, 3, 3 + + + 25, 25 + + + 6 + + + flowLayoutInfo + + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 3 + + + 78, 85 + + + 223, 21 + + + 3 + + + comboBoxNetwork + + + XenAdmin.Controls.NetworkComboBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + tableLayoutPanel1 + + + 4 + + + Fill + + + 0, 0 + + + 4 + + + 490, 318 + + + 0 + + + tableLayoutPanel1 + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelTitle" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="CheckBoxEnableClustering" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelNetwork" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="flowLayoutInfo" Row="3" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="comboBoxNetwork" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /></TableLayoutSettings> + + + True + + + 6, 13 + + + 490, 318 + + + ClusteringEditPage + + + System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.Designer.cs b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.Designer.cs index 83859f746..703b0618d 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.Designer.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChooseSrProvisioningPage)); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.label1 = new System.Windows.Forms.Label(); this.radioButtonGfs2 = new System.Windows.Forms.RadioButton(); @@ -36,131 +37,88 @@ this.label3 = new System.Windows.Forms.Label(); this.labelWarning = new System.Windows.Forms.Label(); this.pictureBoxInfo = new System.Windows.Forms.PictureBox(); + this.flowLayoutInfo = new System.Windows.Forms.FlowLayoutPanel(); this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxInfo)).BeginInit(); + this.flowLayoutInfo.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel1 // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.radioButtonGfs2, 0, 1); this.tableLayoutPanel1.Controls.Add(this.labelGFS2, 0, 2); this.tableLayoutPanel1.Controls.Add(this.radioButtonLvm, 0, 3); this.tableLayoutPanel1.Controls.Add(this.label3, 0, 4); - this.tableLayoutPanel1.Controls.Add(this.labelWarning, 1, 5); - this.tableLayoutPanel1.Controls.Add(this.pictureBoxInfo, 0, 5); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 10, 3, 3); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutInfo, 0, 5); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 6; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(540, 336); - this.tableLayoutPanel1.TabIndex = 0; // // label1 // - this.label1.AutoSize = true; + resources.ApplyResources(this.label1, "label1"); this.tableLayoutPanel1.SetColumnSpan(this.label1, 2); - this.label1.Font = new System.Drawing.Font("Segoe UI", 9F); - this.label1.Location = new System.Drawing.Point(3, 3); - this.label1.Margin = new System.Windows.Forms.Padding(3, 3, 3, 10); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(340, 15); - this.label1.TabIndex = 0; - this.label1.Text = "Select the provisioning method for the new Storage Repository."; // // radioButtonGfs2 // - this.radioButtonGfs2.AutoSize = true; + resources.ApplyResources(this.radioButtonGfs2, "radioButtonGfs2"); this.radioButtonGfs2.Checked = true; this.tableLayoutPanel1.SetColumnSpan(this.radioButtonGfs2, 2); - this.radioButtonGfs2.Font = new System.Drawing.Font("Segoe UI", 9F); - this.radioButtonGfs2.Location = new System.Drawing.Point(3, 34); - this.radioButtonGfs2.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3); this.radioButtonGfs2.Name = "radioButtonGfs2"; - this.radioButtonGfs2.Size = new System.Drawing.Size(155, 19); - this.radioButtonGfs2.TabIndex = 1; this.radioButtonGfs2.TabStop = true; - this.radioButtonGfs2.Text = "Thin provisioning (GFS2)"; this.radioButtonGfs2.UseVisualStyleBackColor = true; // // labelGFS2 // - this.labelGFS2.AutoSize = true; + resources.ApplyResources(this.labelGFS2, "labelGFS2"); this.tableLayoutPanel1.SetColumnSpan(this.labelGFS2, 2); - this.labelGFS2.Font = new System.Drawing.Font("Segoe UI", 9F); - this.labelGFS2.Location = new System.Drawing.Point(20, 59); - this.labelGFS2.Margin = new System.Windows.Forms.Padding(20, 3, 3, 3); this.labelGFS2.Name = "labelGFS2"; - this.labelGFS2.Size = new System.Drawing.Size(511, 15); - this.labelGFS2.TabIndex = 2; - this.labelGFS2.Text = "The SR will be formatted with the GFS2 cluster file system for hosting thinly pro" + - "visioned images."; // // radioButtonLvm // - this.radioButtonLvm.AutoSize = true; + resources.ApplyResources(this.radioButtonLvm, "radioButtonLvm"); this.tableLayoutPanel1.SetColumnSpan(this.radioButtonLvm, 2); - this.radioButtonLvm.Font = new System.Drawing.Font("Segoe UI", 9F); - this.radioButtonLvm.Location = new System.Drawing.Point(3, 83); - this.radioButtonLvm.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3); this.radioButtonLvm.Name = "radioButtonLvm"; - this.radioButtonLvm.Size = new System.Drawing.Size(147, 19); - this.radioButtonLvm.TabIndex = 3; - this.radioButtonLvm.Text = "Full provisioning (LVM)"; this.radioButtonLvm.UseVisualStyleBackColor = true; // // label3 // - this.label3.AutoSize = true; + resources.ApplyResources(this.label3, "label3"); this.tableLayoutPanel1.SetColumnSpan(this.label3, 2); - this.label3.Font = new System.Drawing.Font("Segoe UI", 9F); - this.label3.Location = new System.Drawing.Point(20, 108); - this.label3.Margin = new System.Windows.Forms.Padding(20, 3, 3, 3); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(400, 15); - this.label3.TabIndex = 4; - this.label3.Text = "This SR will be configured to host fully provisioned virtual disks using LVM."; // // labelWarning // - this.labelWarning.AutoSize = true; - this.labelWarning.Font = new System.Drawing.Font("Segoe UI", 9F); - this.labelWarning.Location = new System.Drawing.Point(25, 141); - this.labelWarning.Margin = new System.Windows.Forms.Padding(0, 15, 3, 0); + resources.ApplyResources(this.labelWarning, "labelWarning"); this.labelWarning.Name = "labelWarning"; - this.labelWarning.Size = new System.Drawing.Size(0, 15); - this.labelWarning.TabIndex = 6; // // pictureBoxInfo // this.pictureBoxInfo.Image = global::XenAdmin.Properties.Resources._000_Info3_h32bit_16; - this.pictureBoxInfo.Location = new System.Drawing.Point(3, 141); - this.pictureBoxInfo.Margin = new System.Windows.Forms.Padding(3, 15, 3, 3); + resources.ApplyResources(this.pictureBoxInfo, "pictureBoxInfo"); this.pictureBoxInfo.Name = "pictureBoxInfo"; - this.pictureBoxInfo.Size = new System.Drawing.Size(19, 20); - this.pictureBoxInfo.TabIndex = 5; this.pictureBoxInfo.TabStop = false; // + // flowLayoutInfo + // + resources.ApplyResources(this.flowLayoutInfo, "flowLayoutInfo"); + this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutInfo, 2); + this.flowLayoutInfo.Controls.Add(this.pictureBoxInfo); + this.flowLayoutInfo.Controls.Add(this.labelWarning); + this.flowLayoutInfo.Name = "flowLayoutInfo"; + // // ChooseSrProvisioningPage // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.Controls.Add(this.tableLayoutPanel1); this.Name = "ChooseSrProvisioningPage"; - this.Size = new System.Drawing.Size(540, 336); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxInfo)).EndInit(); + this.flowLayoutInfo.ResumeLayout(false); + this.flowLayoutInfo.PerformLayout(); this.ResumeLayout(false); } @@ -175,5 +133,6 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.PictureBox pictureBoxInfo; private System.Windows.Forms.Label labelWarning; + private System.Windows.Forms.FlowLayoutPanel flowLayoutInfo; } } diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.cs b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.cs index b2c4fce0e..e440e0e26 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.cs @@ -29,14 +29,7 @@ * SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; using System.Linq; -using System.Text; -using System.Windows.Forms; using XenAdmin.Controls; using XenAdmin.Core; using XenAPI; @@ -74,7 +67,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages var gfs2Allowed = !Helpers.FeatureForbidden(Connection, Host.RestrictGfs2) && Connection.Cache.Cluster_hosts.Any(cluster => cluster.host.opaque_ref == master.opaque_ref && cluster.enabled); radioButtonGfs2.Enabled = labelGFS2.Enabled = gfs2Allowed; - pictureBoxInfo.Visible = labelWarning.Visible = radioButtonLvm.Checked = !gfs2Allowed; + flowLayoutInfo.Visible = radioButtonLvm.Checked = !gfs2Allowed; labelWarning.Text = Helpers.FeatureForbidden(Connection, Host.RestrictGfs2) ? Messages.GFS2_INCORRECT_POOL_LICENSE : Messages.GFS2_REQUIRES_CLUSTERING_ENABLED; diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.resx b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.resx index 29dcb1b3a..6bf0feb22 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.resx +++ b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrProvisioningPage.resx @@ -117,4 +117,301 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 2 + + + True + + + + Segoe UI, 9pt + + + 3, 3 + + + + 3, 3, 3, 10 + + + 340, 15 + + + 0 + + + Select the provisioning method for the new Storage Repository. + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 0 + + + True + + + Segoe UI, 9pt + + + 3, 34 + + + 3, 6, 3, 3 + + + 155, 19 + + + 1 + + + Thin provisioning (GFS2) + + + radioButtonGfs2 + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 1 + + + True + + + Segoe UI, 9pt + + + 20, 59 + + + 20, 3, 3, 3 + + + 511, 15 + + + 2 + + + The SR will be formatted with the GFS2 cluster file system for hosting thinly provisioned images. + + + labelGFS2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 2 + + + True + + + Segoe UI, 9pt + + + 3, 83 + + + 3, 6, 3, 3 + + + 147, 19 + + + 3 + + + Full provisioning (LVM) + + + radioButtonLvm + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 3 + + + True + + + Segoe UI, 9pt + + + 20, 108 + + + 20, 3, 3, 3 + + + 400, 15 + + + 4 + + + This SR will be configured to host fully provisioned virtual disks using LVM. + + + label3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 4 + + + True + + + 3, 15 + + + 3, 15, 3, 3 + + + 19, 20 + + + 5 + + + pictureBoxInfo + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutInfo + + + 0 + + + True + + + Segoe UI, 9pt + + + 25, 15 + + + 0, 15, 3, 0 + + + 0, 15 + + + 6 + + + labelWarning + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutInfo + + + 1 + + + 3, 129 + + + 28, 38 + + + 7 + + + flowLayoutInfo + + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 5 + + + Fill + + + 0, 0 + + + 3, 10, 3, 3 + + + 6 + + + 540, 336 + + + 0 + + + tableLayoutPanel1 + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="radioButtonGfs2" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelGFS2" Row="2" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="radioButtonLvm" Row="3" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="label3" Row="4" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="flowLayoutInfo" Row="5" RowSpan="1" Column="0" ColumnSpan="2" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,Absolute,20" /></TableLayoutSettings> + + + True + + + 96, 96 + + + 540, 336 + + + ChooseSrProvisioningPage + + + XenAdmin.Controls.XenTabPage, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/XenAdmin/XenAdmin.csproj b/XenAdmin/XenAdmin.csproj index 9772aa7f1..c0aa9b40a 100644 --- a/XenAdmin/XenAdmin.csproj +++ b/XenAdmin/XenAdmin.csproj @@ -345,6 +345,12 @@ True Resources.resx + + UserControl + + + ClusteringEditPage.cs + UserControl @@ -1814,6 +1820,15 @@ TabPageCredentialsDialog.cs Designer + + ClusteringEditPage.cs + + + ClusteringEditPage.cs + + + ClusteringEditPage.cs + Designer HostPowerONEditPage.cs @@ -2073,9 +2088,15 @@ Designer RBACWarningPage.cs + + ChooseSrProvisioningPage.cs + ChooseSrProvisioningPage.cs + + ChooseSrProvisioningPage.cs + CIFSFrontend.cs diff --git a/XenModel/Actions/Pool/DisableClusteringAction.cs b/XenModel/Actions/Pool/DisableClusteringAction.cs new file mode 100644 index 000000000..d8ad68e82 --- /dev/null +++ b/XenModel/Actions/Pool/DisableClusteringAction.cs @@ -0,0 +1,52 @@ +/* Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, + * with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +using XenAPI; + +namespace XenAdmin.Actions +{ + public class DisableClusteringAction : AsyncAction + { + public DisableClusteringAction(Pool pool) + : base(pool.Connection, Messages.DISABLE_CLUSTERING_ON_POOL, + string.Format(Messages.DISABLING_CLUSTERING_ON_POOL, pool.Name()), true) + { + #region RBAC Dependencies + //ApiMethodsToRoleCheck.Add("pif.set_disallow_unplug"); + #endregion + } + + protected override void Run() + { + + } + } +} diff --git a/XenModel/Actions/Pool/EnableClusteringAction.cs b/XenModel/Actions/Pool/EnableClusteringAction.cs new file mode 100644 index 000000000..1bf2518ab --- /dev/null +++ b/XenModel/Actions/Pool/EnableClusteringAction.cs @@ -0,0 +1,62 @@ +/* Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, + * with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +using XenAPI; + +namespace XenAdmin.Actions +{ + public class EnableClusteringAction : AsyncAction + { + private XenAPI.Network network; + + public EnableClusteringAction(Pool pool, XenAPI.Network network) + : base(pool.Connection, Messages.ENABLE_CLUSTERING_ON_POOL, + string.Format(Messages.ENABLING_CLUSTERING_ON_POOL, pool.Name()), true) + { + this.network = network; + #region RBAC Dependencies + ApiMethodsToRoleCheck.Add("cluster.pool_create"); + ApiMethodsToRoleCheck.Add("pif.set_disallow_unplug"); + #endregion + } + + protected override void Run() + { + foreach (var pif in Connection.ResolveAll(network.PIFs)) + { + PIF.set_disallow_unplug(Session, pif.opaque_ref, true); + } + Cluster.pool_create(Session, Pool.opaque_ref, "corosync", network.opaque_ref); + Description = string.Format(Messages.ENABLED_CLUSTERING_ON_POOL, Pool.Name()); + + } + } +} diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 4e42fbdbf..281ce521a 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -7001,6 +7001,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Clustering. + /// + public static string CLUSTERING { + get { + return ResourceManager.GetString("CLUSTERING", resourceCulture); + } + } + /// /// Looks up a localized string similar to &Collapse Children. /// @@ -11060,6 +11069,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Disable clustering.. + /// + public static string DISABLE_CLUSTERING_ON_POOL { + get { + return ResourceManager.GetString("DISABLE_CLUSTERING_ON_POOL", resourceCulture); + } + } + /// /// Looks up a localized string similar to Disable HA. /// @@ -11186,6 +11204,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Disabling clustering on {0}.. + /// + public static string DISABLING_CLUSTERING_ON_POOL { + get { + return ResourceManager.GetString("DISABLING_CLUSTERING_ON_POOL", resourceCulture); + } + } + /// /// Looks up a localized string similar to Disabling HA. /// @@ -13368,6 +13395,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Enable clustering.. + /// + public static string ENABLE_CLUSTERING_ON_POOL { + get { + return ResourceManager.GetString("ENABLE_CLUSTERING_ON_POOL", resourceCulture); + } + } + /// /// Looks up a localized string similar to &Enable HA.... /// @@ -13440,6 +13476,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Enabled clustering on {0}.. + /// + public static string ENABLED_CLUSTERING_ON_POOL { + get { + return ResourceManager.GetString("ENABLED_CLUSTERING_ON_POOL", resourceCulture); + } + } + /// /// Looks up a localized string similar to Snapshot schedule '{0}' enabled.. /// @@ -13476,6 +13521,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Enabling clustering on {0}.. + /// + public static string ENABLING_CLUSTERING_ON_POOL { + get { + return ResourceManager.GetString("ENABLING_CLUSTERING_ON_POOL", resourceCulture); + } + } + /// /// Looks up a localized string similar to Enabling HA. /// @@ -15844,6 +15898,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to You must disable HA before clustering can be enabled.. + /// + public static string GFS2_HA_ENABLED { + get { + return ResourceManager.GetString("GFS2_HA_ENABLED", resourceCulture); + } + } + /// /// Looks up a localized string similar to Your pool license does not allow GFS2.. /// @@ -15853,6 +15916,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Clustering cannot be enabled because there are no suitable networks.. + /// + public static string GFS2_NO_NETWORK { + get { + return ResourceManager.GetString("GFS2_NO_NETWORK", resourceCulture); + } + } + /// /// Looks up a localized string similar to GFS2 requires clustering to be enabled on the pool.. /// @@ -15862,6 +15934,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Clustering cannot be disabled because there are GFS2 storage repositories attached to this pool.. + /// + public static string GFS2_SR_ATTACHED { + get { + return ResourceManager.GetString("GFS2_SR_ATTACHED", resourceCulture); + } + } + /// /// Looks up a localized string similar to GPU. /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 8e1e529e4..30db93a12 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -2540,6 +2540,9 @@ Do you want to assign it to the schedule '{2}' instead? To close this wizard, click Finish + + Clustering + &Collapse Children @@ -3958,6 +3961,9 @@ This will also delete its subfolders. Snapshot schedule '{0}' disabled. + + Disable clustering. + Disable HA @@ -3991,6 +3997,9 @@ This will also delete its subfolders. Disabling Active Directory Authentication on pool '{0}' + + Disabling clustering on {0}. + Disabling HA @@ -4730,9 +4739,15 @@ Would you like to eject these ISOs before continuing? Enabled + + Enabled clustering on {0}. + Snapshot schedule '{0}' enabled. + + Enable clustering. + &Enable HA... @@ -4763,6 +4778,9 @@ Would you like to eject these ISOs before continuing? Enabling Active Directory Authentication on pool '{0}' + + Enabling clustering on {0}. + Enabling HA @@ -5553,12 +5571,21 @@ Would you like to eject these ISOs before continuing? Get Password + + You must disable HA before clustering can be enabled. + Your pool license does not allow GFS2. + + Clustering cannot be enabled because there are no suitable networks. + GFS2 requires clustering to be enabled on the pool. + + Clustering cannot be disabled because there are GFS2 storage repositories attached to this pool. + GPU diff --git a/XenModel/XenModel.csproj b/XenModel/XenModel.csproj index d8e541007..a6987f13d 100644 --- a/XenModel/XenModel.csproj +++ b/XenModel/XenModel.csproj @@ -98,6 +98,8 @@ + +