예제 #1
0
        private void AddFakeNetworkForTesting(int fakeMode)
        {
            DatabaseAvailabilityGroupSubnetId subnetId = new DatabaseAvailabilityGroupSubnetId("1.1.1.0/24");
            ClusterNetwork clusterNetwork = new ClusterNetwork(subnetId);

            clusterNetwork.ClusterState = AmNetworkState.Up;
            this.m_clusterNets.Add(clusterNetwork);
            int num = 1;

            foreach (ClusterNode clusterNode in this.m_clusterNodes)
            {
                string     ipString   = string.Format("1.1.1.{0}", num);
                IPAddress  ipaddress  = IPAddress.Parse(ipString);
                ClusterNic clusterNic = new ClusterNic();
                clusterNic.Name           = string.Format("FakeNic{0}", num);
                clusterNic.NodeName       = clusterNode.Name.NetbiosName;
                clusterNic.HasIPAddress   = true;
                clusterNic.IPAddress      = ipaddress;
                clusterNic.ClusterState   = AmNetInterfaceState.Up;
                clusterNic.ClusterNetwork = clusterNetwork;
                clusterNetwork.Nics.Add(clusterNic);
                if (fakeMode > 1)
                {
                    break;
                }
            }
        }
예제 #2
0
 private bool DoesClusterNetworkContainNode(ClusterNetwork clusNet, string nodeName)
 {
     foreach (ClusterNic clusterNic in clusNet.Nics)
     {
         if (SharedHelper.StringIEquals(nodeName, clusterNic.NodeName))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #3
0
 private void SelectPingCandidates(ClusterNetwork clusnet, List <PingRequest> pingTargets)
 {
     foreach (ClusterNic clusterNic in clusnet.Nics)
     {
         if (clusterNic.ClusterState == AmNetInterfaceState.Up)
         {
             pingTargets.Add(new PingRequest
             {
                 IPAddress   = clusterNic.IPAddress,
                 UserContext = clusterNic
             });
         }
     }
 }
예제 #4
0
        public void LoadClusterObjects(IAmCluster cluster)
        {
            IEnumerable <IAmClusterNode> enumerable = cluster.EnumerateNodes();

            try
            {
                foreach (IAmClusterNode clusNode in enumerable)
                {
                    ClusterNode item = new ClusterNode(clusNode);
                    this.m_clusterNodes.Add(item);
                }
            }
            finally
            {
                foreach (IAmClusterNode amClusterNode in enumerable)
                {
                    using (amClusterNode)
                    {
                    }
                }
            }
            IEnumerable <AmClusterNetwork> enumerable2 = cluster.EnumerateNetworks();

            try
            {
                foreach (AmClusterNetwork clusNet in enumerable2)
                {
                    ClusterNetwork item2 = new ClusterNetwork(clusNet);
                    this.m_clusterNets.Add(item2);
                }
            }
            finally
            {
                foreach (AmClusterNetwork amClusterNetwork in enumerable2)
                {
                    using (amClusterNetwork)
                    {
                    }
                }
            }
            int testWithFakeNetwork = RegistryParameters.GetTestWithFakeNetwork();

            if (testWithFakeNetwork > 0)
            {
                this.AddFakeNetworkForTesting(testWithFakeNetwork);
            }
            this.LinkNicsToNodes();
        }
예제 #5
0
        public ClusterNic(AmClusterNetInterface clusNic, ClusterNetwork owningClusNet)
        {
            this.Name           = clusNic.Name;
            this.ClusterNetwork = owningClusNet;
            this.NodeName       = clusNic.GetNodeName();
            this.ClusterState   = clusNic.GetState(false);
            bool      flag      = false;
            string    address   = clusNic.GetAddress();
            IPAddress ipaddress = NetworkUtil.ConvertStringToIpAddress(address);

            if (ipaddress != null)
            {
                flag = true;
            }
            else
            {
                NetworkManager.TraceError("Ignoring invalid IPV4 address on NIC {0} since it has invalid ip={1}", new object[]
                {
                    this.Name,
                    address
                });
                string[] ipv6Addresses = clusNic.GetIPv6Addresses();
                if (ipv6Addresses != null && ipv6Addresses.Length > 0)
                {
                    ipaddress = NetworkUtil.ConvertStringToIpAddress(ipv6Addresses[0]);
                    if (ipaddress != null)
                    {
                        flag = true;
                    }
                }
            }
            if (flag)
            {
                this.IPAddress    = ipaddress;
                this.HasIPAddress = true;
                return;
            }
            NetworkManager.TraceError("ClusterNic '{0}' has no ip addr. Nic state is {1}", new object[]
            {
                this.Name,
                this.ClusterState
            });
        }
예제 #6
0
        // Token: 0x0600177A RID: 6010 RVA: 0x00060C0C File Offset: 0x0005EE0C
        internal void Load(NetworkDiscovery netConfig)
        {
            this.m_preferredNets = new List <ExchangeNetwork>();
            this.m_regularNets   = new List <ExchangeNetwork>();
            foreach (ClusterNode clusterNode in netConfig.Nodes)
            {
                ExchangeNetworkNode exchangeNetworkNode = new ExchangeNetworkNode(clusterNode.Name.NetbiosName);
                exchangeNetworkNode.ClusterState = clusterNode.ClusterState;
                this.m_nodes.Add(exchangeNetworkNode.Name, exchangeNetworkNode);
            }
            string machineName     = Environment.MachineName;
            int    sourceNodeIndex = this.Nodes.IndexOfKey(machineName);

            this.SourceNodeIndex = sourceNodeIndex;
            foreach (LogicalNetwork logicalNetwork in netConfig.LogicalNetworks)
            {
                ExchangeNetwork exchangeNetwork = new ExchangeNetwork(logicalNetwork.Name, this);
                exchangeNetwork.Description        = logicalNetwork.Description;
                exchangeNetwork.ReplicationEnabled = logicalNetwork.ReplicationEnabled;
                exchangeNetwork.IgnoreNetwork      = logicalNetwork.IgnoreNetwork;
                exchangeNetwork.MapiAccessEnabled  = logicalNetwork.HasDnsNic();
                this.m_networks.Add(exchangeNetwork.Name, exchangeNetwork);
                foreach (Subnet subnet in logicalNetwork.Subnets)
                {
                    if (this.m_subnets.ContainsKey(subnet.SubnetId))
                    {
                        exchangeNetwork.IsMisconfigured = true;
                        string errorText = string.Format("Ignoring subnet {0}. It was mapped to multiple nets.", subnet.SubnetId);
                        this.RecordInconsistency(errorText);
                    }
                    else
                    {
                        ExchangeSubnet exchangeSubnet = this.AddSubnetToMap(subnet.SubnetId, exchangeNetwork);
                        ClusterNetwork clusterNetwork = subnet.ClusterNetwork;
                        if (clusterNetwork == null)
                        {
                            exchangeNetwork.IsMisconfigured = true;
                            string errorText2 = string.Format("Subnet {0} configured but no cluster network matched.", subnet.SubnetId);
                            this.RecordInconsistency(errorText2);
                        }
                        else
                        {
                            exchangeSubnet.SubnetAndState.State = ExchangeSubnet.MapSubnetState(clusterNetwork.ClusterState);
                            foreach (ClusterNic clusterNic in clusterNetwork.Nics)
                            {
                                int num = this.Nodes.IndexOfKey(clusterNic.NodeName);
                                if (num < 0)
                                {
                                    string errorText3 = string.Format("Nic {0} has unknown Node {1}.", clusterNic.IPAddress, clusterNic.NodeName);
                                    this.RecordInconsistency(errorText3);
                                }
                                else
                                {
                                    NetworkEndPoint networkEndPoint = new NetworkEndPoint(clusterNic.IPAddress, clusterNic.NodeName, exchangeSubnet);
                                    exchangeSubnet.Network.AddEndPoint(networkEndPoint, num);
                                    networkEndPoint.CopyClusterNicState(clusterNic.ClusterState);
                                }
                            }
                        }
                    }
                }
                if (!exchangeNetwork.IgnoreNetwork && exchangeNetwork.Subnets.Count != 0 && exchangeNetwork.ReplicationEnabled)
                {
                    if (exchangeNetwork.MapiAccessEnabled)
                    {
                        this.m_regularNets.Add(exchangeNetwork);
                    }
                    else
                    {
                        this.m_preferredNets.Add(exchangeNetwork);
                    }
                }
            }
        }
예제 #7
0
 public Subnet(ClusterNetwork clusNet)
 {
     this.SubnetId       = clusNet.SubnetId;
     this.ClusterNetwork = clusNet;
 }