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 <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2016-11-07 13:54:03 +00:00
parent afbd7d8706
commit f17617b2ec
5 changed files with 364 additions and 269 deletions

View File

@ -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;
}
}

View File

@ -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<string> NewDrTaskIntroduced;
private List<SR> _availableSRs = new List<SR>();
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<SrRow>().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<SR>(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<SR> srs = new List<SR>(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<VDI> 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<string> srs = new List<string>();
var srs = new List<SR.SRInfo>();
switch (type)
{
case SR.SRTypes.lvmohba :
List<FibreChannelDevice> devices = new List<FibreChannelDevice>();
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<String, String> dconf = dialog.DeviceConfig;
string deviceId = string.IsNullOrEmpty(dconf[SCSIID]) ? dconf[LUNSERIAL] : dconf[SCSIID];
if (dialog.ShowDialog(this) == DialogResult.OK)
{
Dictionary<String, String> 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<string> 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<FibreChannelDevice> devices)
private List<FibreChannelDevice> 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<string, string> dconf)
private List<SR.SRInfo> ScanDeviceForSRs(SR.SRTypes type, string deviceId, Dictionary<string, string> dconf)
{
Host master = Helpers.GetMaster(Connection);
if (master == null || dconf == null)
{
return false;
}
return null;
Dictionary<string, string> smconf = new Dictionary<string, string>();
smconf[METADATA] = "true";
@ -354,13 +362,11 @@ namespace XenAdmin.Wizards.DRWizards
dlg.ShowDialog(this);
if (!srProbeAction.Succeeded)
return false;
return null;
try
{
List<SR.SRInfo> srList = SR.ParseSRListXML(srProbeAction.Result);
List<SR.SRInfo> 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<SR.SRInfo> 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 };

View File

@ -128,124 +128,13 @@
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="buttonClearAll.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="buttonClearAll.Location" type="System.Drawing.Point, System.Drawing">
<value>479, 89</value>
</data>
<data name="buttonClearAll.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="buttonClearAll.TabIndex" type="System.Int32, mscorlib">
<value>19</value>
</data>
<data name="buttonClearAll.Text" xml:space="preserve">
<value>&amp;Clear All</value>
</data>
<data name="&gt;&gt;buttonClearAll.Name" xml:space="preserve">
<value>buttonClearAll</value>
</data>
<data name="&gt;&gt;buttonClearAll.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;buttonClearAll.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;buttonClearAll.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="columnTick.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="columnTick.HeaderText" xml:space="preserve">
<value />
</data>
<data name="columnTick.Width" type="System.Int32, mscorlib">
<value>5</value>
</data>
<metadata name="columnName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="columnName.HeaderText" xml:space="preserve">
<value>Name</value>
</data>
<data name="columnName.MinimumWidth" type="System.Int32, mscorlib">
<value>80</value>
</data>
<data name="columnName.Width" type="System.Int32, mscorlib">
<value>115</value>
</data>
<metadata name="columnDesc.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="columnDesc.HeaderText" xml:space="preserve">
<value>Description</value>
</data>
<data name="columnDesc.MinimumWidth" type="System.Int32, mscorlib">
<value>80</value>
</data>
<data name="columnDesc.Width" type="System.Int32, mscorlib">
<value>115</value>
</data>
<metadata name="columnType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="columnType.HeaderText" xml:space="preserve">
<value>Type</value>
</data>
<data name="columnType.MinimumWidth" type="System.Int32, mscorlib">
<value>80</value>
</data>
<data name="columnType.Width" type="System.Int32, mscorlib">
<value>90</value>
</data>
<metadata name="columnMetadata.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="columnMetadata.HeaderText" xml:space="preserve">
<value>VM configuration data</value>
</data>
<data name="columnMetadata.MinimumWidth" type="System.Int32, mscorlib">
<value>140</value>
</data>
<data name="columnMetadata.Width" type="System.Int32, mscorlib">
<value>140</value>
</data>
<data name="dataGridViewSRs.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="dataGridViewSRs.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="dataGridViewSRs.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 60</value>
</data>
<data name="dataGridViewSRs.Size" type="System.Drawing.Size, System.Drawing">
<value>470, 303</value>
</data>
<data name="dataGridViewSRs.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="&gt;&gt;dataGridViewSRs.Name" xml:space="preserve">
<value>dataGridViewSRs</value>
</data>
<data name="&gt;&gt;dataGridViewSRs.Type" xml:space="preserve">
<value>XenAdmin.Controls.DataGridViewEx.DataGridViewEx, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;dataGridViewSRs.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;dataGridViewSRs.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="FindSrsButton.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="FindSrsButton.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="FindSrsButton.ImageAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleRight</value>
</data>
@ -265,7 +154,7 @@
<value>150, 23</value>
</data>
<data name="FindSrsButton.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
<value>2</value>
</data>
<data name="FindSrsButton.Text" xml:space="preserve">
<value>Find Storage &amp;Repositories</value>
@ -286,7 +175,7 @@
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;FindSrsButton.ZOrder" xml:space="preserve">
<value>2</value>
<value>0</value>
</data>
<data name="buttonSelectAll.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@ -298,7 +187,7 @@
<value>75, 23</value>
</data>
<data name="buttonSelectAll.TabIndex" type="System.Int32, mscorlib">
<value>18</value>
<value>4</value>
</data>
<data name="buttonSelectAll.Text" xml:space="preserve">
<value>&amp;Select All</value>
@ -313,6 +202,159 @@
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;buttonSelectAll.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="buttonClearAll.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="buttonClearAll.Location" type="System.Drawing.Point, System.Drawing">
<value>479, 89</value>
</data>
<data name="buttonClearAll.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="buttonClearAll.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="buttonClearAll.Text" xml:space="preserve">
<value>&amp;Clear All</value>
</data>
<data name="&gt;&gt;buttonClearAll.Name" xml:space="preserve">
<value>buttonClearAll</value>
</data>
<data name="&gt;&gt;buttonClearAll.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;buttonClearAll.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;buttonClearAll.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="spinnerIcon1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>None</value>
</data>
<data name="spinnerIcon1.Location" type="System.Drawing.Point, System.Drawing">
<value>219, 140</value>
</data>
<data name="spinnerIcon1.Size" type="System.Drawing.Size, System.Drawing">
<value>32, 32</value>
</data>
<data name="spinnerIcon1.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
</data>
<data name="spinnerIcon1.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="&gt;&gt;spinnerIcon1.Name" xml:space="preserve">
<value>spinnerIcon1</value>
</data>
<data name="&gt;&gt;spinnerIcon1.Type" xml:space="preserve">
<value>XenAdmin.Controls.SpinnerIcon, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;spinnerIcon1.Parent" xml:space="preserve">
<value>panel1</value>
</data>
<data name="&gt;&gt;spinnerIcon1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="columnTick.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="columnTick.HeaderText" xml:space="preserve">
<value />
</data>
<data name="columnTick.Width" type="System.Int32, mscorlib">
<value>5</value>
</data>
<metadata name="columnName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="columnName.HeaderText" xml:space="preserve">
<value>Name</value>
</data>
<data name="columnName.MinimumWidth" type="System.Int32, mscorlib">
<value>80</value>
</data>
<metadata name="columnDesc.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="columnDesc.HeaderText" xml:space="preserve">
<value>Description</value>
</data>
<data name="columnDesc.MinimumWidth" type="System.Int32, mscorlib">
<value>80</value>
</data>
<metadata name="columnType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="columnType.HeaderText" xml:space="preserve">
<value>Type</value>
</data>
<data name="columnType.MinimumWidth" type="System.Int32, mscorlib">
<value>80</value>
</data>
<metadata name="columnMetadata.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="columnMetadata.HeaderText" xml:space="preserve">
<value>VM configuration data</value>
</data>
<data name="columnMetadata.MinimumWidth" type="System.Int32, mscorlib">
<value>140</value>
</data>
<data name="columnMetadata.Width" type="System.Int32, mscorlib">
<value>151</value>
</data>
<data name="dataGridViewSRs.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="dataGridViewSRs.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="dataGridViewSRs.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="dataGridViewSRs.Size" type="System.Drawing.Size, System.Drawing">
<value>470, 303</value>
</data>
<data name="dataGridViewSRs.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;dataGridViewSRs.Name" xml:space="preserve">
<value>dataGridViewSRs</value>
</data>
<data name="&gt;&gt;dataGridViewSRs.Type" xml:space="preserve">
<value>XenAdmin.Controls.DataGridViewEx.DataGridViewEx, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;dataGridViewSRs.Parent" xml:space="preserve">
<value>panel1</value>
</data>
<data name="&gt;&gt;dataGridViewSRs.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="panel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="panel1.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 60</value>
</data>
<data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
<value>470, 303</value>
</data>
<data name="panel1.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="&gt;&gt;panel1.Name" xml:space="preserve">
<value>panel1</value>
</data>
<data name="&gt;&gt;panel1.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panel1.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;panel1.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
@ -328,7 +370,7 @@
<value>557, 366</value>
</data>
<data name="tableLayoutPanel1.TabIndex" type="System.Int32, mscorlib">
<value>66</value>
<value>0</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Name" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -343,7 +385,7 @@
<value>1</value>
</data>
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="buttonClearAll" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="dataGridViewSRs" Row="2" RowSpan="2" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="FindSrsButton" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="labelText" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="buttonSelectAll" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,100,AutoSize,0" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /&gt;&lt;/TableLayoutSettings&gt;</value>
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="FindSrsButton" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="labelText" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="buttonSelectAll" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="buttonClearAll" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="panel1" Row="2" RowSpan="2" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,100,AutoSize,0" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,Absolute,20" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="labelText.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@ -376,9 +418,9 @@
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;labelText.ZOrder" xml:space="preserve">
<value>3</value>
<value>1</value>
</data>
<metadata name="FindSrsOptionsMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="FindSrsOptionsMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 11</value>
</metadata>
<data name="iscsiToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
@ -402,12 +444,15 @@
<data name="&gt;&gt;FindSrsOptionsMenuStrip.Type" xml:space="preserve">
<value>XenAdmin.Controls.NonReopeningContextMenuStrip, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>92</value>
<metadata name="_worker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>208, 11</value>
</metadata>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>92</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>96, 96</value>
</data>
@ -418,43 +463,49 @@
<value>columnTick</value>
</data>
<data name="&gt;&gt;columnTick.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewCheckBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewCheckBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;columnName.Name" xml:space="preserve">
<value>columnName</value>
</data>
<data name="&gt;&gt;columnName.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;columnDesc.Name" xml:space="preserve">
<value>columnDesc</value>
</data>
<data name="&gt;&gt;columnDesc.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;columnType.Name" xml:space="preserve">
<value>columnType</value>
</data>
<data name="&gt;&gt;columnType.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;columnMetadata.Name" xml:space="preserve">
<value>columnMetadata</value>
</data>
<data name="&gt;&gt;columnMetadata.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;iscsiToolStripMenuItem.Name" xml:space="preserve">
<value>iscsiToolStripMenuItem</value>
</data>
<data name="&gt;&gt;iscsiToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;fcToolStripMenuItem.Name" xml:space="preserve">
<value>fcToolStripMenuItem</value>
</data>
<data name="&gt;&gt;fcToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;_worker.Name" xml:space="preserve">
<value>_worker</value>
</data>
<data name="&gt;&gt;_worker.Type" xml:space="preserve">
<value>System.ComponentModel.BackgroundWorker, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>DRFailoverWizardStoragePage</value>

View File

@ -38,18 +38,22 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
{
class FibreChannelProbeParsing
{
internal static void ProcessXML(string p, List<FibreChannelDevice> devices)
internal static List<FibreChannelDevice> ProcessXML(string p)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(p);
var devices = new List<FibreChannelDevice>();
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<FibreChannelDevice> 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);
}
/// <summary>

View File

@ -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)
{