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);
        }
        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;
            }
        }
示例#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());
            }
        }