CA-188553: [PAR-80] Creating a VLAN with MTU 9000 should be disabled if the base interface's MTU is < 9000

Fixed how we set the Maximum for the dropdown controls on:
* Creating External network,
* Creating Bonds
pages on the New Network Wizard

Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
Gabor Apati-Nagy 2015-12-01 14:46:58 +00:00
parent bf1bbd8475
commit 49c17f9afb
2 changed files with 27 additions and 5 deletions

View File

@ -38,7 +38,7 @@ using XenAPI;
using XenAdmin.Network;
using XenAdmin.Dialogs;
using XenAdmin.Core;
using System.Linq;
namespace XenAdmin.Controls
{
@ -103,6 +103,14 @@ namespace XenAdmin.Controls
}
}
internal List<PIF> AllPIFs
{
get
{
return dataGridView1.Rows.OfType<DataGridViewRow>().Select(r => r.Tag as PIF).Where(t => t != null).ToList();
}
}
internal bond_mode BondMode
{
get
@ -143,10 +151,6 @@ namespace XenAdmin.Controls
regStyle = dataGridView1.DefaultCellStyle.Clone();
dimmedStyle = dataGridView1.DefaultCellStyle.Clone();
dimmedStyle.ForeColor = SystemColors.GrayText;
numericUpDownMTU.Maximum = XenAPI.Network.MTU_MAX;
numericUpDownMTU.Minimum = XenAPI.Network.MTU_MIN;
numericUpDownMTU.Value = XenAPI.Network.MTU_DEFAULT;
}
internal void SetHost(Host host)
@ -154,6 +158,7 @@ namespace XenAdmin.Controls
Connection = host.Connection;
bondSizeLimit = Helpers.BondSizeLimit(Connection);
PopulateDataGridView(NetworkingHelper.GetAllPhysicalPIFs(host));
ConfigureMTUDropDown();
ShowHideControls();
}
@ -162,6 +167,7 @@ namespace XenAdmin.Controls
Connection = pool.Connection;
bondSizeLimit = Helpers.BondSizeLimit(Connection);
PopulateDataGridView(NetworkingHelper.GetAllPhysicalPIFs(pool));
ConfigureMTUDropDown();
ShowHideControls();
}
@ -335,9 +341,23 @@ namespace XenAdmin.Controls
m_numberOfCheckedNics--;
UpdateCellsReadOnlyState();
UpdateMTUDropDown();
SetValid();
}
private void UpdateMTUDropDown()
{
numericUpDownMTU.Maximum = Math.Min(BondedPIFs.Select(p => p.MTU).DefaultIfEmpty(XenAPI.Network.MTU_MAX).Min(), XenAPI.Network.MTU_MAX);
}
private void ConfigureMTUDropDown()
{
numericUpDownMTU.Maximum = Math.Min(AllPIFs.Select(p => p.MTU).DefaultIfEmpty(XenAPI.Network.MTU_MAX).Max(), XenAPI.Network.MTU_MAX);
numericUpDownMTU.Minimum = XenAPI.Network.MTU_MIN;
numericUpDownMTU.Value = XenAPI.Network.MTU_DEFAULT;
}
private void BondMode_CheckedChanged(object sender, EventArgs e)
{
ShowHideLacpWarning();

View File

@ -194,6 +194,8 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages
if (SelectedHostNic == null)
return;
numericUpDownMTU.Maximum = Math.Min(SelectedHostNic.MTU, XenAPI.Network.MTU_MAX);
vlans = GetVLANList(SelectedHostNic);