Exemple #1
0
        // Token: 0x06001208 RID: 4616 RVA: 0x00037FB4 File Offset: 0x000361B4
        internal static MailboxDatabaseWithLocationInfo FindDatabaseAndLocationForEnterpriseSiteMailbox(string domainController, LogMessageDelegate logger, ScopeSet scopeSet)
        {
            PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbEnterSiteMailboxEnterprise, logger);
            ITopologyConfigurationSession configSession = PhysicalResourceLoadBalancing.CreateGlobalConfigSession(domainController);
            List <MailboxDatabase>        databasesForProvisioningCached = PhysicalResourceLoadBalancing.GetDatabasesForProvisioningCached(configSession, false, logger);

            if (databasesForProvisioningCached.Count == 0)
            {
                PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbNoAvailableDatabase, logger);
                return(null);
            }
            List <MailboxDatabase> list = new List <MailboxDatabase>();

            foreach (MailboxDatabase mailboxDatabase in databasesForProvisioningCached)
            {
                if (mailboxDatabase.AdminDisplayVersion == null)
                {
                    mailboxDatabase.AdminDisplayVersion = Server.GetServerVersion(mailboxDatabase.ServerName);
                }
                if (mailboxDatabase.AdminDisplayVersion.Major >= PhysicalResourceLoadBalancing.MajorVersionE15)
                {
                    list.Add(mailboxDatabase);
                }
            }
            if (list.Count == 0)
            {
                PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbNoAvailableE15Database(databasesForProvisioningCached.Count), logger);
                return(null);
            }
            ActiveManager cachingActiveManagerInstance = ActiveManager.GetCachingActiveManagerInstance();
            Random        random = new Random();

            while (list.Count != 0)
            {
                int             index            = random.Next(list.Count);
                MailboxDatabase mailboxDatabase2 = list[index];
                list.RemoveAt(index);
                PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbGetServerForActiveDatabaseCopy(mailboxDatabase2.Name), logger);
                DatabaseLocationInfo serverForActiveDatabaseCopy = PhysicalResourceLoadBalancing.GetServerForActiveDatabaseCopy(mailboxDatabase2, cachingActiveManagerInstance, logger);
                if (serverForActiveDatabaseCopy != null)
                {
                    MailboxDatabaseWithLocationInfo mailboxDatabaseWithLocationInfo = new MailboxDatabaseWithLocationInfo(mailboxDatabase2, serverForActiveDatabaseCopy);
                    if (mailboxDatabase2.MasterType == MasterType.DatabaseAvailabilityGroup)
                    {
                        PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbRemoteSiteDatabaseReturned(mailboxDatabaseWithLocationInfo.MailboxDatabase.Name, mailboxDatabaseWithLocationInfo.DatabaseLocationInfo.ServerFqdn), logger);
                        return(mailboxDatabaseWithLocationInfo);
                    }
                    mailboxDatabaseWithLocationInfo = PhysicalResourceLoadBalancing.VerifyStatusAndSelectDB(new List <MailboxDatabaseWithLocationInfo>
                    {
                        mailboxDatabaseWithLocationInfo
                    }, domainController, logger, scopeSet);
                    if (mailboxDatabaseWithLocationInfo != null)
                    {
                        return(mailboxDatabaseWithLocationInfo);
                    }
                }
            }
            return(null);
        }
Exemple #2
0
        // Token: 0x06001206 RID: 4614 RVA: 0x00037DC8 File Offset: 0x00035FC8
        internal static MailboxDatabaseWithLocationInfo FindDatabaseAndLocation(string domainController, LogMessageDelegate logger, ScopeSet scopeSet, bool isInitialProvisioning, bool localSiteDatabasesOnly, int?qualifiedMinServerVersion, IMailboxProvisioningConstraint mailboxProvisioningConstraint, IEnumerable <ADObjectId> excludedDatabaseIds, ref LoadBalancingReport loadBalancingReport)
        {
            ITopologyConfigurationSession configSession = PhysicalResourceLoadBalancing.CreateGlobalConfigSession(domainController);
            List <MailboxDatabase>        databasesForProvisioningCached = PhysicalResourceLoadBalancing.GetDatabasesForProvisioningCached(configSession, localSiteDatabasesOnly, logger);
            List <MailboxDatabase>        list;

            if (mailboxProvisioningConstraint != null || excludedDatabaseIds != null)
            {
                list = PhysicalResourceLoadBalancing.FilterEligibleDatabase(logger, databasesForProvisioningCached.GetRange(0, databasesForProvisioningCached.Count), mailboxProvisioningConstraint, excludedDatabaseIds);
            }
            else
            {
                list = databasesForProvisioningCached.GetRange(0, databasesForProvisioningCached.Count);
            }
            if (list.Count == 0)
            {
                PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbNoAvailableDatabase, logger);
                return(null);
            }
            LoadBalancingReport loadBalancingReport2 = loadBalancingReport ?? new LoadBalancingReport();

            loadBalancingReport2.enabledDatabasesWithLocalCopyCount = list.Count;
            ActiveManager cachingActiveManagerInstance = ActiveManager.GetCachingActiveManagerInstance();

            if (PhysicalResourceLoadBalancing.IsDatacenter)
            {
                return(PhysicalResourceLoadBalancing.FindDatabaseAndLocation(list, cachingActiveManagerInstance, isInitialProvisioning, localSiteDatabasesOnly, logger, ref loadBalancingReport2));
            }
            List <MailboxDatabaseWithLocationInfo> list2 = new List <MailboxDatabaseWithLocationInfo>(list.Count);

            foreach (MailboxDatabase mailboxDatabase in list)
            {
                DatabaseLocationInfo serverForActiveDatabaseCopy = PhysicalResourceLoadBalancing.GetServerForActiveDatabaseCopy(mailboxDatabase, cachingActiveManagerInstance, logger);
                if (serverForActiveDatabaseCopy != null && PhysicalResourceLoadBalancing.IsDatabaseInLocalSite(serverForActiveDatabaseCopy, logger) && (qualifiedMinServerVersion == null || serverForActiveDatabaseCopy.ServerVersion >= qualifiedMinServerVersion.Value))
                {
                    list2.Add(new MailboxDatabaseWithLocationInfo(mailboxDatabase, serverForActiveDatabaseCopy));
                }
            }
            return(PhysicalResourceLoadBalancing.VerifyStatusAndSelectDB(list2, domainController, logger, scopeSet));
        }
Exemple #3
0
        // Token: 0x06001201 RID: 4609 RVA: 0x00037AD4 File Offset: 0x00035CD4
        internal static List <MailboxDatabase> GetAllCachedDatabasesForProvisioning(string domainController, LogMessageDelegate logger)
        {
            ITopologyConfigurationSession configSession = PhysicalResourceLoadBalancing.CreateGlobalConfigSession(domainController);

            return(PhysicalResourceLoadBalancing.GetDatabasesForProvisioningCached(configSession, false, logger));
        }