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);
        }
        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);
        }
Example #3
0
        // Token: 0x060000E2 RID: 226 RVA: 0x00006554 File Offset: 0x00004754
        public void ReportHasADAccess(bool hasAccess)
        {
            bool flag = false;
            AmClusterNodeNetworkStatus amClusterNodeNetworkStatus = new AmClusterNodeNetworkStatus();

            amClusterNodeNetworkStatus.HasADAccess = hasAccess;
            if (this.Cluster == null || this.m_cem == null)
            {
                AmClusterMonitor.Tracer.TraceError(0L, "ReportHasADAccess fails because we aren't initialized or running in a DAG");
                return;
            }
            try
            {
                using (AmClusterNodeStatusAccessor amClusterNodeStatusAccessor = new AmClusterNodeStatusAccessor(this.Cluster, AmServerName.LocalComputerName, DxStoreKeyAccessMode.CreateIfNotExist))
                {
                    AmClusterNodeNetworkStatus amClusterNodeNetworkStatus2 = amClusterNodeStatusAccessor.Read();
                    if (amClusterNodeNetworkStatus2 != null)
                    {
                        if (amClusterNodeNetworkStatus2.ClusterErrorOverride && amClusterNodeNetworkStatus.HasADAccess && !AmSystemManager.Instance.NetworkMonitor.AreAnyMapiNicsUp(AmServerName.LocalComputerName))
                        {
                            amClusterNodeNetworkStatus.ClusterErrorOverride = true;
                        }
                        if (!amClusterNodeNetworkStatus.IsEqual(amClusterNodeNetworkStatus2))
                        {
                            flag = true;
                        }
                    }
                    else
                    {
                        flag = true;
                    }
                    if (flag)
                    {
                        amClusterNodeStatusAccessor.Write(amClusterNodeNetworkStatus);
                    }
                }
                if (flag)
                {
                    if (amClusterNodeNetworkStatus.IsHealthy)
                    {
                        if (amClusterNodeNetworkStatus.ClusterErrorOverride)
                        {
                            ReplayCrimsonEvents.AmMapiAccessExpectedByAD.Log();
                        }
                        else
                        {
                            ReplayCrimsonEvents.AmADStatusRecordedAsAccessible.Log();
                        }
                    }
                    else
                    {
                        ReplayCrimsonEvents.AmADStatusRecordedAsFailed.Log();
                    }
                }
            }
            catch (ClusterException ex)
            {
                AmClusterMonitor.Tracer.TraceError <ClusterException>(0L, "ReportNodeState failed: {0}", ex);
                ReplayCrimsonEvents.AmNodeStatusUpdateFailed.Log <AmClusterNodeNetworkStatus, string>(amClusterNodeNetworkStatus, ex.Message);
            }
            catch (SerializationException ex2)
            {
                AmClusterMonitor.Tracer.TraceError <SerializationException>(0L, "ReportNodeState failed: {0}", ex2);
                ReplayCrimsonEvents.AmNodeStatusUpdateFailed.Log <AmClusterNodeNetworkStatus, string>(amClusterNodeNetworkStatus, ex2.ToString());
            }
        }