From 777765fa0d73d9a9bc6007e681c0515726c19129 Mon Sep 17 00:00:00 2001 From: "Michael J. Manley" Date: Fri, 9 Feb 2024 21:59:19 -0800 Subject: [PATCH] Added MVP of #219 I still need to make this a bit friendlier, but hey heres an MVP (Minimal Viable Product) --- XenAdmin/Wizards/NewSRWizard.cs | 12 + .../ChooseSrTypePage.Designer.cs | 19 +- .../NewSRWizard_Pages/ChooseSrTypePage.cs | 3 +- .../NewSRWizard_Pages/ChooseSrTypePage.resx | 170 ++++---- .../LocalStorageFrontend.Designer.cs | 122 ++++++ .../Frontends/LocalStorageFrontend.cs | 100 +++++ .../Frontends/LocalStorageFrontend.resx | 381 ++++++++++++++++++ .../Wizards/NewSRWizard_Pages/SrWizardType.cs | 41 ++ XenModel/Messages.Designer.cs | 45 +++ XenModel/Messages.resx | 15 + 10 files changed, 818 insertions(+), 90 deletions(-) create mode 100644 XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.Designer.cs create mode 100644 XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.cs create mode 100644 XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.resx diff --git a/XenAdmin/Wizards/NewSRWizard.cs b/XenAdmin/Wizards/NewSRWizard.cs index 19f25a092f..aef77da9fd 100644 --- a/XenAdmin/Wizards/NewSRWizard.cs +++ b/XenAdmin/Wizards/NewSRWizard.cs @@ -62,6 +62,7 @@ public partial class NewSRWizard : XenWizardBase private readonly ChooseSrTypePage xenTabPageChooseSrType; private readonly ChooseSrProvisioningPage xenTabPageChooseSrProv; private readonly RBACWarningPage xenTabPageRbacWarning; + private readonly LocalStorageFrontend xenTabPageLocalStorage; #endregion /// @@ -109,6 +110,7 @@ internal NewSRWizard(IXenConnection connection, SR srToReattach, bool disasterRe xenTabPageRbacWarning = new RBACWarningPage((srToReattach == null && !disasterRecoveryTask) ? Messages.RBAC_WARNING_PAGE_DESCRIPTION_SR_CREATE : Messages.RBAC_WARNING_PAGE_DESCRIPTION_SR_ATTACH); + xenTabPageLocalStorage = new LocalStorageFrontend(); //do not use virtual members in constructor var format = (srToReattach == null && !disasterRecoveryTask) @@ -291,6 +293,8 @@ protected override void UpdateWizardContent(XenTabPage senderPage) AddPage(xenTabPageCifs); else if (m_srWizardType is SrWizardType_NfsIso) AddPage(xenTabPageNfsIso); + else if (m_srWizardType is SrWizardType_LocalStorage) + AddPage(xenTabPageLocalStorage); xenTabPageSrName.SrWizardType = m_srWizardType; xenTabPageSrName.MatchingFrontends = xenTabPageChooseSrType.MatchingFrontends; @@ -319,6 +323,8 @@ protected override void UpdateWizardContent(XenTabPage senderPage) xenTabPageCifs.SrWizardType = m_srWizardType; else if (m_srWizardType is SrWizardType_Fcoe) xenTabPageLvmoFcoe.SrWizardType = m_srWizardType; + else if (m_srWizardType is SrWizardType_LocalStorage) + xenTabPageLocalStorage.SrWizardType = m_srWizardType; #endregion } else if (senderPagetype == typeof(ChooseSrProvisioningPage)) @@ -358,6 +364,12 @@ protected override void UpdateWizardContent(XenTabPage senderPage) m_srWizardType.DeviceConfig = xenTabPageVhdoNFS.DeviceConfig; SetCustomDescription(m_srWizardType, xenTabPageVhdoNFS.SrDescription); } + else if (senderPagetype == typeof(LocalStorageFrontend)) + { + m_srWizardType.UUID = xenTabPageLocalStorage.UUID; + m_srWizardType.DeviceConfig = xenTabPageLocalStorage.DeviceConfig; + SetCustomDescription(m_srWizardType, xenTabPageLocalStorage.SrDescription); + } } private static void SetCustomDescription(SrWizardType srwizardtype, string description) diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.Designer.cs b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.Designer.cs index e70acdae08..265649ba0a 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.Designer.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.Designer.cs @@ -46,6 +46,7 @@ private void InitializeComponent() this.labelVirtualDiskStorage = new System.Windows.Forms.Label(); this.labelFileBasedStorage = new System.Windows.Forms.Label(); this.labelBlockBasedStorage = new System.Windows.Forms.Label(); + this.radioButtonLS = new System.Windows.Forms.RadioButton(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout(); @@ -87,17 +88,18 @@ private void InitializeComponent() // tableLayoutPanel3 // resources.ApplyResources(this.tableLayoutPanel3, "tableLayoutPanel3"); - this.tableLayoutPanel3.Controls.Add(this.labelISOlibrary, 0, 8); - this.tableLayoutPanel3.Controls.Add(this.radioButtonCifsIso, 1, 9); - this.tableLayoutPanel3.Controls.Add(this.radioButtonNfsIso, 1, 10); + this.tableLayoutPanel3.Controls.Add(this.labelISOlibrary, 0, 9); + this.tableLayoutPanel3.Controls.Add(this.radioButtonCifsIso, 1, 10); + this.tableLayoutPanel3.Controls.Add(this.radioButtonNfsIso, 1, 11); this.tableLayoutPanel3.Controls.Add(this.radioButtonIscsi, 1, 2); this.tableLayoutPanel3.Controls.Add(this.radioButtonFibreChannel, 1, 3); this.tableLayoutPanel3.Controls.Add(this.radioButtonFcoe, 1, 4); this.tableLayoutPanel3.Controls.Add(this.radioButtonNfs, 1, 6); - this.tableLayoutPanel3.Controls.Add(this.radioButtonCifs, 1, 7); this.tableLayoutPanel3.Controls.Add(this.labelVirtualDiskStorage, 0, 0); this.tableLayoutPanel3.Controls.Add(this.labelFileBasedStorage, 1, 5); this.tableLayoutPanel3.Controls.Add(this.labelBlockBasedStorage, 1, 1); + this.tableLayoutPanel3.Controls.Add(this.radioButtonLS, 1, 8); + this.tableLayoutPanel3.Controls.Add(this.radioButtonCifs, 1, 7); this.tableLayoutPanel3.Name = "tableLayoutPanel3"; // // labelISOlibrary @@ -189,6 +191,14 @@ private void InitializeComponent() this.labelBlockBasedStorage.ForeColor = System.Drawing.SystemColors.WindowText; this.labelBlockBasedStorage.Name = "labelBlockBasedStorage"; // + // radioButtonLS + // + resources.ApplyResources(this.radioButtonLS, "radioButtonLS"); + this.radioButtonLS.Name = "radioButtonLS"; + this.radioButtonLS.TabStop = true; + this.radioButtonLS.UseVisualStyleBackColor = true; + this.radioButtonLS.CheckedChanged += new System.EventHandler(this.RadioButton_CheckedChanged); + // // ChooseSrTypePage // resources.ApplyResources(this, "$this"); @@ -223,5 +233,6 @@ private void InitializeComponent() private System.Windows.Forms.Label labelFileBasedStorage; private System.Windows.Forms.Label labelISOlibrary; private System.Windows.Forms.Label labelVirtualDiskStorage; + private System.Windows.Forms.RadioButton radioButtonLS; } } diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.cs b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.cs index bf40e978bb..729641741d 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.cs @@ -57,11 +57,12 @@ public ChooseSrTypePage() radioButtonCifsIso.Tag = new SrWizardType_CifsIso(); radioButtonCifs.Tag = new SrWizardType_Cifs(); radioButtonFcoe.Tag = new SrWizardType_Fcoe(); + radioButtonLS.Tag = new SrWizardType_LocalStorage(); _radioButtons = new[] { radioButtonNfs, radioButtonIscsi, radioButtonFibreChannel, - radioButtonCifs, radioButtonFcoe, + radioButtonCifs, radioButtonFcoe, radioButtonLS, radioButtonNfsIso, radioButtonCifsIso }; } diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.resx b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.resx index 6e8263d30d..2313446333 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.resx +++ b/XenAdmin/Wizards/NewSRWizard_Pages/ChooseSrTypePage.resx @@ -124,55 +124,25 @@ 1 - - True - - - - GrowAndShrink - - - - Segoe UI, 9pt - - - 3, 38 - - - 91, 67 - - - 1 - - - upsellPage1 - - - XenAdmin.Controls.UpsellPage, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - - tableLayoutPanel2 - - - 0 - True + Fill NoControl + - 3, 154 + 3, 81 3, 3, 3, 0 - 292, 176 + 292, 249 3 @@ -184,13 +154,13 @@ SRBlurb - XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.Common.AutoHeightLabel, XCP-ng Center, Version=0.0.0.24040, Culture=neutral, PublicKeyToken=null tableLayoutPanel2 - 1 + 0 True @@ -223,13 +193,13 @@ deprecationBanner - XenAdmin.Controls.DeprecationBanner, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.DeprecationBanner, XCP-ng Center, Version=0.0.0.24040, Culture=neutral, PublicKeyToken=null tableLayoutPanel2 - 2 + 1 True @@ -241,7 +211,7 @@ NoControl - 3, 124 + 3, 51 3, 16, 3, 14 @@ -265,7 +235,7 @@ tableLayoutPanel2 - 3 + 2 Fill @@ -295,7 +265,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="upsellPage1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="SRBlurb" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="deprecationBanner" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="selectedStoreTypeLabel" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="SRBlurb" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="deprecationBanner" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="selectedStoreTypeLabel" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /></TableLayoutSettings> 2 @@ -310,7 +280,7 @@ NoControl - 3, 232 + 3, 255 3, 16, 3, 10 @@ -346,7 +316,7 @@ NoControl - 26, 260 + 26, 283 15, 3, 3, 3 @@ -382,7 +352,7 @@ NoControl - 26, 285 + 26, 308 15, 3, 3, 3 @@ -552,42 +522,6 @@ 6 - - True - - - Segoe UI, 9pt - - - NoControl - - - 26, 194 - - - 15, 3, 3, 3 - - - 49, 19 - - - 7 - - - S&MB - - - radioButtonCifs - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tableLayoutPanel3 - - - 7 - True @@ -622,7 +556,7 @@ tableLayoutPanel3 - 8 + 7 True @@ -661,7 +595,7 @@ tableLayoutPanel3 - 9 + 8 True @@ -700,13 +634,79 @@ tableLayoutPanel3 + 9 + + + True + + + 26, 219 + + + 15, 3, 3, 3 + + + 91, 17 + + + 11 + + + &Local Storage + + + radioButtonLS + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel3 + + 10 + + True + + + Segoe UI, 9pt + + + NoControl + + + 26, 194 + + + 15, 3, 3, 3 + + + 49, 19 + + + 7 + + + S&MB + + + radioButtonCifs + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel3 + + + 11 + 3, 3 - 11 + 12 230, 330 @@ -727,7 +727,7 @@ 1 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelISOlibrary" Row="8" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="radioButtonCifsIso" Row="9" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonNfsIso" Row="10" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonIscsi" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonFibreChannel" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonFcoe" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonNfs" Row="6" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonCifs" Row="7" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="labelVirtualDiskStorage" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelFileBasedStorage" Row="5" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="labelBlockBasedStorage" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="Percent,5,Percent,95" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Absolute,20" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelISOlibrary" Row="9" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="radioButtonCifsIso" Row="10" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonNfsIso" Row="11" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonIscsi" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonFibreChannel" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonFcoe" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonNfs" Row="6" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="labelVirtualDiskStorage" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelFileBasedStorage" Row="5" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="labelBlockBasedStorage" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonLS" Row="8" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonCifs" Row="7" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="Percent,5,Percent,95" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0" /></TableLayoutSettings> Fill @@ -772,6 +772,6 @@ ChooseSrTypePage - XenAdmin.Controls.XenTabPage, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.XenTabPage, XCP-ng Center, Version=0.0.0.24040, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.Designer.cs b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.Designer.cs new file mode 100644 index 0000000000..3e4025bb8d --- /dev/null +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.Designer.cs @@ -0,0 +1,122 @@ +namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends +{ + partial class LocalStorageFrontend + { + /// + /// 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(LocalStorageFrontend)); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.radioButtonExt = new System.Windows.Forms.RadioButton(); + this.textBoxDevicePath = new System.Windows.Forms.TextBox(); + this.radioButtonXFS = new System.Windows.Forms.RadioButton(); + this.radioButtonLVM = new System.Windows.Forms.RadioButton(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); + this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.radioButtonExt, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.radioButtonLVM, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.textBoxDevicePath, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.radioButtonXFS, 1, 5); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + // + // label1 + // + resources.ApplyResources(this.label1, "label1"); + this.tableLayoutPanel1.SetColumnSpan(this.label1, 2); + this.label1.Name = "label1"; + // + // label2 + // + resources.ApplyResources(this.label2, "label2"); + this.label2.Name = "label2"; + // + // label3 + // + resources.ApplyResources(this.label3, "label3"); + this.label3.Name = "label3"; + // + // radioButtonExt + // + resources.ApplyResources(this.radioButtonExt, "radioButtonExt"); + this.radioButtonExt.Checked = true; + this.radioButtonExt.Name = "radioButtonExt"; + this.radioButtonExt.TabStop = true; + this.radioButtonExt.UseVisualStyleBackColor = true; + this.radioButtonExt.CheckedChanged += new System.EventHandler(this.radioButtonExt4_CheckedChanged); + // + // textBoxDevicePath + // + resources.ApplyResources(this.textBoxDevicePath, "textBoxDevicePath"); + this.textBoxDevicePath.Name = "textBoxDevicePath"; + // + // radioButtonXFS + // + resources.ApplyResources(this.radioButtonXFS, "radioButtonXFS"); + this.radioButtonXFS.Name = "radioButtonXFS"; + this.radioButtonXFS.UseVisualStyleBackColor = true; + this.radioButtonXFS.CheckedChanged += new System.EventHandler(this.radioButtonExt4_CheckedChanged); + // + // radioButtonLVM + // + resources.ApplyResources(this.radioButtonLVM, "radioButtonLVM"); + this.radioButtonLVM.Name = "radioButtonLVM"; + this.radioButtonLVM.UseVisualStyleBackColor = true; + this.radioButtonLVM.CheckedChanged += new System.EventHandler(this.radioButtonExt4_CheckedChanged); + // + // LocalStorageFrontend + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tableLayoutPanel1); + this.Name = "LocalStorageFrontend"; + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.RadioButton radioButtonExt; + private System.Windows.Forms.TextBox textBoxDevicePath; + private System.Windows.Forms.RadioButton radioButtonXFS; + private System.Windows.Forms.RadioButton radioButtonLVM; + } +} diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.cs b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.cs new file mode 100644 index 0000000000..2dcfad6255 --- /dev/null +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.cs @@ -0,0 +1,100 @@ +/* Copyright (c) XCP-ng Project. + * + * 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; +using System.Collections.Generic; +using System.Windows.Forms; +using XenAdmin.Controls; + +namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends +{ + public partial class LocalStorageFrontend : XenTabPage + { + public LocalStorageFrontend() + { + InitializeComponent(); + } + + public override string Text { get { return Messages.NEWSR_LOCATION; } } + + public override string PageTitle { get { return Messages.NEWSR_LOCALSTORAGE_DEVINFO; } } + + public string UUID + { + get + { + return null; + } + } + + public Dictionary DeviceConfig + { + get + { + var dconf = new Dictionary(); + dconf["device"] = textBoxDevicePath.Text; + return dconf; + } + } + + public SrWizardType SrWizardType { private get; set; } + + public string SrDescription + { + get + { + return string.IsNullOrEmpty(textBoxDevicePath.Text) + ? null + : string.Format(Messages.NEWSR_LOCALSTORE_ACTION, textBoxDevicePath.Text); + } + } + + private void radioButtonExt4_CheckedChanged(object sender, EventArgs e) + { + switch (((RadioButton)sender).Text) + { + case "ext": + ((SrWizardType_LocalStorage)SrWizardType).SrType = "ext"; + break; + case "LVM": + ((SrWizardType_LocalStorage)SrWizardType).SrType = "lvm"; + break; + case "xfs": + ((SrWizardType_LocalStorage)SrWizardType).SrType = "xfs"; + break; + } + } + + public override void SelectDefaultControl() + { + textBoxDevicePath.Select(); + } + } +} diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.resx b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.resx new file mode 100644 index 0000000000..71f0e2a13a --- /dev/null +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LocalStorageFrontend.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 + + + + 5, 5 + + + + 5, 5, 5, 5 + + + 385, 13 + + + 0 + + + Provide the path to a device (ex: /dev/sda1) and the type of filesystem to create + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 0 + + + True + + + 5, 28 + + + 5, 5, 5, 5 + + + 69, 13 + + + 1 + + + Device Path: + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 1 + + + True + + + 5, 54 + + + 5, 5, 5, 5 + + + 85, 13 + + + 2 + + + Filesystem Type: + + + label3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 2 + + + True + + + 100, 54 + + + 5, 5, 5, 5 + + + 39, 17 + + + 2 + + + ext + + + radioButtonExt + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 3 + + + True + + + NoControl + + + 100, 81 + + + 5, 5, 5, 5 + + + 47, 17 + + + 3 + + + LVM + + + radioButtonLVM + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 4 + + + Left, Right + + + 98, 26 + + + 558, 20 + + + 1 + + + textBoxDevicePath + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 5 + + + True + + + NoControl + + + 100, 108 + + + 5, 5, 5, 5 + + + 38, 17 + + + 4 + + + xfs + + + radioButtonXFS + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 6 + + + Fill + + + 0, 0 + + + 7 + + + 659, 465 + + + 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="label2" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="label3" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="radioButtonExt" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonLVM" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="textBoxDevicePath" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="radioButtonXFS" Row="5" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0" /></TableLayoutSettings> + + + True + + + 6, 13 + + + 659, 465 + + + LocalStorageFrontend + + + XenAdmin.Controls.XenTabPage, XCP-ng Center, Version=0.0.0.24040, Culture=neutral, PublicKeyToken=null + + \ No newline at end of file diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/SrWizardType.cs b/XenAdmin/Wizards/NewSRWizard_Pages/SrWizardType.cs index e1bf5650a6..4f8daf948a 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/SrWizardType.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/SrWizardType.cs @@ -333,6 +333,47 @@ public override void ResetSrName(IXenConnection connection) } } + public class SrWizardType_LocalStorage : SrWizardType + { + public override IEnumerable Errors + { + get { return new[] { Failure.SR_BACKEND_FAILURE_72, Failure.SR_BACKEND_FAILURE_73, Failure.SR_BACKEND_FAILURE_140 }; } + } + + public override bool IsEnhancedSR { get { return false; } } + public override string FrontendBlurb { get { return Messages.NEWSR_LOCALSTORAGE_BLURB; } } + public override string FrontendTypeName { get { return Messages.NEWSR_LOCALSTORAGE_TYPE_NAME; } } + + public override SR.SRTypes Type + { + get + { + switch (SrType) + { + case "ext": + return SR.SRTypes.ext; + case "xfs": + return SR.SRTypes.xfs; + case "lvm": + return SR.SRTypes.lvm; + default: + return SR.SRTypes.dummy; // this should never happen + } + } + } + + public override string ContentType { get { return ""; } } + public override bool ShowIntroducePrompt { get { return true; } } + public override bool ShowReattachWarning { get { return true; } } + public override bool AllowToCreateNewSr { get; set; } + public string SrType { get; internal set; } = "ext"; + + public override void ResetSrName(IXenConnection connection) + { + SrName = SrWizardHelpers.DefaultSRName(Messages.SRWIZARD_LOCALSTORAGE, connection); + } + } + public class SrWizardType_NfsIso : SrWizardType { public override IEnumerable Errors diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 58ed103541..a839b28071 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -27093,6 +27093,42 @@ public static string NEWSR_ISO_DESCRIPTION { } } + /// + /// Looks up a localized string similar to TODO: Local Storage Blurb. + /// + public static string NEWSR_LOCALSTORAGE_BLURB { + get { + return ResourceManager.GetString("NEWSR_LOCALSTORAGE_BLURB", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Enter your Local Storage Device information. + /// + public static string NEWSR_LOCALSTORAGE_DEVINFO { + get { + return ResourceManager.GetString("NEWSR_LOCALSTORAGE_DEVINFO", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Local Storage. + /// + public static string NEWSR_LOCALSTORAGE_TYPE_NAME { + get { + return ResourceManager.GetString("NEWSR_LOCALSTORAGE_TYPE_NAME", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Local Store Device: {0}. + /// + public static string NEWSR_LOCALSTORE_ACTION { + get { + return ResourceManager.GetString("NEWSR_LOCALSTORE_ACTION", resourceCulture); + } + } + /// /// Looks up a localized string similar to Location. /// @@ -36215,6 +36251,15 @@ public static string SRWIZARD_ISCSI_STORAGE { } } + /// + /// Looks up a localized string similar to Local virtual disk storage. + /// + public static string SRWIZARD_LOCALSTORAGE { + get { + return ResourceManager.GetString("SRWIZARD_LOCALSTORAGE", resourceCulture); + } + } + /// /// Looks up a localized string similar to NFS ISO library. /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index ef4578a2f5..f4a97cc638 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -15239,4 +15239,19 @@ Do you want to synchronize immediately? Rev: {0} BuildLab: {1}-{2}-{3} + + TODO: Local Storage Blurb + + + Local Storage + + + Local virtual disk storage + + + Local Store Device: {0} + + + Enter your Local Storage Device information + \ No newline at end of file