示例#1
0
 private void GetTenantSizeData(CacheEntryBase cacheEntry, Dictionary <string, TenantData> tenantDataDictionary, Hashtable idsToNames)
 {
     base.Context.Logger.Log(MigrationEventType.Information, "Processing E14 Servers", new object[0]);
     this.CatchExceptions(delegate
     {
         this.GetVersionSizeData(cacheEntry, tenantDataDictionary, idsToNames, true);
     }, "Error Finding MailboxServers");
     base.Context.Logger.Log(MigrationEventType.Information, "Processing E15 Servers", new object[0]);
     this.CatchExceptions(delegate
     {
         this.GetVersionSizeData(cacheEntry, tenantDataDictionary, idsToNames, false);
     }, "Error Finding MailboxServers");
 }
示例#2
0
        private void GetVersionSizeData(CacheEntryBase cacheEntry, Dictionary <string, TenantData> tenantDataDictionary, Hashtable idsToNames, bool isE14)
        {
            Dictionary <string, FileInfo> files = new Dictionary <string, FileInfo>();
            HashSet <string> databaseNames      = new HashSet <string>();
            List <Server>    list;

            if (isE14)
            {
                list = CommonUtils.GetMailboxServer(((AnchorADProvider)cacheEntry.ADProvider).ConfigurationSession, Server.E14SP1MinVersion, Server.E15MinVersion).ToList <Server>();
            }
            else
            {
                list = CommonUtils.GetMailboxServer(((AnchorADProvider)cacheEntry.ADProvider).ConfigurationSession, Server.E15MinVersion).ToList <Server>();
            }
            if (list.Count == 0)
            {
                base.Context.Logger.Log(MigrationEventType.Error, "Couldn't find any MBX servers to collect data from", new object[0]);
                return;
            }
            base.Context.Logger.Log(MigrationEventType.Information, "Found {0} servers", new object[]
            {
                list.Count
            });
            using (List <Server> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Server server = enumerator.Current;
                    this.CatchExceptions(delegate
                    {
                        this.QuerySingleServer(server, files, databaseNames, isE14);
                    }, string.Format("Error Querying server {0}", server.Name));
                }
            }
            files = this.ValidateDatabases(files, databaseNames, isE14);
            using (Dictionary <string, FileInfo> .ValueCollection.Enumerator enumerator2 = files.Values.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    FileInfo file = enumerator2.Current;
                    this.CatchExceptions(delegate
                    {
                        this.ProcessFile(file, tenantDataDictionary, idsToNames, isE14);
                    }, string.Format("Error opening and reading file {0}", file.FullName));
                }
            }
        }
示例#3
0
        protected override AnchorJobProcessorResult ProcessEntry(CacheEntryBase cacheEntry)
        {
            Dictionary <string, TenantData> tenantDataDictionary = new Dictionary <string, TenantData>();
            Hashtable idsToNames = new Hashtable();

            try
            {
                this.AddOrgInformation(tenantDataDictionary, idsToNames);
                this.GetTenantSizeData(cacheEntry, tenantDataDictionary, idsToNames);
                this.UploadData(tenantDataDictionary);
                this.ValidateAndLog(tenantDataDictionary);
            }
            catch (Exception ex)
            {
                base.Context.Logger.Log(MigrationEventType.Error, "Unhandled exception occured, rethrowing to Anchor Service. {0}", new object[]
                {
                    CommonUtils.FullExceptionMessage(ex, true)
                });
                throw ex;
            }
            return(AnchorJobProcessorResult.Working);
        }
示例#4
0
 public CacheEntryProxy(CacheEntryBase cacheEntryBase)
 {
     this.CacheEntryBase = cacheEntryBase;
     this.ADSessionProxy = new ADSessionProxy(cacheEntryBase.ADProvider);
 }
示例#5
0
 internal void Remove( CacheEntryBase entry )
 {
     Remove( entry.Id );
 }
示例#6
0
 internal void Add( CacheEntryBase entry )
 {
     myCacheEntries[ entry.Id ] = entry;
 }
示例#7
0
        private void ShrinkCacheIfRequired( CacheEntryBase entry )
        {
            while ( myIndex.CacheSizeInKB + entry.SizeInKB > Settings.MaxCacheSizeInKB )
            {
                var entryToRemove = myIndex.Entries
                    .OrderBy( e => e.ExpirationTime )
                    .First();

                myIndex.Remove( entryToRemove );
            }
        }
示例#8
0
        protected override AnchorJobProcessorResult ProcessEntry(CacheEntryBase cacheEntry)
        {
            AuthAdminContext authAdminContext = base.Context as AuthAdminContext;

            AnchorUtil.AssertOrThrow(authAdminContext != null, "expect to have a valid AuthAdminContext", new object[0]);
            authAdminContext.Logger.Log(MigrationEventType.Information, "Checking if mailbox {0} active on current server", new object[]
            {
                cacheEntry
            });
            AnchorJobProcessorResult anchorJobProcessorResult = base.ProcessEntry(cacheEntry);

            if (anchorJobProcessorResult == AnchorJobProcessorResult.Deleted)
            {
                authAdminContext.Logger.Log(MigrationEventType.Information, "Mailbox {0} is not active on current server, skipping Auth Admin tasks", new object[]
                {
                    cacheEntry
                });
                return(anchorJobProcessorResult);
            }
            authAdminContext.Logger.Log(MigrationEventType.Information, "Mailbox {0} is active on current server", new object[]
            {
                cacheEntry
            });
            try
            {
                authAdminContext.Logger.Log(MigrationEventType.Information, "Starting Auth Admin tasks", new object[0]);
                ITopologyConfigurationSession session = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 81, "ProcessEntry", "f:\\15.00.1497\\sources\\dev\\Management\\src\\ServiceHost\\Servicelets\\AuthAdmin\\Program\\AuthAdminScheduler.cs");
                this.authAdminAuthConfig.DoScheduledWork(session);
                this.authAdminCertificates.DoScheduledWork(session);
            }
            catch (ADTransientException ex)
            {
                authAdminContext.Logger.LogTerseEvent(MigrationEventType.Error, MSExchangeAuthAdminEventLogConstants.Tuple_TransientException, new string[]
                {
                    AnchorLogger.GetDiagnosticInfo(ex, null)
                });
                throw;
            }
            catch (DataSourceTransientException ex2)
            {
                authAdminContext.Logger.LogTerseEvent(MigrationEventType.Error, MSExchangeAuthAdminEventLogConstants.Tuple_TransientException, new string[]
                {
                    AnchorLogger.GetDiagnosticInfo(ex2, null)
                });
                throw;
            }
            catch (Exception ex3)
            {
                authAdminContext.Logger.LogTerseEvent(MigrationEventType.Error, MSExchangeAuthAdminEventLogConstants.Tuple_PermanentException, new string[]
                {
                    AnchorLogger.GetDiagnosticInfo(ex3, null)
                });
            }
            finally
            {
                authAdminContext.Logger.LogTerseEvent(MigrationEventType.Information, MSExchangeAuthAdminEventLogConstants.Tuple_AuthAdminCompleted, new string[]
                {
                    cacheEntry.ToString()
                });
            }
            return(AnchorJobProcessorResult.Waiting);
        }
示例#9
0
 protected override AnchorJobProcessorResult ProcessEntry(CacheEntryBase cacheEntry)
 {
     return(this.InternalProcessEntry(new CacheEntryProxy(cacheEntry)));
 }
示例#10
0
 internal void Remove(CacheEntryBase entry)
 {
     Remove(entry.Id);
 }
示例#11
0
 internal void Add(CacheEntryBase entry)
 {
     myCacheEntries[entry.Id] = entry;
 }
示例#12
0
 protected override AnchorJobProcessorResult ProcessEntry(CacheEntryBase cacheEntry)
 {
     base.Context.Logger.Log(MigrationEventType.Information, "Entered ProcessEntry", new object[0]);
     return(this.InternalProcessEntry(new CacheEntryProxy(cacheEntry)));
 }
示例#13
0
        // Token: 0x0600003B RID: 59 RVA: 0x00002A84 File Offset: 0x00000C84
        protected override AnchorJobProcessorResult ProcessEntry(CacheEntryBase cacheEntry)
        {
            MigrationOccupantType migrationOccupantType = MigrationOccupantType.Regular;

            try
            {
                migrationOccupantType = base.Context.Config.GetConfig <MigrationOccupantType>("OccupantTypes");
            }
            catch (ConfigurationSettingsException ex)
            {
                this.LogFailure(ex);
                return(AnchorJobProcessorResult.Waiting);
            }
            base.Context.Logger.Log(MigrationEventType.Verbose, "Entered ProcessEntry, working on types '{0}'", new object[]
            {
                migrationOccupantType
            });
            bool flag = false;

            foreach (MigrationOccupantType migrationOccupantType2 in from t in migrationOccupantType.ToString().Split(new char[]
            {
                ','
            })
                     select(MigrationOccupantType) Enum.Parse(typeof(MigrationOccupantType), t))
            {
                base.Context.Logger.Log(MigrationEventType.Verbose, "working on type {0}", new object[]
                {
                    migrationOccupantType2
                });
                BatchCreatorScheduler.OccupantCreator occupantCreator;
                if (!this.OccupantCreators.TryGetValue(migrationOccupantType2, out occupantCreator))
                {
                    base.Context.Logger.Log(MigrationEventType.Information, "Creating a creator to work on {0}", new object[]
                    {
                        migrationOccupantType2
                    });
                    occupantCreator = new BatchCreatorScheduler.OccupantCreator(migrationOccupantType2);
                    this.OccupantCreators.Add(migrationOccupantType2, occupantCreator);
                }
                using (occupantCreator.ActivateContext(base.Context))
                {
                    try
                    {
                        if (this.ShouldCreate(occupantCreator.LastRun))
                        {
                            IList <MailboxId> migrationMailboxes = this.GetMigrationMailboxes(cacheEntry.ADProvider);
                            base.Context.Logger.Log(MigrationEventType.Verbose, "Found {0} active migration mailboxes to run batches", new object[]
                            {
                                migrationMailboxes.Count
                            });
                            if (migrationMailboxes.Count <= 0)
                            {
                                base.Context.Logger.Log(MigrationEventType.Warning, "No active migration mailboxes to run batches", new object[0]);
                            }
                            else
                            {
                                BatchCapacityDatum batchCapacityForForest = this.LoadBalanceClient.GetBatchCapacityForForest(base.Context.Config.GetConfig <int>("MailboxRunLimit"));
                                base.Context.Logger.Log(MigrationEventType.Verbose, "Load balancer allowed us to create {0} mailboxes", new object[]
                                {
                                    batchCapacityForForest.MaximumNumberOfMailboxes
                                });
                                long maximumAccounts     = (long)batchCapacityForForest.MaximumNumberOfMailboxes;
                                int? config              = base.Context.Config.GetConfig <int?>("MaximumTotalMailboxSize");
                                MigrationAccount[] array = this.SelectAccountsToMigrate(maximumAccounts, (config != null) ? new long?((long)config.GetValueOrDefault()) : null, base.Context.Config.GetConfig <int?>("ConstraintId"));
                                flag = (array.Length > 0);
                                int index = 0;
                                foreach (List <MigrationAccount> list in this.CreateSubBatches <MigrationAccount>(array, migrationMailboxes.Count))
                                {
                                    base.Context.Logger.Log(MigrationEventType.Verbose, "Creating migration batch of size {0} for migration mailbox id {1}", new object[]
                                    {
                                        list.Count,
                                        migrationMailboxes[index]
                                    });
                                    this.CreateMigrationBatch(migrationMailboxes[index++], this.CreateCsv(list));
                                }
                            }
                        }
                    }
                    catch (ConfigurationSettingsException ex2)
                    {
                        this.LogFailure(ex2);
                    }
                    catch (MigrationPermanentException ex3)
                    {
                        this.LogFailure(ex3);
                    }
                    catch (BatchCreatorException ex4)
                    {
                        this.LogFailure(ex4);
                    }
                }
            }
            if (!flag)
            {
                return(AnchorJobProcessorResult.Waiting);
            }
            return(AnchorJobProcessorResult.Working);
        }