mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 14:27:26 +01:00
Merge pull request #910 from MihaelaStoica/CA-204212
CA-204212: XenCenter doesn't warn on creating a vif with duplicate ma…
This commit is contained in:
commit
d9f5733c78
@ -40,6 +40,7 @@ using XenAdmin.Network;
|
||||
using XenAPI;
|
||||
using XenAdmin.Core;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
namespace XenAdmin.Dialogs
|
||||
@ -360,21 +361,25 @@ namespace XenAdmin.Dialogs
|
||||
|
||||
/// <summary>
|
||||
/// Determine if the MAC is accetable. It may not be if
|
||||
/// other VIFs on the same Network have the same MAC address as entered
|
||||
/// other VIFs have the same MAC address as entered
|
||||
/// </summary>
|
||||
/// <returns>If the MAC address entered is acceptable</returns>
|
||||
private bool MACAddressIsAcceptable()
|
||||
{
|
||||
foreach (VIF vif in connection.ResolveAll( SelectedNetwork.VIFs ) )
|
||||
foreach (var xenConnection in ConnectionsManager.XenConnectionsCopy.Where(c => c.IsConnected))
|
||||
{
|
||||
if ( vif != ExistingVif && vif.MAC == SelectedMac )
|
||||
foreach (VIF vif in xenConnection.Cache.VIFs)
|
||||
{
|
||||
var vm = xenConnection.Resolve(vif.VM);
|
||||
if (vif != ExistingVif && vif.MAC == SelectedMac && vm != null && vm.is_a_real_vm)
|
||||
{
|
||||
DialogResult result = MacAddressDuplicationWarningDialog(
|
||||
SelectedMac,
|
||||
connection.Resolve(vif.VM).Name ).ShowDialog(Program.MainWindow);
|
||||
vm.NameWithLocation).ShowDialog(Program.MainWindow);
|
||||
return (result == DialogResult.Yes);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user