Esempio n. 1
0
        // Token: 0x060001AD RID: 429 RVA: 0x0000A918 File Offset: 0x00008B18
        internal void ReportSystemEvent(AmSystemEventCode eventCode, string reportingServer)
        {
            AmTrace.Debug("ReportSystemEvent({0},{1}) called", new object[]
            {
                eventCode,
                reportingServer
            });
            ReplayCrimsonEvents.SystemEventReported.Log <AmSystemEventCode, string>(eventCode, reportingServer);
            ActiveManagerCore.ValidatePamOrStandalone("ReportSystemEvent");
            AmServerName amServerName = new AmServerName(reportingServer);

            AmSystemManager.Instance.StoreStateMarker.SetStoreState(amServerName, eventCode);
            if (eventCode == AmSystemEventCode.StoreServiceStarted)
            {
                AmEvtStoreServiceStarted amEvtStoreServiceStarted = new AmEvtStoreServiceStarted(amServerName);
                amEvtStoreServiceStarted.Notify();
                return;
            }
            if (eventCode == AmSystemEventCode.StoreServiceStopped)
            {
                new AmEvtStoreServiceStopped(amServerName)
                {
                    IsGracefulStop = true
                }.Notify();
                return;
            }
            if (eventCode == AmSystemEventCode.StoreServiceUnexpectedlyStopped)
            {
                new AmEvtStoreServiceStopped(amServerName)
                {
                    IsGracefulStop = false
                }.Notify();
            }
        }
Esempio n. 2
0
        // Token: 0x060001AF RID: 431 RVA: 0x0000AA50 File Offset: 0x00008C50
        internal void RemountDatabase(Guid mdbGuid, MountFlags mountFlags, DatabaseMountDialOverride mountDialOverride, AmServerName fromServer, AmDbActionCode actionCode)
        {
            AmTrace.Debug("RemountDatabase ({0},{1},{2},{3},{4}) called", new object[]
            {
                mdbGuid,
                mountFlags,
                mountDialOverride,
                fromServer,
                actionCode
            });
            ActiveManagerCore.ValidatePamOrStandalone("RemountDatabase");
            IADDatabase iaddatabase = this.AdLookup.DatabaseLookup.FindAdObjectByGuidEx(mdbGuid, AdObjectLookupFlags.ReadThrough);

            if (iaddatabase == null)
            {
                throw new AmDatabaseNotFoundException(mdbGuid);
            }
            AmDbRemountOperation amDbRemountOperation = new AmDbRemountOperation(iaddatabase, actionCode);

            amDbRemountOperation.Flags             = mountFlags;
            amDbRemountOperation.MountDialOverride = mountDialOverride;
            amDbRemountOperation.FromServer        = fromServer;
            amDbRemountOperation.Enqueue();
            AmDbCompletionReason amDbCompletionReason = amDbRemountOperation.Wait();

            AmTrace.Debug("RemountDatabase({0}) completed (reason={1})", new object[]
            {
                mdbGuid,
                amDbCompletionReason
            });
        }
Esempio n. 3
0
        // Token: 0x060001A7 RID: 423 RVA: 0x0000A4FC File Offset: 0x000086FC
        internal void DismountDatabase(Guid mdbGuid, UnmountFlags flags, AmDbActionCode actionCode)
        {
            AmTrace.Debug("Task: DismountDatabase({0},{1},{2}) called", new object[]
            {
                mdbGuid,
                flags,
                actionCode
            });
            ActiveManagerCore.ValidatePamOrStandalone("DismountDatabase");
            IADDatabase iaddatabase = this.AdLookup.DatabaseLookup.FindAdObjectByGuidEx(mdbGuid, AdObjectLookupFlags.ReadThrough);

            if (iaddatabase == null)
            {
                throw new AmDatabaseNotFoundException(mdbGuid);
            }
            AmDbDismountOperation amDbDismountOperation = new AmDbDismountOperation(iaddatabase, actionCode);

            amDbDismountOperation.Flags = flags;
            amDbDismountOperation.Enqueue();
            AmDbCompletionReason amDbCompletionReason = amDbDismountOperation.Wait();

            AmTrace.Debug("DismountDatabase({0}) completed (reason={1})", new object[]
            {
                mdbGuid,
                amDbCompletionReason
            });
        }
Esempio n. 4
0
        // Token: 0x060001A8 RID: 424 RVA: 0x0000A59C File Offset: 0x0000879C
        internal void MoveDatabase(Guid mdbGuid, MountFlags mountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialOverride, AmServerName fromServer, AmServerName targetServer, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, AmDbActionCode actionCode, string moveComment, ref AmDatabaseMoveResult databaseMoveResult)
        {
            AmTrace.Debug("Task: MoveDatabase({0},{1},{2},{3},{4},{5},{6},{7},'{8}') called", new object[]
            {
                mdbGuid,
                mountFlags,
                dismountFlags,
                mountDialOverride,
                fromServer,
                targetServer,
                tryOtherHealthyServers,
                actionCode,
                moveComment
            });
            ActiveManagerCore.ValidatePamOrStandalone("MoveDatabase");
            ThirdPartyManager.PreventOperationWhenTPREnabled("MoveDatabase");
            IADDatabase iaddatabase = this.AdLookup.DatabaseLookup.FindAdObjectByGuidEx(mdbGuid, AdObjectLookupFlags.ReadThrough);

            if (iaddatabase == null)
            {
                throw new AmDatabaseNotFoundException(mdbGuid);
            }
            AmDbMoveOperation    amDbMoveOperation    = new AmDbMoveOperation(iaddatabase, actionCode);
            AmDbMoveArguments    arguments            = amDbMoveOperation.Arguments;
            AmDbCompletionReason amDbCompletionReason = AmDbCompletionReason.None;

            arguments.MountFlags             = mountFlags;
            arguments.DismountFlags          = dismountFlags;
            arguments.MountDialOverride      = mountDialOverride;
            arguments.SourceServer           = fromServer;
            arguments.TargetServer           = targetServer;
            arguments.TryOtherHealthyServers = tryOtherHealthyServers;
            arguments.SkipValidationChecks   = skipValidationChecks;
            arguments.MoveComment            = moveComment;
            amDbMoveOperation.Arguments      = arguments;
            amDbMoveOperation.Enqueue();
            try
            {
                amDbCompletionReason = amDbMoveOperation.Wait();
            }
            finally
            {
                if (amDbMoveOperation.DetailedStatus != null)
                {
                    databaseMoveResult = amDbMoveOperation.ConvertDetailedStatusToRpcMoveResult(amDbMoveOperation.DetailedStatus);
                }
            }
            AmTrace.Debug("MoveDatabase({0}) completed (reason={1})", new object[]
            {
                mdbGuid,
                amDbCompletionReason
            });
        }
Esempio n. 5
0
        // Token: 0x060001AA RID: 426 RVA: 0x0000A74C File Offset: 0x0000894C
        internal List <AmDatabaseMoveResult> ServerMoveAllDatabases(AmServerName sourceServer, AmServerName targetServer, MountFlags mountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialOverride, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, AmDbActionCode actionCode, string moveComment, string componentName)
        {
            AmTrace.Debug("ServerMoveAllDatabases() called: sourceServer='{0}', targetServer='{1}', mountFlags='{2}', dismountFlags='{3}', mountDialOverride='{4}', tryOtherHealthyServers='{5}', skipValidationChecks='{6}', actionCode='{7}', MoveComment='{8}' Component='{9}'", new object[]
            {
                sourceServer,
                targetServer,
                mountFlags,
                dismountFlags,
                mountDialOverride,
                tryOtherHealthyServers,
                skipValidationChecks,
                actionCode,
                moveComment,
                componentName
            });
            ActiveManagerCore.ValidatePamOrStandalone("ServerMoveAllDatabases");
            ThirdPartyManager.PreventOperationWhenTPREnabled("ServerMoveAllDatabases");
            AmDbMoveArguments amDbMoveArguments = new AmDbMoveArguments(actionCode);

            amDbMoveArguments.SourceServer           = sourceServer;
            amDbMoveArguments.TargetServer           = targetServer;
            amDbMoveArguments.MountFlags             = mountFlags;
            amDbMoveArguments.DismountFlags          = dismountFlags;
            amDbMoveArguments.MountDialOverride      = mountDialOverride;
            amDbMoveArguments.TryOtherHealthyServers = tryOtherHealthyServers;
            amDbMoveArguments.SkipValidationChecks   = skipValidationChecks;
            amDbMoveArguments.MoveComment            = moveComment;
            amDbMoveArguments.ComponentName          = componentName;
            if (string.IsNullOrEmpty(sourceServer.Fqdn))
            {
                return(MoveBackToServer.Move(amDbMoveArguments));
            }
            AmEvtMoveAllDatabasesBase amEvtMoveAllDatabasesBase;

            if (actionCode.IsAutomaticManagedAvailabilityFailover)
            {
                amEvtMoveAllDatabasesBase = new AmEvtMoveAllDatabasesOnComponentRequest(sourceServer);
            }
            else
            {
                amEvtMoveAllDatabasesBase = new AmEvtMoveAllDatabasesOnAdminRequest(sourceServer);
            }
            amEvtMoveAllDatabasesBase.MoveArgs = amDbMoveArguments;
            amEvtMoveAllDatabasesBase.Notify();
            amEvtMoveAllDatabasesBase.WaitForSwitchoverComplete();
            AmTrace.Debug("ServerMoveAllDatabases({0}) completed", new object[]
            {
                sourceServer
            });
            return(amEvtMoveAllDatabasesBase.GetMoveResultsForOperationsRun());
        }
Esempio n. 6
0
        // Token: 0x060001A9 RID: 425 RVA: 0x0000A6F4 File Offset: 0x000088F4
        internal void ServerSwitchOver(AmServerName sourceServer)
        {
            AmTrace.Debug("ServerSwitchover({0}) called", new object[]
            {
                sourceServer
            });
            ActiveManagerCore.ValidatePamOrStandalone("ServerSwitchOver");
            AmEvtSwitchoverOnShutdown amEvtSwitchoverOnShutdown = new AmEvtSwitchoverOnShutdown(sourceServer);

            amEvtSwitchoverOnShutdown.Notify();
            amEvtSwitchoverOnShutdown.WaitForSwitchoverComplete();
            AmTrace.Debug("ServerSwitchover({0}) completed", new object[]
            {
                sourceServer
            });
        }
Esempio n. 7
0
 public AmRpcServerWrapper(ActiveManagerCore amInstance)
 {
     this.m_amInstance = amInstance;
 }
Esempio n. 8
0
 // Token: 0x060001B5 RID: 437 RVA: 0x0000B2D8 File Offset: 0x000094D8
 internal List <AmDeferredRecoveryEntry> GetDeferredRecoveryEntries()
 {
     ActiveManagerCore.ValidateForCurrentRole(false, "GetDeferredRecoveryEntries");
     return(AmSystemManager.Instance.TransientFailoverSuppressor.GetEntriesForTask());
 }
Esempio n. 9
0
 // Token: 0x060001A3 RID: 419 RVA: 0x0000A34C File Offset: 0x0000854C
 internal static void ValidatePamOrStandalone(string operation)
 {
     ActiveManagerCore.ValidateForCurrentRole(true, operation);
 }
Esempio n. 10
0
        private IADDatabase[] GetDatabasesToMonitor()
        {
            List <IADDatabase> list = new List <IADDatabase>();

            try
            {
                IADServer localServer = this.adConfig.GetLocalServer();
                if (localServer != null)
                {
                    IEnumerable <IADDatabase> databasesOnServer = this.adConfig.GetDatabasesOnServer(localServer);
                    if (databasesOnServer == null)
                    {
                        goto IL_CF;
                    }
                    using (IEnumerator <IADDatabase> enumerator = databasesOnServer.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            IADDatabase iaddatabase = enumerator.Current;
                            try
                            {
                                string name;
                                ActiveManagerCore.GetDatabaseMountStatus(iaddatabase.Guid, out name);
                                if (string.IsNullOrEmpty(name))
                                {
                                    name = iaddatabase.Server.Name;
                                }
                                if (Cluster.StringIEquals(name, localServer.Name))
                                {
                                    list.Add(iaddatabase);
                                }
                            }
                            catch (AmGetFqdnFailedNotFoundException ex)
                            {
                                AmTrace.Error("RegistryMonitor.GetDatabasesToMonitor ignoring db {0} due to {1}", new object[]
                                {
                                    iaddatabase.Guid,
                                    ex
                                });
                            }
                        }
                        goto IL_CF;
                    }
                }
                AmTrace.Warning("FindLocalServer() failed.", new object[0]);
                IL_CF :;
            }
            catch (AmCommonTransientException ex2)
            {
                AmTrace.Warning("GetDatabasesToMonitor() failed with {0}", new object[]
                {
                    ex2
                });
            }
            catch (ADTransientException ex3)
            {
                AmTrace.Warning("GetDatabasesToMonitor() failed with {0}", new object[]
                {
                    ex3
                });
            }
            catch (ADExternalException ex4)
            {
                AmTrace.Warning("GetDatabasesToMonitor() failed with {0}", new object[]
                {
                    ex4
                });
            }
            catch (ADOperationException ex5)
            {
                AmTrace.Warning("GetDatabasesToMonitor() failed with {0}", new object[]
                {
                    ex5
                });
            }
            catch (ClusterException ex6)
            {
                AmTrace.Warning("GetDatabasesToMonitor() failed with {0}", new object[]
                {
                    ex6
                });
            }
            return(list.ToArray());
        }
Esempio n. 11
0
        // Token: 0x0600045A RID: 1114 RVA: 0x00016E6C File Offset: 0x0001506C
        public static bool TryStart(ActiveManagerCore amInstance)
        {
            bool fRpcServerStarted;

            lock (AmRpcServer.m_locker)
            {
                if (!AmRpcServer.m_fRpcServerStarted)
                {
                    AmTrace.Debug("Starting Active Manager Rpc", new object[0]);
                    AmRpcServer.m_amInstance = amInstance;
                    try
                    {
                        FileSecurity activeManagerRpcSecurity = Microsoft.Exchange.Cluster.Replay.ObjectSecurity.ActiveManagerRpcSecurity;
                        if (activeManagerRpcSecurity != null)
                        {
                            AmRpcServer.m_rpcServer = (AmRpcServer)RpcServerBase.RegisterServer(typeof(AmRpcServer), activeManagerRpcSecurity, 1, false, (uint)RegistryParameters.MaximumRpcThreadCount);
                            if (AmRpcServer.m_rpcServer != null)
                            {
                                AmTrace.Debug("Active Manager Rpc server successfully started.", new object[0]);
                                AmRpcServer.m_fRpcServerStarted = true;
                            }
                        }
                        if (AmRpcServer.m_rpcServer == null)
                        {
                            AmTrace.Error("Active Manager Rpc server failed to start!", new object[0]);
                            ReplayEventLogConstants.Tuple_AmRpcServerFailedToStart.LogEvent(null, new object[0]);
                        }
                        goto IL_1BF;
                    }
                    catch (RpcException ex)
                    {
                        AmTrace.Error("RPC Error occurred while trying to register the Active Manager RPC Server. Exception: {0}", new object[]
                        {
                            ex.ToString()
                        });
                        ReplayEventLogConstants.Tuple_AmRpcServerFailedToRegister.LogEvent(null, new object[]
                        {
                            ex.Message
                        });
                        goto IL_1BF;
                    }
                    catch (ADTransientException ex2)
                    {
                        AmTrace.Error("Transient exception occurred while retrieving the ActiveManagerRpcSecurity object. Exception: {0}", new object[]
                        {
                            ex2.ToString()
                        });
                        ReplayEventLogConstants.Tuple_AmRpcServerFailedToFindExchangeServersUsg.LogEvent(null, new object[]
                        {
                            ex2.Message
                        });
                        goto IL_1BF;
                    }
                    catch (ADExternalException ex3)
                    {
                        AmTrace.Error("Start(): Permanent exception occurred while retrieving the ActiveManagerRpcSecurity object. Exception: {0}", new object[]
                        {
                            ex3.ToString()
                        });
                        ReplayEventLogConstants.Tuple_AmRpcServerFailedToFindExchangeServersUsg.LogEvent(null, new object[]
                        {
                            ex3.Message
                        });
                        goto IL_1BF;
                    }
                    catch (ADOperationException ex4)
                    {
                        AmTrace.Error("Start(): Permanent exception occurred while retrieving the ActiveManagerRpcSecurity object. Exception: {0}", new object[]
                        {
                            ex4.ToString()
                        });
                        ReplayEventLogConstants.Tuple_AmRpcServerFailedToFindExchangeServersUsg.LogEvent(null, new object[]
                        {
                            ex4.Message
                        });
                        goto IL_1BF;
                    }
                }
                AmTrace.Debug("Active Manager RPC server already started.", new object[0]);
IL_1BF:
                fRpcServerStarted = AmRpcServer.m_fRpcServerStarted;
            }
            return(fRpcServerStarted);
        }