Esempio n. 1
0
        // Token: 0x0600139F RID: 5023 RVA: 0x0004FB70 File Offset: 0x0004DD70
        private string GetSiteName(CopyStatusClientCachedEntry status)
        {
            IADServer iadserver = this.m_adConfig.LookupMiniServerByName(status.ServerContacted);
            string    text      = null;

            if (iadserver != null && iadserver.ServerSite != null)
            {
                text = iadserver.ServerSite.Name;
            }
            DatabaseValidatorBase.Tracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "DatabaseValidatorBase: GetSiteName() for copy '{0}\\{1}' : AD Site name is '{2}'.", this.Database.Name, status.ServerContacted.NetbiosName, text ?? "<null>");
            return(text);
        }
Esempio n. 2
0
        // Token: 0x06000F48 RID: 3912 RVA: 0x00041D40 File Offset: 0x0003FF40
        private static bool IsSafetyNetRedeliveryRpcSupportedOnHubServer(string hubServerName, IMonitoringADConfig adConfig, out Exception exception)
        {
            exception = null;
            IADServer iadserver = adConfig.LookupMiniServerByName(new AmServerName(hubServerName));

            if (iadserver == null)
            {
                exception = new DumpsterCouldNotFindHubServerException(hubServerName);
                return(false);
            }
            return(SafetyNetVersionChecker.IsSafetyNetRedeliveryRpcSupportedOnHubServer(iadserver.AdminDisplayVersion));
        }
        public static void ConstructAllLocalConfigurations(IADConfig adConfig, ActiveManager activeManager, out List <ReplayConfiguration> currentSourceConfigurations, out List <ReplayConfiguration> currentRemoteTargetConfigurations, out List <KeyValuePair <IADDatabase, Exception> > failedConfigurations)
        {
            currentSourceConfigurations       = new List <ReplayConfiguration>(20);
            currentRemoteTargetConfigurations = new List <ReplayConfiguration>(48);
            failedConfigurations = new List <KeyValuePair <IADDatabase, Exception> >();
            if (activeManager == null)
            {
                activeManager = ActiveManager.GetNoncachingActiveManagerInstance();
            }
            IADServer localServer = adConfig.GetLocalServer();

            if (localServer == null)
            {
                ReplayConfiguration.Tracer.TraceError(0L, "ConstructAllLocalConfigurations: didn't find local server");
                return;
            }
            IEnumerable <IADDatabase> databasesOnLocalServer = adConfig.GetDatabasesOnLocalServer();

            if (databasesOnLocalServer == null)
            {
                ReplayConfiguration.Tracer.TraceError(0L, "There are no mailbox dbs on this server");
                return;
            }
            IADDatabaseAvailabilityGroup localDag = adConfig.GetLocalDag();

            foreach (IADDatabase iaddatabase in databasesOnLocalServer)
            {
                Exception           ex = null;
                bool                flag;
                ReplayConfiguration replayConfiguration = ReplayConfiguration.GetReplayConfiguration(localDag, iaddatabase, localServer, activeManager, out flag, out ex);
                if (replayConfiguration != null)
                {
                    if (flag)
                    {
                        currentSourceConfigurations.Add(replayConfiguration);
                    }
                    else
                    {
                        currentRemoteTargetConfigurations.Add(replayConfiguration);
                    }
                }
                else if (ex != null)
                {
                    ReplayConfiguration.Tracer.TraceError <Guid, string>(0L, "ReplayConfiguration for database '{0}' was not created due to an Exception. The configuration will not be added to the list of possible instances to run. Exception: {1}", iaddatabase.Guid, ex.ToString());
                    failedConfigurations.Add(new KeyValuePair <IADDatabase, Exception>(iaddatabase, ex));
                }
                else
                {
                    ReplayConfiguration.Tracer.TraceError <string>(0L, "ConstructAllLocalConfigurations() did not find a ReplayConfiguration for database '{0}' and no error occurred.", iaddatabase.Name);
                }
            }
        }
Esempio n. 4
0
 // Token: 0x0600150A RID: 5386 RVA: 0x0005366C File Offset: 0x0005186C
 private void AddServerIfNeeded(AmServerName serverToAdd, IADServer miniServerToAdd)
 {
     if (!this.m_miniServerLookup.ContainsKey(serverToAdd))
     {
         this.m_miniServerLookup.Add(serverToAdd, miniServerToAdd);
         this.m_serverList.Add(miniServerToAdd);
         this.m_amServerNameList.Add(serverToAdd);
     }
     if (!this.m_amServerLookup.ContainsKey(serverToAdd.NetbiosName))
     {
         this.m_amServerLookup.Add(serverToAdd.NetbiosName, serverToAdd);
     }
 }
Esempio n. 5
0
        // Token: 0x0600150E RID: 5390 RVA: 0x00053734 File Offset: 0x00051934
        protected virtual IADServer LookupMiniServer(string serverShortName)
        {
            Exception ex        = null;
            IADServer iadserver = this.AdLookup.MiniServerLookup.FindMiniServerByShortNameEx(serverShortName, out ex);

            if (iadserver == null)
            {
                MonitoringADConfig.Tracer.TraceError <string, string>((long)this.GetHashCode(), "LookupMiniServer( {0} ): Got exception: {1}", serverShortName, AmExceptionHelper.GetExceptionToStringOrNoneString(ex));
                throw new MonitoringCouldNotFindMiniServerException(serverShortName, ex);
            }
            MonitoringADConfig.Tracer.TraceDebug <string>((long)this.GetHashCode(), "LookupMiniServer( {0} ): Found MiniServer object.", serverShortName);
            return(iadserver);
        }
 public IADDatabaseAvailabilityGroup FindDagByServer(IADServer server)
 {
     if (server != null)
     {
         ADObjectId databaseAvailabilityGroup = server.DatabaseAvailabilityGroup;
         if (databaseAvailabilityGroup != null && !databaseAvailabilityGroup.IsDeleted)
         {
             DatabaseAvailabilityGroup dag = this.m_session.Read <DatabaseAvailabilityGroup>(databaseAvailabilityGroup);
             return(ADObjectWrapperFactory.CreateWrapper(dag));
         }
     }
     return(null);
 }
        public IADServer FindMiniServerByShortNameEx(string shortName, out Exception ex)
        {
            IADServer result = null;

            ex = ADUtils.RunADOperation(delegate()
            {
                result = this.AdSession.FindMiniServerByName(shortName);
            }, 2);
            if (ex != null)
            {
                SimpleMiniServerLookup.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "SimpleMiniServerLookup.FindMiniServerByFqdn got an exception: {0}", ex);
            }
            return(result);
        }
Esempio n. 8
0
        public static bool IsAutoActivationAllowed(IADServer sourceServer, IADServer targetServer, out LocalizedString error)
        {
            string name  = sourceServer.Name;
            string name2 = targetServer.Name;

            error = LocalizedString.Empty;
            if (SharedHelper.StringIEquals(name, name2))
            {
                AmTrace.Debug("IsAutoActivationAllowed: Skipping check since source == target. TargetServer: {0}", new object[]
                {
                    name2
                });
                return(true);
            }
            switch (targetServer.DatabaseCopyAutoActivationPolicy)
            {
            case DatabaseCopyAutoActivationPolicyType.Unrestricted:
                return(true);

            case DatabaseCopyAutoActivationPolicyType.IntrasiteOnly:
                if (!targetServer.ServerSite.Equals(sourceServer.ServerSite))
                {
                    AmTrace.Debug("IsAutoActivationAllowed: Rejecting server '{0}' (Site={1}) because it is in a different site from source server '{2}' (Site={2}). ", new object[]
                    {
                        name2,
                        targetServer.ServerSite.Name,
                        name,
                        sourceServer.ServerSite.Name
                    });
                    error = ReplayStrings.AmBcsTargetServerActivationIntraSite(targetServer.Fqdn, sourceServer.Fqdn, targetServer.ServerSite.Name, sourceServer.ServerSite.Name);
                    return(false);
                }
                return(true);

            case DatabaseCopyAutoActivationPolicyType.Blocked:
                AmTrace.Debug("IsAutoActivationAllowed: Rejecting server '{0}' because it is activation policy Blocked.", new object[]
                {
                    name2
                });
                error = ReplayStrings.AmBcsTargetServerActivationBlocked(targetServer.Fqdn);
                return(false);

            default:
                DiagCore.RetailAssert(false, "Unhandled case for DatabaseCopyAutoActivationPolicyType: {0}", new object[]
                {
                    targetServer.DatabaseCopyAutoActivationPolicy
                });
                return(false);
            }
        }
 public MiniServerCacheEntry(IADServer miniServer, TimeSpan timeToLive, TimeSpan timeToNegativeLive, TimeSpan timeToLiveMaximum)
 {
     this.m_timeRetrieved = DateTime.UtcNow;
     if (miniServer != null)
     {
         this.m_timeToExpire = this.m_timeRetrieved.Add(timeToLive);
     }
     else
     {
         this.m_timeToExpire = this.m_timeRetrieved.Add(timeToNegativeLive);
     }
     this.m_maximumTimeToExpire = this.m_timeRetrieved.Add(timeToLiveMaximum);
     this.m_miniServerData      = miniServer;
 }
Esempio n. 10
0
 // Token: 0x06001503 RID: 5379 RVA: 0x00053014 File Offset: 0x00051214
 protected void Refresh()
 {
     MonitoringADConfig.Tracer.TraceDebug <AmServerName>((long)this.GetHashCode(), "MonitoringADConfig.Refresh() called against server name '{0}' ...", this.m_targetServerName);
     this.CreateTimeUtc    = DateTime.UtcNow;
     this.TargetServerName = this.m_targetServerName;
     this.TargetMiniServer = this.LookupMiniServer(this.m_targetServerName.NetbiosName);
     this.CheckServiceShuttingDown();
     if (this.TargetMiniServer.DatabaseAvailabilityGroup == null)
     {
         this.ServerRole = MonitoringServerRole.Standalone;
         this.InitializeServerStructures(1);
         this.AddServerIfNeeded(this.TargetServerName, this.TargetMiniServer);
     }
     else
     {
         this.ServerRole = MonitoringServerRole.DagMember;
         this.Dag        = this.LookupDag(this.TargetMiniServer.DatabaseAvailabilityGroup);
         this.CheckServiceShuttingDown();
         bool flag = false;
         this.InitializeServerStructures(this.Dag.Servers.Count);
         foreach (ADObjectId adobjectId in this.Dag.Servers)
         {
             IADServer iadserver = this.LookupMiniServer(adobjectId.Name);
             MonitoringADConfig.Tracer.TraceDebug <DatabaseCopyAutoActivationPolicyType, bool>((long)this.GetHashCode(), "MonitoringADConfig.Refresh() : Values of DatabaseCopyAutoActivationPolicy={0},  DatabaseCopyActivationDisabledAndMoveNow={1}", iadserver.DatabaseCopyAutoActivationPolicy, iadserver.DatabaseCopyActivationDisabledAndMoveNow);
             this.AddServerIfNeeded(iadserver);
             if (iadserver.Guid.Equals(this.TargetMiniServer.Guid))
             {
                 flag = true;
             }
             this.CheckServiceShuttingDown();
         }
         if (!flag)
         {
             this.AddServerIfNeeded(this.TargetServerName, this.TargetMiniServer);
         }
     }
     MonitoringADConfig.hookableTestAddDbCopy.Value();
     this.LookupAndPopulateDatabases();
     DiagCore.RetailAssert(this.m_amServerNameList.Count == this.m_serverList.Count, "m_amServerNameList [{0}] != m_serverList [{1}], in length", new object[]
     {
         this.m_amServerNameList.Count,
         this.m_serverList.Count
     });
     DiagCore.RetailAssert(this.DatabaseMap.Keys.Count == this.m_serverList.Count, "DatabaseMap.Keys.Count [{0}] != m_serverList.Count [{1}]", new object[]
     {
         this.DatabaseMap.Count,
         this.m_serverList.Count
     });
     DiagCore.RetailAssert(this.DatabaseMap.ContainsKey(this.TargetServerName), "DatabaseMap should contain the target server entry!", new object[0]);
 }
        public IADServer ReadMiniServerByObjectId(ADObjectId serverId)
        {
            IADServer result = null;
            Exception ex     = ADUtils.RunADOperation(delegate()
            {
                result = this.AdSession.ReadMiniServer(serverId);
            }, 2);

            if (ex != null)
            {
                SimpleMiniServerLookup.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "SimpleMiniServerLookup.ReadMiniServerByObjectId got an exception: {0}", ex);
            }
            return(result);
        }
        // Token: 0x06000ED9 RID: 3801 RVA: 0x0003F5F4 File Offset: 0x0003D7F4
        public override TopologyInfo GetLocalServerTopology(bool isForceRefresh = false)
        {
            TopologyInfo           topologyInfo = null;
            IActiveManagerSettings settings     = DxStoreSetting.Instance.GetSettings();
            bool flag = settings.DxStoreRunMode != DxStoreMode.Disabled;

            if (isForceRefresh)
            {
                Dependencies.ADConfig.Refresh("Distributed store requesting for AD config refresh since members seem to have changed");
            }
            IADServer localServer = Dependencies.ADConfig.GetLocalServer();

            if (localServer != null)
            {
                topologyInfo = new TopologyInfo();
                if (flag && localServer.DatabaseAvailabilityGroup != null)
                {
                    IADDatabaseAvailabilityGroup localDag = Dependencies.ADConfig.GetLocalDag();
                    if (localDag != null)
                    {
                        topologyInfo.IsConfigured = true;
                        topologyInfo.Name         = localDag.Name;
                        if (this.fixedMemberServersMap.Count == 0)
                        {
                            SortedDictionary <string, string> fixedDagMembers = this.GetFixedDagMembers();
                            if (fixedDagMembers != null && fixedDagMembers.Count > 0)
                            {
                                this.fixedMemberServersMap = fixedDagMembers;
                                this.eventLogger.Log(DxEventSeverity.Info, 0, "Found fixed dag members {0}", new object[]
                                {
                                    string.Join(";", fixedDagMembers.Values)
                                });
                            }
                        }
                        if (this.fixedMemberServersMap.Count > 0)
                        {
                            topologyInfo.Members = this.fixedMemberServersMap.Keys.ToArray <string>();
                        }
                        else if (localDag.Servers != null)
                        {
                            topologyInfo.Members = (from s in localDag.Servers
                                                    select s.Name).ToArray <string>();
                        }
                        topologyInfo.IsAllMembersVersionCompatible = this.versionChecker.CheckVersionCompatibility();
                    }
                }
            }
            return(topologyInfo);
        }
Esempio n. 13
0
 internal static bool ShouldSkipDueToServerNotConfigured(IADServer server)
 {
     if (!RegistryParameters.AutoDagUseServerConfiguredProperty)
     {
         DiskReclaimerManager.Tracer.TraceDebug((long)server.GetHashCode(), "ShouldSkipDueToServerNotConfigured: Returning 'false' because regkey AutoDagUseServerConfiguredProperty is disabled.");
         return(false);
     }
     if (server.AutoDagServerConfigured)
     {
         DiskReclaimerManager.Tracer.TraceDebug((long)server.GetHashCode(), "ShouldSkipDueToServerNotConfigured: Returning 'false' because server's AD property AutoDagServerConfigured is 'true'.");
         return(false);
     }
     DiskReclaimerManager.Tracer.TraceDebug((long)server.GetHashCode(), "ShouldSkipDueToServerNotConfigured: Returning 'true' because server's AD property AutoDagServerConfigured is 'false'.");
     return(true);
 }
        public IEnumerable <IADDatabase> GetAllDatabases(IADServer server)
        {
            IEnumerable <DatabaseCopy> copies = this.GetAllRealDatabaseCopies(server);

            foreach (DatabaseCopy copy in copies)
            {
                ADObjectId  dbId     = ((ADObjectId)copy.Identity).Parent;
                IADDatabase database = this.ReadADObject <IADDatabase>(dbId);
                if (database != null)
                {
                    yield return(database);
                }
            }
            yield break;
        }
        // Token: 0x06000ED7 RID: 3799 RVA: 0x0003F508 File Offset: 0x0003D708
        public override string ResolveName(string shortServerName)
        {
            string text;

            if (this.fixedMemberServersMap.TryGetValue(shortServerName, out text) && !string.IsNullOrWhiteSpace(text))
            {
                return(text);
            }
            IADServer server = Dependencies.ADConfig.GetServer(shortServerName);

            if (server != null)
            {
                return(server.Fqdn);
            }
            return(null);
        }
Esempio n. 16
0
        // Token: 0x06000851 RID: 2129 RVA: 0x00028398 File Offset: 0x00026598
        public IADServer GetServer(AmServerName serverName)
        {
            IMonitoringADConfig currentConfig = this.GetCurrentConfig();

            if (currentConfig == null)
            {
                return(null);
            }
            IADServer iadserver = currentConfig.LookupMiniServerByName(serverName);

            if (iadserver == null)
            {
                iadserver = this.HandleMissingServer(serverName);
            }
            return(iadserver);
        }
Esempio n. 17
0
        // Token: 0x060006D7 RID: 1751 RVA: 0x00020C1C File Offset: 0x0001EE1C
        private bool IsAutoActivationAllowed(ref LocalizedString error)
        {
            if (this.ServerToCheck.Equals(this.SourceServer))
            {
                AmTrace.Debug("AmBcsServerValidation: Skipping 'IsAutoActivationAllowed' check since source == target. TargetServer: {0}", new object[]
                {
                    this.ServerToCheck
                });
                return(true);
            }
            Exception ex;
            IADServer miniServer = AmBestCopySelectionHelper.GetMiniServer(this.ServerToCheck, out ex);

            if (miniServer == null)
            {
                AmTrace.Error("AmBcsServerValidation: Rejecting server '{0}' for DB '{1}' because target MiniServer could not be read.", new object[]
                {
                    this.ServerToCheck,
                    this.Database.Name
                });
                error = ReplayStrings.AmBcsTargetServerADError(this.ServerToCheck.Fqdn, ex.ToString());
                this.ReportServerBlocked(AmBcsServerChecks.AutoActivationAllowed, error);
                return(false);
            }
            IADServer miniServer2 = AmBestCopySelectionHelper.GetMiniServer(this.SourceServer, out ex);

            if (miniServer2 == null)
            {
                AmTrace.Error("AmBcsServerValidation: Rejecting server '{0}' for DB '{1}' because source MiniServer '{2}' could not be read.", new object[]
                {
                    this.ServerToCheck,
                    this.Database.Name,
                    this.SourceServer
                });
                error = ReplayStrings.AmBcsSourceServerADError(this.SourceServer.Fqdn, ex.ToString());
                this.ReportServerBlocked(AmBcsServerChecks.AutoActivationAllowed, error);
                return(false);
            }
            if (!AmBestCopySelectionHelper.IsAutoActivationAllowed(miniServer2, miniServer, out error))
            {
                this.ReportServerBlocked(AmBcsServerChecks.AutoActivationAllowed, error);
                return(false);
            }
            return(true);
        }
        public IADServer ReadMiniServerByObjectId(ADObjectId serverId)
        {
            string name = serverId.Name;

            return(this.LookupOrFindMiniServer(name, delegate
            {
                IADServer result = null;
                Exception ex = ADUtils.RunADOperation(delegate()
                {
                    result = this.AdSession.ReadMiniServer(serverId);
                }, 2);
                if (ex != null)
                {
                    MiniServerLookupCache.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "MiniServerLookupCache.ReadMiniServerByObjectId got an exception: {0}", ex);
                }
                return result;
            }));
        }
Esempio n. 19
0
 // Token: 0x06001468 RID: 5224 RVA: 0x00051FCC File Offset: 0x000501CC
 protected override DatabaseValidationCheck.Result ValidateInternal(DatabaseValidationCheck.Arguments args, ref LocalizedString error)
 {
     if (!args.IgnoreActivationDisfavored)
     {
         AmServerName targetServer = args.TargetServer;
         IADServer    iadserver    = args.ADConfig.LookupMiniServerByName(targetServer);
         if (iadserver == null)
         {
             error = ReplayStrings.AmBcsTargetServerADError(args.TargetServer.Fqdn, ReplayStrings.AmBcsNoneSpecified);
             return(DatabaseValidationCheck.Result.Failed);
         }
         if (iadserver.DatabaseCopyActivationDisabledAndMoveNow)
         {
             error = ReplayStrings.AmBcsTargetServerActivationDisabled(args.ActiveServer.Fqdn);
             return(DatabaseValidationCheck.Result.Failed);
         }
     }
     return(DatabaseValidationCheck.Result.Passed);
 }
 // Token: 0x06000C44 RID: 3140 RVA: 0x0003651C File Offset: 0x0003471C
 public static bool IsServerValidRcrTarget(IADDatabase database, IADServer server, out int maxDB, string sourceDomain, bool fThrow)
 {
     maxDB = 0;
     if (server == null)
     {
         throw new ArgumentNullException("server");
     }
     if (server.IsMailboxServer)
     {
         if (server.Edition == ServerEditionType.Enterprise || server.Edition == ServerEditionType.EnterpriseEvaluation)
         {
             maxDB = 100;
         }
         else
         {
             maxDB = 5;
         }
         IADDatabaseCopy[] databaseCopies = database.DatabaseCopies;
         int i = 0;
         while (i < databaseCopies.Length)
         {
             IADDatabaseCopy iaddatabaseCopy = databaseCopies[i];
             if (string.Equals(iaddatabaseCopy.HostServerName, server.Name))
             {
                 if (fThrow)
                 {
                     throw new InvalidRcrConfigAlreadyHostsDb(server.Name, database.Name);
                 }
                 return(false);
             }
             else
             {
                 i++;
             }
         }
         return(true);
     }
     if (fThrow)
     {
         throw new InvalidRcrConfigOnNonMailboxException(server.Name);
     }
     return(false);
 }
Esempio n. 21
0
        public static IADServer GetMiniServer(AmServerName serverName, out Exception exception)
        {
            Exception ex = null;

            exception = null;
            IADServer iadserver = Dependencies.ReplayAdObjectLookup.MiniServerLookup.FindMiniServerByShortNameEx(serverName.NetbiosName, out ex);

            if (iadserver == null)
            {
                exception = new FailedToFindServerException(serverName.Fqdn, ex);
                AmTrace.Error("GetMiniServer got back 'null' from FindMiniServerByName for server '{0}'. Returning Exception: {1}", new object[]
                {
                    serverName,
                    exception
                });
                ReplayCrimsonEvents.ADObjectLookupError.LogPeriodic <string, Exception>(serverName.NetbiosName, DiagCore.DefaultEventSuppressionInterval, exception.Message, ex);
            }
            return(iadserver);
        }
        public static List <string> GetServersWithServerRoleInSiteByServer(IADServer mailboxServer, ServerRole serverRole)
        {
            List <string> list = new List <string>();
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 328, "GetServersWithServerRoleInSiteByServer", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Replay\\Core\\ReplayConfiguration.cs");
            ADObjectId siteId = null;

            if (mailboxServer != null && mailboxServer.ServerSite != null)
            {
                siteId = mailboxServer.ServerSite;
            }
            try
            {
                QueryFilter            filter        = ReplayConfiguration.BuildServerFilterForSiteWithServerRole(siteId, serverRole);
                ADPagedReader <Server> adpagedReader = topologyConfigurationSession.FindPaged <Server>(null, QueryScope.SubTree, filter, null, 0);
                foreach (Server server in adpagedReader)
                {
                    if (mailboxServer != null && server.MajorVersion != mailboxServer.MajorVersion)
                    {
                        ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <string, int, int>(0L, "GetServersWithServerRoleInSiteByServer: Filtering Server {0}, major version {1} doesn't match {2}", server.Name, server.MajorVersion, mailboxServer.MajorVersion);
                    }
                    else
                    {
                        ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <string>(0L, "GetServersWithServerRoleInSiteByServer: Found Server {0}", server.Name);
                        list.Add(server.Name);
                    }
                }
                return(list);
            }
            catch (ADTransientException arg)
            {
                ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <ADTransientException>(0L, "GetServersWithServerRoleInSiteByServer: Exception {0}", arg);
            }
            catch (ADOperationException arg2)
            {
                ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <ADOperationException>(0L, "GetServersWithServerRoleInSiteByServer: Exception {0}", arg2);
            }
            catch (DataValidationException arg3)
            {
                ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <DataValidationException>(0L, "GetServersWithServerRoleInSiteByServer: Exception {0}", arg3);
            }
            return(list);
        }
        // Token: 0x06000EDB RID: 3803 RVA: 0x0003F7AC File Offset: 0x0003D9AC
        public Tuple <string, int>[] GetDagServerVersionsSorted()
        {
            List <Tuple <string, int> >  list     = new List <Tuple <string, int> >();
            IADDatabaseAvailabilityGroup localDag = Dependencies.ADConfig.GetLocalDag();

            if (localDag != null)
            {
                foreach (ADObjectId adobjectId in localDag.Servers)
                {
                    IADServer server = Dependencies.ADConfig.GetServer(adobjectId.Name);
                    if (server != null)
                    {
                        list.Add(new Tuple <string, int>(server.Name, server.AdminDisplayVersion.ToInt()));
                    }
                }
            }
            return((from t in list
                    orderby t.Item2
                    select t).ToArray <Tuple <string, int> >());
        }
        public IADServer FindMiniServerByShortNameEx(string shortName, out Exception ex)
        {
            Exception tempEx = null;
            IADServer result = this.LookupOrFindMiniServer(shortName, delegate
            {
                IADServer result = null;
                tempEx           = ADUtils.RunADOperation(delegate()
                {
                    result = this.AdSession.FindMiniServerByName(shortName);
                }, 2);
                if (tempEx != null)
                {
                    StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_ErrorActiveManagerClientADError, tempEx.Message, new object[0]);
                    MiniServerLookupCache.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "MiniServerLookupCache.FindMiniServerByFqdn got an exception: {0}", tempEx);
                }
                return(result);
            });

            ex = tempEx;
            return(result);
        }
Esempio n. 25
0
        // Token: 0x06001511 RID: 5393 RVA: 0x00053854 File Offset: 0x00051A54
        protected virtual IEnumerable <IADDatabaseCopy> LookupDatabaseCopies(IADServer miniServer)
        {
            MonitoringADConfig.Tracer.TraceDebug <string>((long)this.GetHashCode(), "LookupDatabases ( {0} ): Searching for all valid/invalid database copies...", miniServer.Name);
            IEnumerable <IADDatabaseCopy>  dbCopies  = null;
            IADToplogyConfigurationSession adSession = this.AdSessionPartiallyConsistent;
            Exception ex = ADUtils.RunADOperation(delegate()
            {
                dbCopies = adSession.GetAllDatabaseCopies(miniServer);
            }, 2);

            if (ex != null)
            {
                MonitoringADConfig.Tracer.TraceError <string, string>((long)this.GetHashCode(), "LookupDatabases ( {0} ): Got exception: {1}", miniServer.Name, AmExceptionHelper.GetExceptionToStringOrNoneString(ex));
                throw new MonitoringCouldNotFindDatabasesException(miniServer.Name, ex.Message, ex);
            }
            if (dbCopies == null)
            {
                dbCopies = new IADDatabaseCopy[0];
            }
            return(dbCopies);
        }
Esempio n. 26
0
 private static bool IsDatabasePendingRcrTarget(IADDatabase db, IADServer server)
 {
     if (db == null)
     {
         throw new ArgumentNullException("db");
     }
     if (server == null)
     {
         throw new ArgumentNullException("server");
     }
     if (!db.Recovery && server.IsMailboxServer && db.ReplicationType == ReplicationType.Remote)
     {
         foreach (IADDatabaseCopy iaddatabaseCopy in db.DatabaseCopies)
         {
             if (iaddatabaseCopy != null && iaddatabaseCopy.HostServer.ObjectGuid == server.Id.ObjectGuid)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 27
0
        // Token: 0x060006F4 RID: 1780 RVA: 0x00021394 File Offset: 0x0001F594
        private void PopulateMiniServersForDatabaseCopies()
        {
            if (this.m_miniServers != null)
            {
                return;
            }
            this.PopulateDatabaseCopiesIfNecessary();
            List <IADServer> list = new List <IADServer>(this.m_dbCopies.Length);
            Exception        ex   = null;

            foreach (IADDatabaseCopy iaddatabaseCopy in this.m_dbCopies)
            {
                AmServerName serverName = new AmServerName(iaddatabaseCopy.HostServerName);
                IADServer    miniServer = AmBestCopySelectionHelper.GetMiniServer(serverName, out ex);
                if (miniServer == null)
                {
                    throw ex;
                }
                list.Add(miniServer);
            }
            this.m_miniServers = list;
        }
Esempio n. 28
0
        // Token: 0x06000857 RID: 2135 RVA: 0x000284E4 File Offset: 0x000266E4
        public IEnumerable <IADDatabase> HandleMissingServerDatabases(AmServerName serverName)
        {
            ADConfig.Tracer.TraceError <AmServerName>((long)this.GetHashCode(), "Databases for server {0} not found", serverName);
            IReplayAdObjectLookup replayAdObjectLookup = Dependencies.ReplayAdObjectLookup;
            IADServer             iadserver            = replayAdObjectLookup.ServerLookup.FindServerByFqdn(serverName.Fqdn);

            if (iadserver != null)
            {
                this.Refresh("HandleMissingServerDatabases");
                IMonitoringADConfig currentConfig = this.GetCurrentConfig();
                if (currentConfig == null)
                {
                    return(null);
                }
                IEnumerable <IADDatabase> result = null;
                if (currentConfig.DatabaseMap.TryGetValue(serverName, out result))
                {
                    return(result);
                }
            }
            return(null);
        }
 // Token: 0x06001461 RID: 5217 RVA: 0x00051DA8 File Offset: 0x0004FFA8
 protected override DatabaseValidationCheck.Result ValidateInternal(DatabaseValidationCheck.Arguments args, ref LocalizedString error)
 {
     if (!args.IgnoreMaintenanceChecks)
     {
         IADServer iadserver = args.ADConfig.LookupMiniServerByName(args.TargetServer);
         if (iadserver == null)
         {
             error = ReplayStrings.AmBcsTargetServerADError(args.TargetServer.Fqdn, ReplayStrings.AmBcsNoneSpecified);
             return(DatabaseValidationCheck.Result.Failed);
         }
         if (ServerComponentStates.ReadEffectiveComponentState(iadserver.Fqdn, iadserver.ComponentStates, ServerComponentStateSources.AD, ServerComponentStates.GetComponentId(ServerComponentEnum.HighAvailability), ServiceState.Active) == ServiceState.Inactive)
         {
             error = ReplayStrings.AmBcsTargetServerIsHAComponentOffline(iadserver.Fqdn);
             return(DatabaseValidationCheck.Result.Failed);
         }
         if (iadserver.DatabaseCopyAutoActivationPolicy == DatabaseCopyAutoActivationPolicyType.Blocked)
         {
             error = ReplayStrings.AmBcsTargetServerActivationBlocked(args.TargetServer.Fqdn);
             return(DatabaseValidationCheck.Result.Failed);
         }
     }
     return(DatabaseValidationCheck.Result.Passed);
 }
Esempio n. 30
0
 internal ADServerWrapper(IADServer source) : base(source)
 {
     this.Fqdn                                      = source.Fqdn;
     this.Edition                                   = source.Edition;
     this.VersionNumber                             = source.VersionNumber;
     this.MajorVersion                              = source.MajorVersion;
     this.AdminDisplayVersion                       = source.AdminDisplayVersion;
     this.IsExchange2007OrLater                     = source.IsExchange2007OrLater;
     this.IsE14OrLater                              = source.IsE14OrLater;
     this.MailboxRelease                            = source.MailboxRelease;
     this.CurrentServerRole                         = source.CurrentServerRole;
     this.IsMailboxServer                           = source.IsMailboxServer;
     this.ServerSite                                = source.ServerSite;
     this.ExchangeLegacyDN                          = source.ExchangeLegacyDN;
     this.DatabaseAvailabilityGroup                 = source.DatabaseAvailabilityGroup;
     this.AutoDatabaseMountDial                     = source.AutoDatabaseMountDial;
     this.DatabaseCopyAutoActivationPolicy          = source.DatabaseCopyAutoActivationPolicy;
     this.DatabaseCopyActivationDisabledAndMoveNow  = source.DatabaseCopyActivationDisabledAndMoveNow;
     this.AutoDagServerConfigured                   = source.AutoDagServerConfigured;
     this.MaximumActiveDatabases                    = source.MaximumActiveDatabases;
     this.MaximumPreferredActiveDatabases           = source.MaximumPreferredActiveDatabases;
     this.ContinuousReplicationMaxMemoryPerDatabase = source.ContinuousReplicationMaxMemoryPerDatabase;
     this.ComponentStates                           = source.ComponentStates;
 }