private void LogUpgradeStageWithE14Counts(UpgradeStage?upgradeStage) { if (this.organization.UpgradeStage == upgradeStage && this.organization.UpgradeLastE14CountsUpdateTime != null && DateTime.UtcNow - this.e14CountsUpdateInterval < this.organization.UpgradeLastE14CountsUpdateTime) { return; } int num = 0; if (upgradeStage != null) { num = this.crossOrgMoveRequestCount + this.intraOrgMoveRequestCount + this.highPriorityMoveRequestCount; if (num > 0 || this.upgradeNotInProgressMoveRequestCount > 0) { this.organization.UpgradeStatus = UpgradeStatusTypes.Warning; this.organization.UpgradeDetails = string.Empty; this.organization.UpgradeMessage = string.Format("Upgrade blocked by {0} Move Request(s). NotQueuedOrInProgress:{1} CrossOrg:{2} IntraOrg:{3} High Priority:{4}", new object[] { this.upgradeNotInProgressMoveRequestCount, num, this.crossOrgMoveRequestCount, this.intraOrgMoveRequestCount, this.highPriorityMoveRequestCount }); } else { this.organization.UpgradeStatus = UpgradeStatusTypes.InProgress; this.organization.UpgradeMessage = string.Empty; this.organization.UpgradeDetails = string.Empty; } } this.orgOperationProxy.SetOrganization(this.organization, this.organization.UpgradeStatus, this.organization.UpgradeRequest, this.organization.UpgradeMessage, this.organization.UpgradeDetails, upgradeStage, this.e14MbxCount, num); UpgradeBatchCreatorProgressLog.Write(this.organization, string.Empty, string.Empty, new int?(this.e14MbxCount), new int?(num)); UpgradeBatchCreatorProgressLog.FlushLog(); }
internal AnchorJobProcessorResult InternalProcessEntry(ICacheEntry cacheEntryProxy) { try { if (cacheEntryProxy.OrgName.StartsWith("a830edad9050849EXOT", StringComparison.OrdinalIgnoreCase)) { base.Context.Logger.Log(MigrationEventType.Information, "Skipping interruption test tenant", new object[0]); return(AnchorJobProcessorResult.Deleted); } this.organization = this.orgOperationProxy.GetOrganization(cacheEntryProxy.ExternalDirectoryOrganizationId); base.Context.Logger.Log(MigrationEventType.Information, "Current org state: UpgradeRequest='{0}', UpgradeStatus='{1}', UpgradeStage ='{2}'", new object[] { this.organization.UpgradeRequest, this.organization.UpgradeStatus, this.organization.UpgradeStage }); if (this.organization.UpgradeStatus == UpgradeStatusTypes.Error) { base.Context.Logger.Log(MigrationEventType.Information, "Organization UpgradeStatus is in Error and will not be processed.", new object[0]); return(AnchorJobProcessorResult.Deleted); } if ((this.organization.UpgradeRequest == UpgradeRequestTypes.TenantUpgrade || this.organization.UpgradeRequest == UpgradeRequestTypes.TenantUpgradeDryRun) && (this.organization.UpgradeStatus == UpgradeStatusTypes.Complete || this.organization.UpgradeStatus == UpgradeStatusTypes.ForceComplete)) { base.Context.Logger.Log(MigrationEventType.Information, "UpgradeStatus already Complete and no need to check for Pilot users. Nothing to do.", new object[0]); return(AnchorJobProcessorResult.Deleted); } if (this.organization.UpgradeRequest == UpgradeRequestTypes.CancelPrestageUpgrade && this.organization.UpgradeStatus != UpgradeStatusTypes.Complete) { base.Context.Logger.Log(MigrationEventType.Information, "Setting org to CancelPrestageUpgrade,Complete", new object[0]); this.orgOperationProxy.SetOrganization(this.organization, UpgradeStatusTypes.Complete, this.organization.UpgradeRequest, string.Empty, string.Empty, null, -1, -1); return(AnchorJobProcessorResult.Deleted); } if (UpgradeBatchCreatorScheduler.e14MailboxQueryFilter == null) { UpgradeBatchCreatorScheduler.e14MailboxQueryFilter = cacheEntryProxy.ADSessionProxy.BuildE14MailboxQueryFilter(); if (UpgradeBatchCreatorScheduler.e14MailboxQueryFilter == null) { throw new NoE14ServersFoundException(); } } this.ProcessUpgradeRequest(cacheEntryProxy); } catch (AnchorServiceInstanceNotActiveException) { base.Context.Logger.Log(MigrationEventType.Information, "This AnchorService instance is no longer Active. Processing stopped.", new object[0]); return(AnchorJobProcessorResult.Deleted); } catch (Exception ex) { base.Context.Logger.Log(MigrationEventType.Error, "Processing of UpgradeRequest failed due to: {0}", new object[] { ex }); if (this.organization != null) { UpgradeBatchCreatorProgressLog.Write(this.organization, ex.GetType().ToString(), ex.Message, null, null); try { this.orgOperationProxy.SetOrganization(this.organization, UpgradeStatusTypes.Warning, this.organization.UpgradeRequest, ex.Message, ex.ToString(), this.organization.UpgradeStage, -1, -1); } catch (Exception ex2) { base.Context.Logger.Log(MigrationEventType.Error, "Could not record error on organization due to: {0}", new object[] { ex2 }); UpgradeBatchCreatorProgressLog.Write(this.organization, ex2.GetType().ToString(), ex2.Message, null, null); } } if (!(ex is LocalizedException) && !(ex is IOException)) { throw; } } finally { base.Context.Logger.Log(MigrationEventType.Information, "ProcessEntry completed.", new object[0]); } return(AnchorJobProcessorResult.Waiting); }