internal new static void InitializeConfigurableSettings() { TenantRelocationSyncConfiguration.ObjectsPerPageLimit = (int)TenantRelocationConfigImpl.GetConfig <uint>("DataSyncObjectsPerPageLimit"); ExTraceGlobals.TenantRelocationTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "TenantRelocationSyncConfiguration.InitializeConfigurableSettings Global Config: TenantRelocationSyncConfiguration.ObjectsPerPageLimit = {0}", TenantRelocationSyncConfiguration.ObjectsPerPageLimit); TenantRelocationSyncConfiguration.InitialLinkReadSize = (int)TenantRelocationConfigImpl.GetConfig <uint>("DataSyncInitialLinkReadSize"); ExTraceGlobals.TenantRelocationTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "TenantRelocationSyncConfiguration.InitializeConfigurableSettings Global Config: TenantRelocationSyncConfiguration.InitialLinkReadSize = {0}", TenantRelocationSyncConfiguration.InitialLinkReadSize); TenantRelocationSyncConfiguration.FailoverTimeout = TimeSpan.FromMinutes((double)TenantRelocationConfigImpl.GetConfig <uint>("DataSyncFailoverTimeoutInMinutes")); ExTraceGlobals.TenantRelocationTracer.TraceDebug <TimeSpan>((long)SyncConfiguration.TraceId, "TenantRelocationSyncConfiguration.InitializeConfigurableSettings Global Config: TenantRelocationSyncConfiguration.FailoverTimeout = {0}", TenantRelocationSyncConfiguration.FailoverTimeout); TenantRelocationSyncConfiguration.DeltaSyncUsnRangeLimit = (long)((ulong)TenantRelocationConfigImpl.GetConfig <uint>("DeltaSyncUsnRangeLimit")); ExTraceGlobals.TenantRelocationTracer.TraceDebug <long>((long)SyncConfiguration.TraceId, "TenantRelocationSyncConfiguration.InitializeConfigurableSettings Global Config: TenantRelocationSyncConfiguration.DeltaSyncUsnRangeLimit = {0}", TenantRelocationSyncConfiguration.DeltaSyncUsnRangeLimit); }
public int GetHealthAndCalculateDelay(out ResourceLoadState health) { if (this.TryReadRegistryHealthOverride(out health)) { ExTraceGlobals.TenantRelocationTracer.TraceDebug <ResourceLoadState, string>((long)this.GetHashCode(), "TenantRelocationThrottlingManager.Throttle() - override detected, override value:{0}. Current forest: {1}", health, this.partitionFqdn); } else { health = this.GetWlmADHealthMetric(); ExTraceGlobals.TenantRelocationTracer.TraceDebug <ResourceLoadState, string>((long)this.GetHashCode(), "TenantRelocationThrottlingManager.Throttle() - AD Health monitor returned value:{0}. Current forest: {1}", health, this.partitionFqdn); } int num; switch (health) { case ResourceLoadState.Unknown: case ResourceLoadState.Underloaded: num = TenantRelocationConfigImpl.GetConfig <int>("LoadStateNoDelayMs"); break; case ResourceLoadState.Full: num = TenantRelocationConfigImpl.GetConfig <int>("LoadStateDefaultDelayMs"); break; case ResourceLoadState.Overloaded: num = TenantRelocationConfigImpl.GetConfig <int>("LoadStateOverloadedDelayMs"); break; case ResourceLoadState.Critical: num = TenantRelocationConfigImpl.GetConfig <int>("LoadStateCriticalDelayMs"); break; default: throw new NotImplementedException(); } if (num < 100) { num = 100; } return(num); }
private bool HandleSupportedSharedConfigurationsProperty(TenantRelocationSyncObject obj, ModifyRequest modRequest, UpdateData mData, TenantRelocationSyncData syncData, ITopologyConfigurationSession targetPartitionSession) { if (!TenantRelocationConfigImpl.GetConfig <bool>("TranslateSupportedSharedConfigurations")) { return(false); } DirectoryAttributeModification directoryAttributeModification = null; MultiValuedProperty <ADObjectId> multiValuedProperty = (MultiValuedProperty <ADObjectId>)obj[OrganizationSchema.SupportedSharedConfigurations]; MultiValuedProperty <ADObjectId> multiValuedProperty2; if (multiValuedProperty != null && multiValuedProperty.Count > 0) { OrganizationId organizationId = syncData.Source.OrganizationId; Exception ex; OrganizationId organizationId2 = SharedConfiguration.FindMostRecentSharedConfigurationInPartition(organizationId, syncData.Target.PartitionId, out ex); if (ex != null) { throw ex; } directoryAttributeModification = this.GetDirectoryAttributeModification(DirectoryAttributeOperation.Add); directoryAttributeModification.Add(organizationId2.ConfigurationUnit.DistinguishedName); modRequest.Modifications.Add(directoryAttributeModification); } else if (this.TryGetSupportedSharedConfigurations(targetPartitionSession, modRequest.DistinguishedName, syncData, out multiValuedProperty2) && multiValuedProperty2 != null && multiValuedProperty2.Count > 0) { directoryAttributeModification = this.GetDirectoryAttributeModification(DirectoryAttributeOperation.Delete); foreach (ADObjectId adobjectId in multiValuedProperty2) { directoryAttributeModification.Add(adobjectId.DistinguishedName); } modRequest.Modifications.Add(directoryAttributeModification); } if (directoryAttributeModification != null) { ExTraceGlobals.TenantRelocationTracer.TraceDebug <string, DirectoryAttributeOperation>((long)this.GetHashCode(), "GenerateModifyRequestLinkMetaDataHandler: add item: attribute {0}, op:{1}", directoryAttributeModification.Name, directoryAttributeModification.Operation); return(true); } return(false); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); if (!string.IsNullOrEmpty(this.DataObject.TargetForest) || !string.IsNullOrEmpty(this.DataObject.RelocationSourceForestRaw)) { base.WriteError(new InvalidOperationException(Strings.ErrorTenantAlreadyBeingRelocated(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); } if ((this.DataObject.OrganizationStatus != OrganizationStatus.Active && this.DataObject.OrganizationStatus != OrganizationStatus.Suspended && this.DataObject.OrganizationStatus != OrganizationStatus.LockedOut) || this.DataObject.IsUpdatingServicePlan) { base.WriteError(new InvalidOperationException(Strings.ErrorTenantNotInActiveOrgState(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); } if (this.DataObject.EnableAsSharedConfiguration || this.DataObject.ImmutableConfiguration) { base.WriteError(new InvalidOperationException(Strings.ErrorSCTsCannotBeMigrated(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); } if (this.DataObject.AdminDisplayVersion.ExchangeBuild < ExchangeObjectVersion.Exchange2012.ExchangeBuild) { base.WriteError(new InvalidOperationException(Strings.ErrorOldTenantsCannotBeMigrated(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); } this.sourceAccountPartitionId = this.DataObject.OrganizationId.PartitionId; this.sourceForestFqdn = this.sourceAccountPartitionId.ForestFQDN; Organization rootOrgContainer = ADSystemConfigurationSession.GetRootOrgContainer(this.sourceForestFqdn, null, null); if (!rootOrgContainer.TenantRelocationsAllowed) { base.WriteError(new InvalidOperationException(Strings.ErrorTenantRelocationNotAllowed(this.Identity.ToString(), this.sourceForestFqdn)), ErrorCategory.InvalidOperation, this.DataObject.Identity); } if (TopologyProvider.LocalForestFqdn.Equals(this.TargetAccountPartition.RawIdentity, StringComparison.OrdinalIgnoreCase)) { this.targetAccountPartitionFqdn = PartitionId.LocalForest.ForestFQDN; } else { AccountPartition accountPartition = (AccountPartition)base.GetDataObject <AccountPartition>(this.TargetAccountPartition, DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.SessionSettingsFactory.Default.FromRootOrgScopeSet(), 207, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Relocation\\NewTenantRelocationRequest.cs"), null, null, null); this.targetAccountPartitionFqdn = accountPartition.PartitionId.ForestFQDN; } if (this.targetAccountPartitionFqdn.IndexOf(PartitionId.LocalForest.ForestFQDN, StringComparison.InvariantCultureIgnoreCase) > 0) { this.targetAccountPartitionFqdn = PartitionId.LocalForest.ForestFQDN; } rootOrgContainer = ADSystemConfigurationSession.GetRootOrgContainer(this.targetAccountPartitionFqdn, null, null); if (!rootOrgContainer.TenantRelocationsAllowed) { base.WriteError(new InvalidOperationException(Strings.ErrorTenantRelocationNotAllowed(this.Identity.ToString(), this.targetAccountPartitionFqdn)), ErrorCategory.InvalidOperation, this.DataObject.Identity); } if (!base.Fields.IsModified(TenantRelocationRequestSchema.AutoCompletionEnabled)) { this.AutoCompletionEnabled = false; } if (this.AutoCompletionEnabled && base.Fields.IsModified(TenantRelocationRequestSchema.RelocationStateRequested)) { base.WriteError(new InvalidOperationException(Strings.ErrorRelocationStateRequestedIsNotAllowed(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); } if (!this.AutoCompletionEnabled && !base.Fields.IsModified(TenantRelocationRequestSchema.RelocationStateRequested)) { base.WriteError(new InvalidOperationException(Strings.ErrorRelocationStateRequestedIsMandatory(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); } ADUser[] array = OrganizationMailbox.FindByOrganizationId(this.DataObject.OrganizationId, OrganizationCapability.Management); if (array.Length != 1) { base.WriteError(new InvalidOperationException(Strings.ErrorOneManagementOrgMailboxIsRequired(this.Identity.ToString(), array.Length.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); } TenantOrganizationPresentationObject tenantOrganizationPresentationObject = new TenantOrganizationPresentationObject(this.DataObject); DateTime utcNow = DateTime.UtcNow; bool config = TenantRelocationConfigImpl.GetConfig <bool>("IgnoreRelocationConstraintExpiration"); foreach (RelocationConstraint relocationConstraint in tenantOrganizationPresentationObject.RelocationConstraints) { if (config || relocationConstraint.ExpirationDate > utcNow) { base.WriteError(new InvalidOperationException(Strings.ErrorRelocationConstraintsPresent(this.Identity.ToString(), relocationConstraint.Name)), ErrorCategory.InvalidOperation, this.DataObject.Identity); } } this.externalDirectoryOrganizationId = Guid.Parse(this.DataObject.ExternalDirectoryOrganizationId); if (!NewTenantRelocationRequest.GLSRecordCheckDisabled() && GlsMServDirectorySession.GlsLookupMode != GlsLookupMode.MServOnly) { string text; string text2; string text3; Exception ex; bool flag = GetTenantRelocationRequest.TryGlsLookupByExternalDirectoryOrganizationId(this.externalDirectoryOrganizationId, out text, out text2, out text3, out ex); if (ex != null) { base.WriteError(ex, ErrorCategory.InvalidOperation, this.DataObject.Identity); } if (!flag || string.IsNullOrEmpty(text2) || !text2.Equals(this.sourceForestFqdn, StringComparison.InvariantCultureIgnoreCase)) { base.WriteError(new InvalidOperationException(Strings.ErrorUnexpectedAccountForestValueInGls(this.Identity.ToString(), text2, this.sourceForestFqdn)), ErrorCategory.InvalidOperation, this.DataObject.Identity); } } TaskLogger.LogExit(); }