From f17617b2ec276ec6bb12c4bdb8c1bd33d47a9839 Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Mon, 7 Nov 2016 13:54:03 +0000 Subject: [PATCH] CA-227601: check whether the storage repositories support database replication on a background thread and show a spinner while this is going on. Also: run this check only the first time the page is loaded; some refactoring, namely simplified the code scanning for SRs by reducing the number of things each method does; fixed column widths; removed unused property. Signed-off-by: Konstantina Chremmou --- .../DRFailoverWizardStoragePage.Designer.cs | 82 +++-- .../DRWizards/DRFailoverWizardStoragePage.cs | 226 +++++++------ .../DRFailoverWizardStoragePage.resx | 309 ++++++++++-------- .../FibreChannelProbeParsing.cs | 14 +- .../NewSRWizard_Pages/Frontends/LVMoHBA.cs | 2 +- 5 files changed, 364 insertions(+), 269 deletions(-) diff --git a/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.Designer.cs b/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.Designer.cs index fa106dc9c..83ec7a51f 100644 --- a/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.Designer.cs +++ b/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.Designer.cs @@ -34,19 +34,24 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.labelText = new System.Windows.Forms.Label(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.FindSrsButton = new System.Windows.Forms.Button(); + this.buttonSelectAll = new System.Windows.Forms.Button(); this.buttonClearAll = new System.Windows.Forms.Button(); + this.panel1 = new System.Windows.Forms.Panel(); + this.spinnerIcon1 = new XenAdmin.Controls.SpinnerIcon(); this.dataGridViewSRs = new XenAdmin.Controls.DataGridViewEx.DataGridViewEx(); this.columnTick = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.columnName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnDesc = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnType = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnMetadata = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.FindSrsButton = new System.Windows.Forms.Button(); - this.buttonSelectAll = new System.Windows.Forms.Button(); this.FindSrsOptionsMenuStrip = new XenAdmin.Controls.NonReopeningContextMenuStrip(this.components); this.iscsiToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fcToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this._worker = new System.ComponentModel.BackgroundWorker(); this.tableLayoutPanel1.SuspendLayout(); + this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.spinnerIcon1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewSRs)).BeginInit(); this.FindSrsOptionsMenuStrip.SuspendLayout(); this.SuspendLayout(); @@ -60,13 +65,28 @@ // tableLayoutPanel1 // resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); - this.tableLayoutPanel1.Controls.Add(this.buttonClearAll, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.dataGridViewSRs, 0, 2); this.tableLayoutPanel1.Controls.Add(this.FindSrsButton, 0, 1); this.tableLayoutPanel1.Controls.Add(this.labelText, 0, 0); this.tableLayoutPanel1.Controls.Add(this.buttonSelectAll, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.buttonClearAll, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; // + // FindSrsButton + // + resources.ApplyResources(this.FindSrsButton, "FindSrsButton"); + this.FindSrsButton.Image = global::XenAdmin.Properties.Resources.expanded_triangle; + this.FindSrsButton.Name = "FindSrsButton"; + this.FindSrsButton.UseVisualStyleBackColor = true; + this.FindSrsButton.Click += new System.EventHandler(this.FindSrsButton_Click); + // + // buttonSelectAll + // + resources.ApplyResources(this.buttonSelectAll, "buttonSelectAll"); + this.buttonSelectAll.Name = "buttonSelectAll"; + this.buttonSelectAll.UseVisualStyleBackColor = true; + this.buttonSelectAll.Click += new System.EventHandler(this.buttonSelectAll_Click); + // // buttonClearAll // resources.ApplyResources(this.buttonClearAll, "buttonClearAll"); @@ -74,9 +94,23 @@ this.buttonClearAll.UseVisualStyleBackColor = true; this.buttonClearAll.Click += new System.EventHandler(this.buttonClearAll_Click); // + // panel1 + // + this.panel1.Controls.Add(this.spinnerIcon1); + this.panel1.Controls.Add(this.dataGridViewSRs); + resources.ApplyResources(this.panel1, "panel1"); + this.panel1.Name = "panel1"; + this.tableLayoutPanel1.SetRowSpan(this.panel1, 2); + // + // spinnerIcon1 + // + resources.ApplyResources(this.spinnerIcon1, "spinnerIcon1"); + this.spinnerIcon1.BackColor = System.Drawing.SystemColors.Window; + this.spinnerIcon1.Name = "spinnerIcon1"; + this.spinnerIcon1.TabStop = false; + // // dataGridViewSRs // - this.dataGridViewSRs.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; this.dataGridViewSRs.BackgroundColor = System.Drawing.SystemColors.Window; this.dataGridViewSRs.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridViewSRs.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; @@ -98,60 +132,43 @@ dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; this.dataGridViewSRs.RowsDefaultCellStyle = dataGridViewCellStyle2; - this.tableLayoutPanel1.SetRowSpan(this.dataGridViewSRs, 2); - this.dataGridViewSRs.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewSRs_CellValueChanged); this.dataGridViewSRs.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewSRs_CellClick); + this.dataGridViewSRs.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewSRs_CellValueChanged); // // columnTick // + this.columnTick.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; resources.ApplyResources(this.columnTick, "columnTick"); this.columnTick.Name = "columnTick"; // // columnName // - this.columnName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; resources.ApplyResources(this.columnName, "columnName"); this.columnName.Name = "columnName"; this.columnName.ReadOnly = true; // // columnDesc // - this.columnDesc.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; resources.ApplyResources(this.columnDesc, "columnDesc"); this.columnDesc.Name = "columnDesc"; this.columnDesc.ReadOnly = true; // // columnType // - this.columnType.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; resources.ApplyResources(this.columnType, "columnType"); this.columnType.Name = "columnType"; this.columnType.ReadOnly = true; // // columnMetadata // - this.columnMetadata.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.columnMetadata.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; resources.ApplyResources(this.columnMetadata, "columnMetadata"); this.columnMetadata.Name = "columnMetadata"; this.columnMetadata.ReadOnly = true; // - // FindSrsButton - // - resources.ApplyResources(this.FindSrsButton, "FindSrsButton"); - this.FindSrsButton.Image = global::XenAdmin.Properties.Resources.expanded_triangle; - this.FindSrsButton.Name = "FindSrsButton"; - this.FindSrsButton.UseVisualStyleBackColor = true; - this.FindSrsButton.Click += new System.EventHandler(this.FindSrsButton_Click); - // - // buttonSelectAll - // - resources.ApplyResources(this.buttonSelectAll, "buttonSelectAll"); - this.buttonSelectAll.Name = "buttonSelectAll"; - this.buttonSelectAll.UseVisualStyleBackColor = true; - this.buttonSelectAll.Click += new System.EventHandler(this.buttonSelectAll_Click); - // // FindSrsOptionsMenuStrip // + this.FindSrsOptionsMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); this.FindSrsOptionsMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.iscsiToolStripMenuItem, this.fcToolStripMenuItem}); @@ -170,6 +187,14 @@ resources.ApplyResources(this.fcToolStripMenuItem, "fcToolStripMenuItem"); this.fcToolStripMenuItem.Click += new System.EventHandler(this.fcToolStripMenuItem_Click); // + // _worker + // + this._worker.WorkerReportsProgress = true; + this._worker.WorkerSupportsCancellation = true; + this._worker.DoWork += new System.ComponentModel.DoWorkEventHandler(this._worker_DoWork); + this._worker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this._worker_ProgressChanged); + this._worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this._worker_RunWorkerCompleted); + // // DRFailoverWizardStoragePage // resources.ApplyResources(this, "$this"); @@ -178,6 +203,8 @@ this.Name = "DRFailoverWizardStoragePage"; this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); + this.panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.spinnerIcon1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewSRs)).EndInit(); this.FindSrsOptionsMenuStrip.ResumeLayout(false); this.ResumeLayout(false); @@ -200,5 +227,8 @@ private System.Windows.Forms.DataGridViewTextBoxColumn columnDesc; private System.Windows.Forms.DataGridViewTextBoxColumn columnType; private System.Windows.Forms.DataGridViewTextBoxColumn columnMetadata; + private System.ComponentModel.BackgroundWorker _worker; + private System.Windows.Forms.Panel panel1; + private Controls.SpinnerIcon spinnerIcon1; } } diff --git a/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.cs b/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.cs index 46e5a97a6..118ed4073 100644 --- a/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.cs +++ b/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.cs @@ -51,6 +51,7 @@ namespace XenAdmin.Wizards.DRWizards private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public event Action NewDrTaskIntroduced; + private List _availableSRs = new List(); public DRFailoverWizardStoragePage() { @@ -87,14 +88,24 @@ namespace XenAdmin.Wizards.DRWizards public override bool EnableNext() { + if (_worker.IsBusy) + return false; + buttonClearAll.Enabled = SelectedSRsUuids.Count > 0; buttonSelectAll.Enabled = SelectedSRsUuids.Count < dataGridViewSRs.Rows.OfType().Count(); return SelectedSRsUuids.Count > 0; } + public override bool EnablePrevious() + { + return !_worker.IsBusy; + } + private readonly ConnectionLostDialogLauncher cldl = new ConnectionLostDialogLauncher(); public override void PageLeave(PageLoadedDirection direction, ref bool cancel) { + _worker.CancelAsync(); + if (direction == PageLoadedDirection.Forward) { IntroduceSRs(); @@ -108,53 +119,67 @@ namespace XenAdmin.Wizards.DRWizards base.PageLoaded(direction); if (direction == PageLoadedDirection.Forward) SetupLabels(); + } - PopulateSrList(); - - if (dataGridViewSRs.Rows.Count > 0) - SortRows(); + public override void PopulatePage() + { + dataGridViewSRs.Rows.Clear(); + SelectedSRsUuids.Clear(); + _availableSRs.Clear(); + OnPageUpdated(); + spinnerIcon1.StartSpinning(); + _worker.RunWorkerAsync(); + } + + public override void PageCancelled() + { + _worker.CancelAsync(); } #endregion #region Initial page setup - private void PopulateSrList() + + private void _worker_DoWork(object sender, DoWorkEventArgs e) { Pool currentPool = Helpers.GetPoolOfOne(Connection); if (currentPool == null) return; + var srs = new List(Connection.Cache.SRs); + for (int i = 0; i < srs.Count; i++) + { + if (_worker.CancellationPending) + { + e.Cancel = true; + return; + } + + var sr = srs[i]; + SR checkedSr = SR.SupportsDatabaseReplication(sr.Connection, sr) ? sr : null; + int percentage = (i + 1)*100/srs.Count; + _worker.ReportProgress(percentage, checkedSr); + } + } + + private void _worker_ProgressChanged(object sender, ProgressChangedEventArgs e) + { + SR sr = e.UserState as SR; + if (sr != null) + _availableSRs.Add(sr); + } + + private void _worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + spinnerIcon1.StopSpinning(); try { dataGridViewSRs.SuspendLayout(); - dataGridViewSRs.Rows.Clear(); - // add existing SRs - List srs = new List(Connection.Cache.SRs); - foreach (SR sr in srs) + foreach (SR sr in _availableSRs) { - if (!sr.SupportsDatabaseReplication()) - continue; - - bool poolMetadataDetected = false; - log.DebugFormat("Looking for foreign pool metadata VDIs on SR {0}.", sr.Name); - - List vdis = sr.Connection.ResolveAll(sr.VDIs); - - foreach (VDI vdi in vdis) - { - if (vdi.type != vdi_type.metadata) - continue; - - /*if (vdi.metadata_of_pool.opaque_ref == currentPool.opaque_ref) - { - continue; - }*/ - - // found a metadata VDI - poolMetadataDetected = true; - break; - } + var vdis = sr.Connection.ResolveAll(sr.VDIs); + bool poolMetadataDetected = vdis.Any(vdi => vdi.type == vdi_type.metadata); SrRow row; if (!FindRowByUuid(sr.uuid, out row)) @@ -179,16 +204,15 @@ namespace XenAdmin.Wizards.DRWizards } } - //set the width of the last column - columnMetadata.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; - int storedWidth = columnMetadata.Width; - columnMetadata.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - columnMetadata.MinimumWidth = storedWidth; + if (dataGridViewSRs.Rows.Count > 0) + SortRows(); } finally { dataGridViewSRs.ResumeLayout(); } + + OnPageUpdated(); } private void SetupLabels() @@ -228,88 +252,74 @@ namespace XenAdmin.Wizards.DRWizards private void ScanForSRs(SR.SRTypes type) { - bool succeeded; - List srs = new List(); + var srs = new List(); switch (type) { - case SR.SRTypes.lvmohba : - List devices = new List(); - succeeded = FiberChannelScan(devices); - if (succeeded) + case SR.SRTypes.lvmohba: + var devices = FiberChannelScan(); + if (devices != null && devices.Count > 0) { foreach (FibreChannelDevice device in devices) { string deviceId = string.IsNullOrEmpty(device.SCSIid) ? device.Path : device.SCSIid; - succeeded = succeeded && ScanDeviceForSRs(SR.SRTypes.lvmohba, deviceId, - GetFCDeviceConfig(device)); - - srs.AddRange(ScannedDevices[deviceId].SRList.Select(srInfo => srInfo.Name)); + var metadataSrs = ScanDeviceForSRs(SR.SRTypes.lvmohba, deviceId, GetFCDeviceConfig(device)); + if (metadataSrs != null && metadataSrs.Count > 0) + srs.AddRange(metadataSrs); } } - ShowScanResult(srs, succeeded); + AddScanResultsToDataGridView(srs, SR.SRTypes.lvmohba); break; - case SR.SRTypes.lvmoiscsi : - IscsiDeviceConfigDialog dialog = new IscsiDeviceConfigDialog(Connection); - if (dialog.ShowDialog(this) == DialogResult.OK) + case SR.SRTypes.lvmoiscsi: + using (var dialog = new IscsiDeviceConfigDialog(Connection)) { - Dictionary dconf = dialog.DeviceConfig; - string deviceId = string.IsNullOrEmpty(dconf[SCSIID]) ? dconf[LUNSERIAL] : dconf[SCSIID]; + if (dialog.ShowDialog(this) == DialogResult.OK) + { + Dictionary dconf = dialog.DeviceConfig; + string deviceId = string.IsNullOrEmpty(dconf[SCSIID]) ? dconf[LUNSERIAL] : dconf[SCSIID]; - succeeded = ScanDeviceForSRs(SR.SRTypes.lvmoiscsi, deviceId, dconf); - - if (succeeded) - srs.AddRange(ScannedDevices[deviceId].SRList.Select(srInfo => srInfo.Name)); - - ShowScanResult(srs, succeeded); + var metadataSrs = ScanDeviceForSRs(SR.SRTypes.lvmoiscsi, deviceId, dconf); + if (metadataSrs != null && metadataSrs.Count > 0) + srs.AddRange(metadataSrs); + } } + AddScanResultsToDataGridView(srs, SR.SRTypes.lvmoiscsi); break; } + + if (srs.Count == 0) + using (var dlg = new ThreeButtonDialog( + new ThreeButtonDialog.Details(SystemIcons.Information, + Messages.DR_WIZARD_STORAGEPAGE_SCAN_RESULT_NONE, + Messages.XENCENTER))) + { + dlg.ShowDialog(this); + } } - private void ShowScanResult(List srs, bool succeeded) - { - if (srs.Count > 0) - { - SortRows(); - } - else - { - if (succeeded) - using (var dlg = new ThreeButtonDialog( - new ThreeButtonDialog.Details(SystemIcons.Information, - Messages.DR_WIZARD_STORAGEPAGE_SCAN_RESULT_NONE, - Messages.XENCENTER))) - { - dlg.ShowDialog(this); - } - } - } - - private bool FiberChannelScan(List devices) + private List FiberChannelScan() { Host master = Helpers.GetMaster(Connection); if (master == null) - return false; + return null; FibreChannelProbeAction action = new FibreChannelProbeAction(master); using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee)) dialog.ShowDialog(this); //Will block until dialog closes, action completed if (!action.Succeeded) - return false; + return null; try { - FibreChannelProbeParsing.ProcessXML(action.Result, devices); - return true; + return FibreChannelProbeParsing.ProcessXML(action.Result); } catch (Exception e) { log.Debug("Exception parsing result of fibre channel scan", e); log.Debug(e, e); - return false; + return null; } } @@ -337,13 +347,11 @@ namespace XenAdmin.Wizards.DRWizards private const String METADATA = "metadata"; - private bool ScanDeviceForSRs(SR.SRTypes type, string deviceId, Dictionary dconf) + private List ScanDeviceForSRs(SR.SRTypes type, string deviceId, Dictionary dconf) { Host master = Helpers.GetMaster(Connection); if (master == null || dconf == null) - { - return false; - } + return null; Dictionary smconf = new Dictionary(); smconf[METADATA] = "true"; @@ -354,13 +362,11 @@ namespace XenAdmin.Wizards.DRWizards dlg.ShowDialog(this); if (!srProbeAction.Succeeded) - return false; + return null; try { - List srList = SR.ParseSRListXML(srProbeAction.Result); - - List metadataSrs = srList; //srList.Where(srInfo => srInfo.PoolMetadataDetected).ToList(); + var metadataSrs = SR.ParseSRListXML(srProbeAction.Result); if (ScannedDevices.ContainsKey(deviceId)) { @@ -373,25 +379,32 @@ namespace XenAdmin.Wizards.DRWizards ScannedDevices.Add(deviceId, new ScannedDeviceInfo(type, dconf, metadataSrs)); } - foreach (SR.SRInfo srInfo in metadataSrs) - { - SrRow row; - if (!FindRowByUuid(srInfo.UUID, out row)) - { - row = new SrRow(srInfo, type, srInfo.PoolMetadataDetected, - srInfo.PoolMetadataDetected); - dataGridViewSRs.Rows.Add(row); - ToggleRowChecked(row); - } - } - return true; + return metadataSrs; } catch { - return false; + return null; } } + private void AddScanResultsToDataGridView(List metadataSrs, SR.SRTypes type) + { + if (metadataSrs == null || metadataSrs.Count == 0) + return; + + foreach (SR.SRInfo srInfo in metadataSrs) + { + SrRow row; + if (!FindRowByUuid(srInfo.UUID, out row)) + { + row = new SrRow(srInfo, type, srInfo.PoolMetadataDetected, srInfo.PoolMetadataDetected); + dataGridViewSRs.Rows.Add(row); + ToggleRowChecked(row); + } + } + SortRows(); + } + #endregion #region Introduce SRs @@ -494,7 +507,7 @@ namespace XenAdmin.Wizards.DRWizards { foreach (VDI vdi in action.VDIs) { - var inUse = Connection.ResolveAll(vdi.VBDs).Where(vbd => vbd.currently_attached).Any(); + var inUse = Connection.ResolveAll(vdi.VBDs).Any(vbd => vbd.currently_attached); if (!inUse) LoadPoolMetadata(vdi); else @@ -574,12 +587,10 @@ namespace XenAdmin.Wizards.DRWizards { private readonly SR Sr; private readonly SR.SRInfo SrInfo; - public bool HasMetadata { get; private set; } public SrRow(SR sr, bool poolMetadataDetected, bool selected) { Sr = sr; - HasMetadata = poolMetadataDetected; var cellTick = new DataGridViewCheckBoxCell { Value = selected }; var cellName = new DataGridViewTextBoxCell { Value = sr.Name }; @@ -592,7 +603,6 @@ namespace XenAdmin.Wizards.DRWizards public SrRow(SR.SRInfo srInfo, SR.SRTypes type, bool poolMetadataDetected, bool selected) { SrInfo = srInfo; - HasMetadata = poolMetadataDetected; var cellTick = new DataGridViewCheckBoxCell { Value = selected }; var cellName = new DataGridViewTextBoxCell { Value = srInfo.Name }; diff --git a/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.resx b/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.resx index 30f15bd57..f6eba8bb1 100644 --- a/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.resx +++ b/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.resx @@ -128,124 +128,13 @@ 2 - - NoControl - - - - 479, 89 - - - 75, 23 - - - 19 - - - &Clear All - - - buttonClearAll - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tableLayoutPanel1 - - - 0 - - - True - - - - - - 5 - - - True - - - Name - - - 80 - - - 115 - - - True - - - Description - - - 80 - - - 115 - - - True - - - Type - - - 80 - - - 90 - - - True - - - VM configuration data - - - 140 - - - 140 - - - Fill - - - Segoe UI, 9pt - - - 3, 60 - - - 470, 303 - - - 6 - - - dataGridViewSRs - - - XenAdmin.Controls.DataGridViewEx.DataGridViewEx, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - - tableLayoutPanel1 - - - 1 - True GrowAndShrink + MiddleRight @@ -265,7 +154,7 @@ 150, 23 - 5 + 2 Find Storage &Repositories @@ -286,7 +175,7 @@ tableLayoutPanel1 - 2 + 0 NoControl @@ -298,7 +187,7 @@ 75, 23 - 18 + 4 &Select All @@ -313,6 +202,159 @@ tableLayoutPanel1 + 2 + + + NoControl + + + 479, 89 + + + 75, 23 + + + 5 + + + &Clear All + + + buttonClearAll + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 3 + + + None + + + 219, 140 + + + 32, 32 + + + Zoom + + + 1 + + + spinnerIcon1 + + + XenAdmin.Controls.SpinnerIcon, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + panel1 + + + 0 + + + True + + + + + + 5 + + + True + + + Name + + + 80 + + + True + + + Description + + + 80 + + + True + + + Type + + + 80 + + + True + + + VM configuration data + + + 140 + + + 151 + + + Fill + + + Segoe UI, 9pt + + + 0, 0 + + + 470, 303 + + + 0 + + + dataGridViewSRs + + + XenAdmin.Controls.DataGridViewEx.DataGridViewEx, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + panel1 + + + 1 + + + Fill + + + 3, 60 + + + 470, 303 + + + 3 + + + panel1 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + 4 @@ -328,7 +370,7 @@ 557, 366 - 66 + 0 tableLayoutPanel1 @@ -343,7 +385,7 @@ 1 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="buttonClearAll" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="dataGridViewSRs" Row="2" RowSpan="2" Column="0" ColumnSpan="1" /><Control Name="FindSrsButton" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelText" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="buttonSelectAll" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="Percent,100,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="FindSrsButton" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelText" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="buttonSelectAll" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="buttonClearAll" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="panel1" Row="2" RowSpan="2" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,Absolute,20" /></TableLayoutSettings> NoControl @@ -376,9 +418,9 @@ tableLayoutPanel1 - 3 + 1 - + 17, 11 @@ -402,12 +444,15 @@ XenAdmin.Controls.NonReopeningContextMenuStrip, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - 92 + + 208, 11 - + True + + 92 + 96, 96 @@ -418,43 +463,49 @@ columnTick - System.Windows.Forms.DataGridViewCheckBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridViewCheckBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 columnName - System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 columnDesc - System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 columnType - System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 columnMetadata - System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 iscsiToolStripMenuItem - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 fcToolStripMenuItem - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + _worker + + + System.ComponentModel.BackgroundWorker, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 DRFailoverWizardStoragePage diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/FibreChannelProbeParsing.cs b/XenAdmin/Wizards/NewSRWizard_Pages/FibreChannelProbeParsing.cs index 24b3f76b4..56ab92a1f 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/FibreChannelProbeParsing.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/FibreChannelProbeParsing.cs @@ -38,18 +38,22 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages { class FibreChannelProbeParsing { - internal static void ProcessXML(string p, List devices) + internal static List ProcessXML(string p) { XmlDocument doc = new XmlDocument(); doc.LoadXml(p); + var devices = new List(); + foreach (XmlNode device in doc.GetElementsByTagName("BlockDevice")) { - ParseDevice(device, devices); + var dev = ParseDevice(device); + devices.Add(dev); } + return devices; } - private static void ParseDevice(XmlNode device, List devices) + private static FibreChannelDevice ParseDevice(XmlNode device) { string vendor = ""; long size = 0; @@ -95,8 +99,8 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages eth = node.InnerText.Trim(); } - devices.Add(new FibreChannelDevice(serial, path, vendor, size, - scsiid, adapter, channel, id, lun, name_label, name_description, pool_metadata_detected, eth)); + return new FibreChannelDevice(serial, path, vendor, size, + scsiid, adapter, channel, id, lun, name_label, name_description, pool_metadata_detected, eth); } /// diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs index 1ff660225..ce4d61aaf 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs @@ -337,7 +337,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends try { - FibreChannelProbeParsing.ProcessXML(action.Result, devices); + devices = FibreChannelProbeParsing.ProcessXML(action.Result); if (devices.Count == 0) {