Beispiel #1
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();
        }
Beispiel #2
0
        // Token: 0x06001779 RID: 6009 RVA: 0x00060A2C File Offset: 0x0005EC2C
        internal void SynchronizeClusterNetworkRoles(IAmCluster cluster)
        {
            IEnumerable <AmClusterNetwork> enumerable = cluster.EnumerateNetworks();

            try
            {
                foreach (AmClusterNetwork amClusterNetwork in enumerable)
                {
                    DatabaseAvailabilityGroupSubnetId databaseAvailabilityGroupSubnetId = ExchangeSubnet.ExtractSubnetId(amClusterNetwork);
                    if (databaseAvailabilityGroupSubnetId != null)
                    {
                        ExchangeSubnet exchangeSubnet = this.FindSubnet(databaseAvailabilityGroupSubnetId);
                        if (exchangeSubnet != null)
                        {
                            AmNetworkRole nativeClusterNetworkRole = exchangeSubnet.Network.GetNativeClusterNetworkRole();
                            AmNetworkRole nativeRole = amClusterNetwork.GetNativeRole();
                            if (nativeRole != nativeClusterNetworkRole)
                            {
                                NetworkManager.TraceDebug("Changing network role for subnet {0} from {1} to {2}", new object[]
                                {
                                    databaseAvailabilityGroupSubnetId,
                                    nativeRole,
                                    nativeClusterNetworkRole
                                });
                                bool flag = false;
                                try
                                {
                                    amClusterNetwork.SetNativeRole(nativeClusterNetworkRole);
                                    flag = true;
                                }
                                finally
                                {
                                    if (!flag)
                                    {
                                        if (nativeClusterNetworkRole == AmNetworkRole.ClusterNetworkRoleNone)
                                        {
                                            exchangeSubnet.Network.IgnoreNetwork = false;
                                            this.ConfigUpdated = true;
                                        }
                                    }
                                    else
                                    {
                                        ReplayEventLogConstants.Tuple_NetworkRoleChanged.LogEvent(null, new object[]
                                        {
                                            amClusterNetwork.Name,
                                            databaseAvailabilityGroupSubnetId.ToString(),
                                            nativeRole.ToString(),
                                            nativeClusterNetworkRole.ToString()
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                foreach (AmClusterNetwork amClusterNetwork2 in enumerable)
                {
                    using (amClusterNetwork2)
                    {
                    }
                }
            }
        }
Beispiel #3
0
        internal static LocalizedString FixUpIpAddressesForNetName(ITaskOutputHelper logger, IAmCluster cluster, AmClusterGroup group, AmClusterResource netname, IEnumerable <IPAddress> staticIpAddresses)
        {
            logger = (logger ?? NullTaskOutputHelper.GetNullLogger());
            LocalizedString localizedString = Strings.FixUpIpAddressStatusUnchanged;

            if (staticIpAddresses != null && staticIpAddresses.Count <IPAddress>() == 1 && IPAddress.Any.Equals(staticIpAddresses.ElementAt(0)))
            {
                logger.AppendLogMessage("DAG IP Address was specified in AD, but it's the sentinel value for forcing DHCP ({0}).", new object[]
                {
                    IPAddress.Any
                });
                staticIpAddresses = new IPAddress[0];
            }
            bool flag  = staticIpAddresses != null && staticIpAddresses.Count <IPAddress>() > 0;
            bool flag2 = staticIpAddresses != null && staticIpAddresses.Count <IPAddress>() == 0;

            logger.AppendLogMessage("FixUpIpAddressesForNetName: goingToStaticIps: {0}, goingToDynamicIps = {1}.", new object[]
            {
                flag,
                flag2
            });
            if (flag)
            {
                logger.AppendLogMessage("FixUpIpAddressesForNetName: The static IPs specified are:", new object[0]);
                foreach (IPAddress ipaddress in staticIpAddresses)
                {
                    logger.AppendLogMessage("  -> {0}", new object[]
                    {
                        ipaddress
                    });
                }
            }
            IEnumerable <AmClusterNetwork>  enumerable  = null;
            IEnumerable <AmClusterResource> enumerable2 = null;
            IEnumerable <AmClusterResource> enumerable3 = null;
            IEnumerable <AmClusterResource> enumerable4 = null;

            try
            {
                enumerable = cluster.EnumerateNetworks();
                IEnumerable <AmClusterNetwork> enumerable5 = AmClusterResourceHelper.FilterPublicNetworksFromAllNetworks(enumerable);
                enumerable2 = group.EnumerateResourcesOfType("IP Address");
                enumerable3 = group.EnumerateResourcesOfType("IPv6 Address");
                IEnumerable <AmClusterResource> enumerable6 = enumerable2.Concat(enumerable3);
                IList <string> networksWithResources;
                int            num = AmClusterResourceHelper.DeleteOrphanedIpAddresses(logger, group, netname, enumerable6, staticIpAddresses, enumerable5, out networksWithResources);
                if (num > 0)
                {
                    SharedHelper.DisposeObjectList <AmClusterResource>(enumerable6);
                    enumerable2 = group.EnumerateResourcesOfType("IP Address");
                    enumerable3 = group.EnumerateResourcesOfType("IPv6 Address");
                }
                if (flag)
                {
                    enumerable4 = AmClusterResourceHelper.AddStaticIpAddressesToStrandedNetworks(logger, group, netname, enumerable5, networksWithResources, staticIpAddresses);
                }
                else
                {
                    enumerable4 = AmClusterResourceHelper.AddIpAddressesToStrandedNetworks(logger, group, netname, enumerable5, networksWithResources);
                }
                int num2 = enumerable4.Count <AmClusterResource>();
                if (num2 > 0)
                {
                    HashSet <string> hashSet = new HashSet <string>();
                    foreach (AmClusterResource amClusterResource in enumerable2)
                    {
                        hashSet.Add(amClusterResource.Name);
                    }
                    foreach (AmClusterResource amClusterResource2 in enumerable3)
                    {
                        hashSet.Add(amClusterResource2.Name);
                    }
                    foreach (AmClusterResource amClusterResource3 in enumerable4)
                    {
                        hashSet.Add(amClusterResource3.Name);
                    }
                    string text = string.Format("[{0}]", string.Join("] OR [", hashSet.ToArray <string>()));
                    logger.AppendLogMessage("Setting the dependency on netname '{0}' to '{1}'", new object[]
                    {
                        netname.Name,
                        text
                    });
                    netname.OfflineResource();
                    uint num3 = netname.SetDependencyExpression(text);
                    logger.AppendLogMessage("SetDependencyExpression returned {0}.", new object[]
                    {
                        num3
                    });
                }
                localizedString = Strings.FixUpIpAddressStatusUpdated(num, num2);
            }
            finally
            {
                SharedHelper.DisposeObjectList <AmClusterNetwork>(enumerable);
                SharedHelper.DisposeObjectList <AmClusterResource>(enumerable2);
                SharedHelper.DisposeObjectList <AmClusterResource>(enumerable3);
                SharedHelper.DisposeObjectList <AmClusterResource>(enumerable4);
                netname.OnlineResource();
            }
            logger.AppendLogMessage("Successfully completed fixing up the IP addresses for netname '{0}'. Changes made: {1}", new object[]
            {
                netname.Name,
                localizedString
            });
            return(localizedString);
        }