// Token: 0x060008BA RID: 2234 RVA: 0x00029FC4 File Offset: 0x000281C4
 private static bool EvictDagClusterNodeInternal(HaTaskStringBuilderOutputHelper output, AmServerName convictedNode, out string verboseLog)
 {
     ExTraceGlobals.ClusterTracer.TraceDebug <AmServerName>(0L, "Going to EvictClusterNode( {0} ) on this machine.", convictedNode);
     try
     {
         using (IAmCluster amCluster = ClusterFactory.Instance.Open())
         {
             amCluster.EvictNodeFromCluster(convictedNode);
         }
     }
     catch (ClusterException ex)
     {
         output.AppendLogMessage("EvictDagClusterNode got exception {0}", new object[]
         {
             ex
         });
         AmClusterException exception = DagHelper.TranslateClusterExceptionForClient(ex);
         DagHelper.ThrowDagTaskOperationWrapper(exception);
     }
     catch (LocalizedException ex2)
     {
         output.AppendLogMessage("EvictDagClusterNode got exception {0}", new object[]
         {
             ex2
         });
         DagHelper.ThrowDagTaskOperationWrapper(ex2);
     }
     finally
     {
         verboseLog = output.ToString();
     }
     return(true);
 }
        // Token: 0x060008B3 RID: 2227 RVA: 0x00029B08 File Offset: 0x00027D08
        internal static IAmCluster CreateDagCluster(string clusterName, AmServerName firstNodeName, string[] ipAddresses, uint[] netmasks, out string verboseLog)
        {
            IAmCluster result = null;
            HaTaskStringBuilderOutputHelper haTaskStringBuilderOutputHelper = new HaTaskStringBuilderOutputHelper("m.e.cluster.replay.dll!CreateDagCluster");
            GCHandle  value = GCHandle.Alloc(haTaskStringBuilderOutputHelper);
            Exception ex    = null;

            try
            {
                haTaskStringBuilderOutputHelper.WriteProgressSimple(ReplayStrings.DagTaskFormingClusterProgress(clusterName, firstNodeName.NetbiosName));
                haTaskStringBuilderOutputHelper.LastException = null;
                haTaskStringBuilderOutputHelper.MaxPercentageDuringCallback = 0;
                result = ClusterFactory.Instance.CreateExchangeCluster(clusterName, firstNodeName, ipAddresses, netmasks, haTaskStringBuilderOutputHelper, GCHandle.ToIntPtr(value), out ex, true);
                if (ex != null)
                {
                    haTaskStringBuilderOutputHelper.WriteErrorSimple(ex);
                }
            }
            catch (LocalizedException exception)
            {
                DagHelper.ThrowDagTaskOperationWrapper(exception);
            }
            finally
            {
                verboseLog = haTaskStringBuilderOutputHelper.ToString();
                value.Free();
            }
            return(result);
        }
示例#3
0
        // Token: 0x06000F53 RID: 3923 RVA: 0x00041F2C File Offset: 0x0004012C
        private void Open()
        {
            AmClusterHandle amClusterHandle = null;
            AmSystemManager instance        = AmSystemManager.Instance;

            if (instance != null)
            {
                AmConfig config = instance.Config;
                if (config != null)
                {
                    AmDagConfig dagConfig = config.DagConfig;
                    if (dagConfig != null)
                    {
                        IAmCluster cluster = dagConfig.Cluster;
                        if (cluster != null)
                        {
                            amClusterHandle = cluster.Handle;
                        }
                    }
                }
            }
            if (amClusterHandle == null || amClusterHandle.IsInvalid)
            {
                throw new AmClusterNotRunningException();
            }
            using (IDistributedStoreKey clusterKey = DistributedStore.Instance.GetClusterKey(amClusterHandle, null, null, DxStoreKeyAccessMode.Write, false))
            {
                string keyName = string.Format("{0}\\SafetyNet2\\{1}", "ExchangeActiveManager", this.m_dbGuidStr);
                this.m_dbRegKeyHandle = clusterKey.OpenKey(keyName, DxStoreKeyAccessMode.CreateIfNotExist, false, null);
            }
        }
示例#4
0
 public static void ValidateIpv4Addresses(IAmCluster cluster, IPAddress[] ipv4Addresses)
 {
     for (int i = 0; i < ipv4Addresses.Length - 1; i++)
     {
         for (int j = i + 1; j < ipv4Addresses.Length; j++)
         {
             if (object.Equals(ipv4Addresses[i], ipv4Addresses[j]))
             {
                 throw new IPv4AddressesHasDuplicateEntries(ipv4Addresses[i].ToString());
             }
         }
     }
     if (cluster != null)
     {
         IDictionary <IPAddress, AmClusterNetwork> dictionary = null;
         try
         {
             dictionary = AmClusterResourceHelper.GetIpv4StaticNetworkMap(cluster, ipv4Addresses);
         }
         finally
         {
             if (dictionary != null)
             {
                 SharedHelper.DisposeObjectList <AmClusterNetwork>(dictionary.Values);
             }
         }
     }
 }
示例#5
0
 // Token: 0x060001CB RID: 459 RVA: 0x000086DD File Offset: 0x000068DD
 internal AmClusterNode(AmServerName nodeName, IAmCluster owningCluster, AmClusterNodeHandle nodeHandle)
 {
     this.m_disposeTracker = this.GetDisposeTracker();
     this.Name             = nodeName;
     this.OwningCluster    = owningCluster;
     this.Handle           = nodeHandle;
 }
示例#6
0
        protected virtual Dictionary <AmServerName, AmNodeState> GetAllClusterNodeStates(ITaskOutputHelper output)
        {
            Dictionary <AmServerName, AmNodeState> dictionary = new Dictionary <AmServerName, AmNodeState>(15);

            try
            {
                using (IAmCluster amCluster = ClusterFactory.Instance.Open())
                {
                    foreach (IAmClusterNode amClusterNode in amCluster.EnumerateNodes())
                    {
                        using (amClusterNode)
                        {
                            AmNodeState state = amClusterNode.GetState(false);
                            dictionary[amClusterNode.Name] = state;
                        }
                    }
                }
            }
            catch (ClusterException ex)
            {
                output.AppendLogMessage("GetAllClusterNodeStates() failed with error {0}", new object[]
                {
                    ex.Message
                });
            }
            return(dictionary);
        }
示例#7
0
        public static void MoveClusterGroupWithTimeout(AmServerName clusterNode, AmServerName destinationNode, TimeSpan timeout)
        {
            uint errorCode = 0U;
            bool flag      = false;

            try
            {
                InvokeWithTimeout.Invoke(delegate()
                {
                    using (IAmCluster amCluster = MockableCluster.Instance.OpenByName(clusterNode))
                    {
                        using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup())
                        {
                            if (!amClusterGroup.OwnerNode.Equals(destinationNode))
                            {
                                amClusterGroup.MoveGroup(timeout, destinationNode);
                            }
                        }
                    }
                }, timeout);
            }
            catch (TimeoutException)
            {
                errorCode = 258U;
                flag      = true;
            }
            if (flag)
            {
                throw AmExceptionHelper.ConstructClusterApiException((int)errorCode, "MoveClusterGroup( dest={0}, timeout={1})", new object[]
                {
                    destinationNode.NetbiosName,
                    timeout
                });
            }
        }
        public static Exception Write(IAmCluster cluster, AmServerName srvName, AmClusterNodeNetworkStatus status)
        {
            Exception ex = null;

            try
            {
                using (AmClusterNodeStatusAccessor amClusterNodeStatusAccessor = new AmClusterNodeStatusAccessor(cluster, srvName, DxStoreKeyAccessMode.CreateIfNotExist))
                {
                    amClusterNodeStatusAccessor.Write(status);
                }
            }
            catch (SerializationException ex2)
            {
                ex = ex2;
            }
            catch (ClusterException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                AmClusterNodeStatusAccessor.Tracer.TraceError <AmServerName, AmClusterNodeNetworkStatus, Exception>(0L, "AmClusterNodeNetworkStatus.Write({0},{1}) failed: {2}", srvName, status, ex);
            }
            return(ex);
        }
        public static AmClusterNodeNetworkStatus Read(IAmCluster cluster, AmServerName srvName, out Exception ex)
        {
            ex = null;
            AmClusterNodeNetworkStatus amClusterNodeNetworkStatus = null;

            try
            {
                using (AmClusterNodeStatusAccessor amClusterNodeStatusAccessor = new AmClusterNodeStatusAccessor(cluster, srvName, DxStoreKeyAccessMode.Read))
                {
                    amClusterNodeNetworkStatus = amClusterNodeStatusAccessor.Read();
                }
            }
            catch (SerializationException ex2)
            {
                ex = ex2;
            }
            catch (ClusterException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                AmClusterNodeStatusAccessor.Tracer.TraceError <AmServerName, Exception>(0L, "AmClusterNodeNetworkStatus.Read({0}) failed: {1}", srvName, ex);
            }
            else if (amClusterNodeNetworkStatus == null)
            {
                AmClusterNodeStatusAccessor.Tracer.TraceError <AmServerName>(0L, "AmClusterNodeNetworkStatus.Read({0}) No status has yet been published", srvName);
            }
            return(amClusterNodeNetworkStatus);
        }
示例#10
0
        // Token: 0x060008B5 RID: 2229 RVA: 0x00029C34 File Offset: 0x00027E34
        internal static void DestroyDagCluster(string clusterName, out string verboseLog)
        {
            HaTaskStringBuilderOutputHelper haTaskStringBuilderOutputHelper = new HaTaskStringBuilderOutputHelper("m.e.cluster.replay.dll!DestroyDagCluster");

            ExTraceGlobals.ClusterTracer.TraceDebug <string>(0L, "Going to DestroyCluster( {0} ) on this machine.", clusterName);
            GCHandle  value = GCHandle.Alloc(haTaskStringBuilderOutputHelper);
            Exception ex    = null;

            try
            {
                haTaskStringBuilderOutputHelper.LastException = null;
                haTaskStringBuilderOutputHelper.MaxPercentageDuringCallback = 0;
                using (IAmCluster amCluster = ClusterFactory.Instance.Open())
                {
                    amCluster.DestroyExchangeCluster(haTaskStringBuilderOutputHelper, GCHandle.ToIntPtr(value), out ex, true);
                }
                if (ex != null)
                {
                    haTaskStringBuilderOutputHelper.WriteErrorSimple(ex);
                }
            }
            catch (LocalizedException exception)
            {
                DagHelper.ThrowDagTaskOperationWrapper(exception);
            }
            finally
            {
                verboseLog = haTaskStringBuilderOutputHelper.ToString();
                value.Free();
            }
        }
 // Token: 0x06000449 RID: 1097 RVA: 0x00016D00 File Offset: 0x00014F00
 internal AmPersistentClusdbState(IAmCluster cluster, string keyName)
 {
     using (IDistributedStoreKey clusterKey = DistributedStore.Instance.GetClusterKey(cluster.Handle, null, null, DxStoreKeyAccessMode.Write, false))
     {
         string keyName2 = "ExchangeActiveManager\\" + keyName;
         this.m_regHandle = clusterKey.OpenKey(keyName2, DxStoreKeyAccessMode.CreateIfNotExist, false, null);
     }
 }
示例#12
0
		internal static void SetDagNetworkConfig(SetDagNetworkConfigRequest configChange)
		{
			NetworkManager.RunRpcOperation("SetDagNetworkConfig", delegate(object param0, EventArgs param1)
			{
				NetworkManager manager = NetworkManager.GetManager();
				if (manager == null)
				{
					throw new DagNetworkManagementException(ReplayStrings.NetworkManagerInitError);
				}
				lock (manager.m_mapRefreshLock)
				{
					using (IAmCluster amCluster = ClusterFactory.Instance.Open())
					{
						using (DagConfigurationStore dagConfigurationStore = new DagConfigurationStore())
						{
							dagConfigurationStore.Open();
							PersistentDagNetworkConfig persistentDagNetworkConfig = dagConfigurationStore.LoadNetworkConfig();
							if (persistentDagNetworkConfig == null)
							{
								persistentDagNetworkConfig = new PersistentDagNetworkConfig();
							}
							else
							{
								string text = persistentDagNetworkConfig.Serialize();
								ReplayEventLogConstants.Tuple_DagNetworkConfigOld.LogEvent(DateTime.UtcNow.ToString(), new object[]
								{
									text
								});
							}
							if (configChange.SetPort)
							{
								persistentDagNetworkConfig.ReplicationPort = configChange.ReplicationPort;
								manager.ReplicationPort = configChange.ReplicationPort;
							}
							manager.NetworkCompression = configChange.NetworkCompression;
							persistentDagNetworkConfig.NetworkCompression = configChange.NetworkCompression;
							manager.NetworkEncryption = configChange.NetworkEncryption;
							persistentDagNetworkConfig.NetworkEncryption = configChange.NetworkEncryption;
							manager.ManualDagNetworkConfiguration = configChange.ManualDagNetworkConfiguration;
							persistentDagNetworkConfig.ManualDagNetworkConfiguration = configChange.ManualDagNetworkConfiguration;
							if (configChange.DiscoverNetworks)
							{
								NetworkDiscovery networkDiscovery = new NetworkDiscovery();
								networkDiscovery.LoadClusterObjects(amCluster);
								networkDiscovery.DetermineDnsStatus();
								networkDiscovery.AggregateNetworks(true);
								ExchangeNetworkMap exchangeNetworkMap = new ExchangeNetworkMap(manager);
								exchangeNetworkMap.Load(networkDiscovery);
								persistentDagNetworkConfig = exchangeNetworkMap.BuildPersistentDagNetworkConfig();
							}
							manager.UpdateNetworkConfig(persistentDagNetworkConfig);
						}
					}
				}
			});
		}
        public AmClusterNodeStatusAccessor(IAmCluster cluster, AmServerName nodeName, DxStoreKeyAccessMode mode = DxStoreKeyAccessMode.Read)
        {
            this.ServerName = nodeName;
            string keyName = string.Format("{0}\\{1}", "ExchangeActiveManager\\NodeState", nodeName.NetbiosName);

            using (IDistributedStoreKey clusterKey = DistributedStore.Instance.GetClusterKey(cluster.Handle, null, null, mode, false))
            {
                this.distributedStoreKey = clusterKey.OpenKey(keyName, mode, false, null);
            }
        }
示例#14
0
 // Token: 0x060008AF RID: 2223 RVA: 0x00029954 File Offset: 0x00027B54
 internal static bool IsQuorumTypeFileShareWitness(IAmCluster cluster)
 {
     using (AmClusterResource amClusterResource = cluster.OpenQuorumResource())
     {
         if (amClusterResource != null && amClusterResource.GetTypeName() == "File Share Witness")
         {
             return(true);
         }
     }
     return(false);
 }
示例#15
0
 // Token: 0x060008AE RID: 2222 RVA: 0x00029798 File Offset: 0x00027998
 internal static void RevertToMnsQuorum(ILogTraceHelper output, IAmCluster cluster)
 {
     using (IAmClusterGroup amClusterGroup = cluster.FindCoreClusterGroup())
     {
         string text;
         uint   maxLogSize;
         string quorumResourceInformation = cluster.GetQuorumResourceInformation(out text, out maxLogSize);
         if (string.IsNullOrEmpty(quorumResourceInformation))
         {
             output.AppendLogMessage("RevertToMnsQuorum: It's already using MNS!", new object[0]);
             using (IAmClusterResource amClusterResource = amClusterGroup.FindResourceByTypeName("File Share Witness"))
             {
                 if (amClusterResource != null)
                 {
                     output.AppendLogMessage("Even though the quorum is set to MNS, there is a FSW resource present named '{0}', which will be deleted shortly.", new object[]
                     {
                         amClusterResource.Name
                     });
                     amClusterResource.DeleteResource();
                     output.AppendLogMessage("The resource has been deleted!", new object[0]);
                 }
                 goto IL_13D;
             }
         }
         using (AmClusterResource amClusterResource2 = cluster.OpenResource(quorumResourceInformation))
         {
             output.AppendLogMessage("Setting cluster quorum to MNS", new object[0]);
             if (cluster.CnoName == string.Empty)
             {
                 cluster.ClearQuorumResource();
             }
             else
             {
                 using (IAmClusterResource amClusterResource3 = amClusterGroup.FindResourceByTypeName("Network Name"))
                 {
                     output.AppendLogMessage("Setting cluster quorum resource to the netname resource (i.e. MNS quorum).", new object[0]);
                     cluster.SetQuorumResource(amClusterResource3, null, maxLogSize);
                     if (amClusterResource2 != null && amClusterResource2.GetTypeName() == "File Share Witness")
                     {
                         output.AppendLogMessage("Offlining and deleting the old FSW resource '{0}'.", new object[]
                         {
                             quorumResourceInformation
                         });
                         amClusterResource2.OfflineResource();
                         amClusterResource2.DeleteResource();
                     }
                 }
             }
         }
         IL_13D :;
     }
 }
示例#16
0
        private void ProcessNicEvent(AmClusterEventInfo cei)
        {
            Dictionary <string, AmNetworkMonitor.Nic> nicTable = this.m_nicTable;
            IAmCluster cluster = this.GetCluster();

            if (nicTable == null || cluster == null)
            {
                AmNetworkMonitor.Tracer.TraceError(0L, "Not yet initialized. Ignoring event");
                return;
            }
            AmNetworkMonitor.Nic nic;
            if (!nicTable.TryGetValue(cei.ObjectName, out nic))
            {
                this.TriggerClusterRefresh("nic not found");
                return;
            }
            AmNetInterfaceState nicState = this.GetNicState(cei.ObjectName);

            switch (nicState)
            {
            case AmNetInterfaceState.Unavailable:
                AmNetworkMonitor.Tracer.TraceError <string, AmNetInterfaceState>(0L, "MAPI NIC '{0}' is {1}.", cei.ObjectName, nicState);
                return;

            case AmNetInterfaceState.Failed:
            case AmNetInterfaceState.Unreachable:
            {
                AmNetworkMonitor.Tracer.TraceError <string, AmNetInterfaceState>(0L, "MAPI NIC '{0}' is {1}.", cei.ObjectName, nicState);
                AmEvtMapiNetworkFailure amEvtMapiNetworkFailure = new AmEvtMapiNetworkFailure(nic.Node.Name);
                amEvtMapiNetworkFailure.Notify(true);
                return;
            }

            case AmNetInterfaceState.Up:
                AmNetworkMonitor.Tracer.TraceDebug <string>(0L, "MAPI NIC '{0}' is Up.", cei.ObjectName);
                if (nic.Node.Name.IsLocalComputerName)
                {
                    AmClusterNodeNetworkStatus amClusterNodeNetworkStatus = new AmClusterNodeNetworkStatus();
                    Exception ex = AmClusterNodeStatusAccessor.Write(cluster, nic.Node.Name, amClusterNodeNetworkStatus);
                    if (ex != null)
                    {
                        ReplayCrimsonEvents.AmNodeStatusUpdateFailed.Log <string, string>(amClusterNodeNetworkStatus.ToString(), ex.Message);
                        return;
                    }
                }
                break;

            default:
                AmNetworkMonitor.Tracer.TraceError <AmNetInterfaceState, string>(0L, "Unexpected NIC state {0} for {1}", nicState, cei.ObjectName);
                break;
            }
        }
示例#17
0
 // Token: 0x060008B4 RID: 2228 RVA: 0x00029BAC File Offset: 0x00027DAC
 internal static void FollowBestPractices(ITaskOutputHelper output, IAmCluster cluster)
 {
     if (string.Empty != cluster.CnoName)
     {
         using (IAmClusterGroup amClusterGroup = cluster.FindCoreClusterGroup())
         {
             using (IAmClusterResource amClusterResource = amClusterGroup.FindResourceByTypeName("Network Name"))
             {
                 output.AppendLogMessage("Setting the DNS TTL to 300", new object[0]);
                 amClusterResource.SetPrivateProperty <int>("HostRecordTTL", 300);
             }
         }
     }
 }
示例#18
0
        public static bool MovePrimaryActiveManagerRole(string CurrentPrimaryName)
        {
            AmServerName serverName = new AmServerName(CurrentPrimaryName);
            bool         result;

            using (IAmCluster amCluster = ClusterFactory.Instance.OpenByName(serverName))
            {
                using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup())
                {
                    string text;
                    result = amClusterGroup.MoveGroupToReplayEnabledNode((string targetNode) => AmHelper.IsReplayRunning(targetNode), "Network Name", new TimeSpan(0, 3, 0), out text);
                }
            }
            return(result);
        }
示例#19
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();
        }
示例#20
0
 // Token: 0x060000E3 RID: 227 RVA: 0x000066B4 File Offset: 0x000048B4
 public void Start(IAmCluster cluster)
 {
     if (this.m_cem == null || !this.m_cem.IsMonitoring || !object.ReferenceEquals(this.Cluster, cluster))
     {
         AmClusterMonitor.Tracer.TraceDebug(0L, "Starting AmClusterEventManager");
         this.Cluster = cluster;
         AmSystemManager.Instance.NetworkMonitor.UseCluster(this.Cluster);
         AmSystemManager.Instance.NetworkMonitor.RefreshMapiNetwork();
         if (this.m_cem != null)
         {
             this.m_cem.Stop();
         }
         this.m_cem = new AmClusterEventManager(this.Cluster);
         this.m_cem.Start();
     }
 }
示例#21
0
        // Token: 0x060008B2 RID: 2226 RVA: 0x00029A88 File Offset: 0x00027C88
        public static IEnumerable <AmServerName> EnumeratePausedNodes(IAmCluster cluster)
        {
            IList <AmServerName> list = new List <AmServerName>(8);

            foreach (IAmClusterNode amClusterNode in cluster.EnumerateNodes())
            {
                using (amClusterNode)
                {
                    if (amClusterNode.State == AmNodeState.Paused)
                    {
                        list.Add(amClusterNode.Name);
                    }
                }
            }
            return(list);
        }
示例#22
0
        private AmNetInterfaceState GetNicState(string nicName)
        {
            AmNetInterfaceState result  = AmNetInterfaceState.Unknown;
            IAmCluster          cluster = this.GetCluster();

            if (cluster != null)
            {
                Exception ex;
                result = cluster.GetNetInterfaceState(nicName, out ex);
                if (ex != null)
                {
                    AmNetworkMonitor.Tracer.TraceError <string, Exception>(0L, "Failed to get state for nic '{0}': {1}", nicName, ex);
                    this.TriggerClusterRefresh("GetNicState failed");
                }
            }
            return(result);
        }
示例#23
0
 // Token: 0x060000E4 RID: 228 RVA: 0x00006750 File Offset: 0x00004950
 public void Stop()
 {
     if (this.m_cem != null)
     {
         AmClusterMonitor.Tracer.TraceDebug(0L, "Stopping AmClusterEventManager");
         this.m_cem.Stop();
         this.m_cem   = null;
         this.Cluster = null;
         if (AmSystemManager.Instance.NetworkMonitor != null)
         {
             AmSystemManager.Instance.NetworkMonitor.UseCluster(this.Cluster);
             return;
         }
     }
     else
     {
         AmClusterMonitor.Tracer.TraceDebug(0L, "Ignoring cluster event manager stop since it is not active");
     }
 }
示例#24
0
        public static Dictionary <string, AmClusterNetwork> GetIpv6AutoCfgNetworkMap(IAmCluster cluster, string[] ipv6Networks)
        {
            Dictionary <string, AmClusterNetwork> dictionary = new Dictionary <string, AmClusterNetwork>(8);

            foreach (string text in ipv6Networks)
            {
                AmClusterNetwork amClusterNetwork = cluster.FindNetworkByName(text, IPVersion.IPv6);
                if (amClusterNetwork == null)
                {
                    throw new FailedToFindNetwork(text);
                }
                if (!amClusterNetwork.SupportsIPv6AutoConfiguration())
                {
                    throw new RequestedNetworkIsNotIPv6Enabled(text);
                }
                dictionary[text] = amClusterNetwork;
            }
            return(dictionary);
        }
示例#25
0
        public static void ValidateIpv6Networks(IAmCluster cluster, string[] ipv6Networks)
        {
            for (int i = 0; i < ipv6Networks.Length - 1; i++)
            {
                for (int j = i + 1; j < ipv6Networks.Length; j++)
                {
                    if (SharedHelper.StringIEquals(ipv6Networks[i], ipv6Networks[j]))
                    {
                        throw new IPv6NetworksHasDuplicateEntries(ipv6Networks[i]);
                    }
                }
            }
            Dictionary <string, AmClusterNetwork> ipv6AutoCfgNetworkMap = AmClusterResourceHelper.GetIpv6AutoCfgNetworkMap(cluster, ipv6Networks);

            if (ipv6AutoCfgNetworkMap != null)
            {
                SharedHelper.DisposeObjectList <AmClusterNetwork>(ipv6AutoCfgNetworkMap.Values);
            }
        }
示例#26
0
 // Token: 0x060008B8 RID: 2232 RVA: 0x00029E34 File Offset: 0x00028034
 private static void AddDagClusterNodeInternal(HaTaskStringBuilderOutputHelper output, AmServerName mailboxServerName, out string verboseLog)
 {
     try
     {
         Exception ex = null;
         output.AppendLogMessage("Opening a local AmCluster handle.", new object[0]);
         using (IAmCluster amCluster = ClusterFactory.Instance.Open())
         {
             output.WriteProgressSimple(ReplayStrings.DagTaskAddingServerToDag(mailboxServerName.NetbiosName, amCluster.Name));
             GCHandle value = GCHandle.Alloc(output);
             try
             {
                 output.LastException = null;
                 output.MaxPercentageDuringCallback = 0;
                 amCluster.AddNodeToCluster(mailboxServerName, output, GCHandle.ToIntPtr(value), out ex, true);
             }
             finally
             {
                 value.Free();
             }
         }
         if (output.LastException != null)
         {
             output.WriteErrorSimple(output.LastException);
         }
         if (ex != null)
         {
             output.WriteErrorSimple(ex);
         }
         output.WriteProgressSimple(ReplayStrings.DagTaskJoinedNodeToCluster(mailboxServerName.NetbiosName));
     }
     catch (LocalizedException exception)
     {
         DagHelper.ThrowDagTaskOperationWrapper(exception);
     }
     finally
     {
         verboseLog = output.ToString();
     }
 }
示例#27
0
 // Token: 0x060008AD RID: 2221 RVA: 0x000296B0 File Offset: 0x000278B0
 private static void SetFswSharePath(ITaskOutputHelper output, IAmCluster cluster, IAmClusterResource fsw, string fswShare)
 {
     try
     {
         fsw.OfflineResource();
         fsw.SetPrivateProperty <string>("SharePath", fswShare);
         fsw.OnlineResource();
     }
     catch (ClusterException ex)
     {
         Win32Exception ex2 = null;
         if (ex.TryGetTypedInnerException(out ex2))
         {
             output.AppendLogMessage("SetFswSharePath() caught an AmClusterApiException with errorcode={0} and NativeErrorCode={1}. ex = {2}", new object[]
             {
                 ex2.ErrorCode,
                 ex2.NativeErrorCode,
                 ex2
             });
             if (ex2.NativeErrorCode == 5)
             {
                 string text = cluster.CnoName;
                 if (text == string.Empty)
                 {
                     using (IAmClusterGroup amClusterGroup = cluster.FindCoreClusterGroup())
                     {
                         if (amClusterGroup != null && amClusterGroup.OwnerNode != null)
                         {
                             text = amClusterGroup.OwnerNode.NetbiosName;
                         }
                     }
                 }
                 output.WriteErrorSimple(new DagTaskFswNeedsCnoPermissionException(fswShare, text));
             }
         }
         throw;
     }
 }
示例#28
0
        private bool IsNodePubliclyUp(AmNetworkMonitor.Node node)
        {
            IAmCluster cluster = this.GetCluster();

            if (cluster == null)
            {
                AmNetworkMonitor.Tracer.TraceError <AmServerName>(0L, "If cluster object is not valid, then assume node {0} is up", node.Name);
                return(true);
            }
            Exception   ex;
            AmNodeState nodeState = cluster.GetNodeState(node.Name, out ex);

            if (ex != null)
            {
                return(false);
            }
            if (!AmClusterNode.IsNodeUp(nodeState))
            {
                return(false);
            }
            AmClusterNodeNetworkStatus amClusterNodeNetworkStatus = AmClusterNodeStatusAccessor.Read(cluster, node.Name, out ex);

            return(amClusterNodeNetworkStatus == null || amClusterNodeNetworkStatus.HasADAccess);
        }
示例#29
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)
                    {
                    }
                }
            }
        }
示例#30
0
 // Token: 0x0600043D RID: 1085 RVA: 0x000168A4 File Offset: 0x00014AA4
 internal AmClusterDbState(IAmCluster cluster)
 {
     this.m_cluster = cluster;
     this.InitializeHandles();
 }