public override void ValidateConfiguration( WindowsFabricSettings windowsFabricSettings) { var settingsHostingSection = windowsFabricSettings.GetSection(FabricValidatorConstants.SectionNames.Hosting); bool isLocalNatIPProviderEnabled = settingsHostingSection[FabricValidatorConstants.ParameterNames.Hosting.LocalNatIPProviderEnabled].GetValue <bool>(); // If LocalNatIPProviderEnabled is provided, it should be the only network config setting (no open, no isolated settings) if (isLocalNatIPProviderEnabled) { var settingsSetupSection = windowsFabricSettings.GetSection(FabricValidatorConstants.SectionNames.Setup); bool ipProviderEnabled = settingsHostingSection[FabricValidatorConstants.ParameterNames.Hosting.IPProviderEnabled].GetValue <bool>(); bool containerNetworkSetup = settingsHostingSection[FabricValidatorConstants.ParameterNames.Setup.ContainerNetworkSetup].GetValue <bool>(); bool isolatedNetworkSetup = settingsHostingSection[FabricValidatorConstants.ParameterNames.Setup.IsolatedNetworkSetup].GetValue <bool>(); if (ipProviderEnabled || containerNetworkSetup || isolatedNetworkSetup) { throw new InvalidOperationException("Cannot use specify LocalNatIPProviderEnabled with Open or Isolated."); } var LocalNatIpProviderNetworkName = settingsHostingSection[FabricValidatorConstants.ParameterNames.Hosting.LocalNatIpProviderNetworkName].GetValue <string>(); var LocalNatIpProviderNetworkRange = settingsHostingSection[FabricValidatorConstants.ParameterNames.Hosting.LocalNatIpProviderNetworkName].GetValue <string>(); if (string.IsNullOrEmpty(LocalNatIpProviderNetworkName)) { throw new InvalidOperationException("LocalNatIpProviderNetworkName must be specified."); } if (string.IsNullOrEmpty(LocalNatIpProviderNetworkName)) { throw new InvalidOperationException("LocalNatIpProviderNetworkRange must be specified in valid CIDR format."); } } }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ApplicationLogsFormatVersion, 0, SectionName); ValueValidator.VerifyIntValueLessThanEqualToInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ApplicationLogsFormatVersion, 1, SectionName); }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var storeSectionSettings = windowsFabricSettings.GetSection(this.SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput(storeSectionSettings, FabricValidatorConstants.ParameterNames.ReliableStateProvider.SweepThreshold, MinSweepThreshold, this.SectionName); ValueValidator.VerifyIntValueLessThanEqualToInput(storeSectionSettings, FabricValidatorConstants.ParameterNames.ReliableStateProvider.SweepThreshold, MaxSweepThreshold, this.SectionName); }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); foreach (string key in settingsForThisSection.Keys) { ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, key, 0, SectionName); } }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); if (settingsForThisSection.ContainsKey(FabricValidatorConstants.ParameterNames.PlacementConstraints)) { FabricValidatorUtility.ValidateExpression(settingsForThisSection, FabricValidatorConstants.ParameterNames.PlacementConstraints); } }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); ValueValidator.VerifyIntValueGreaterThanInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.TargetReplicaSetSize, 0, SectionName); ValueValidator.VerifyIntValueGreaterThanInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.MinReplicaSetSize, 0, SectionName); ValueValidator.VerifyFirstIntParameterGreaterThanOrEqualToSecondIntParameter(settingsForThisSection, FabricValidatorConstants.ParameterNames.TargetReplicaSetSize, FabricValidatorConstants.ParameterNames.MinReplicaSetSize, SectionName); FabricValidatorUtility.ValidateExpression(settingsForThisSection, FabricValidatorConstants.ParameterNames.PlacementConstraints); }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); foreach (string key in settingsForThisSection.Keys) { bool value = settingsForThisSection[key].GetValue <bool>(); } }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); foreach (string key in settingsForThisSection.Keys) { ValueValidator.VerifyDoubleValueInRange(settingsForThisSection, key, 0.0, 1.0, SectionName); } }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); if (settingsForThisSection != null && settingsForThisSection.ContainsKey(FabricValidatorConstants.ParameterNames.NativeRunConfiguration.EnableNativeReliableStateManager)) { settingsForThisSection[FabricValidatorConstants.ParameterNames.NativeRunConfiguration.EnableNativeReliableStateManager].GetValue <bool>(); } if (settingsForThisSection != null && settingsForThisSection.ContainsKey(FabricValidatorConstants.ParameterNames.NativeRunConfiguration.Test_LoadEnableNativeReliableStateManager)) { settingsForThisSection[FabricValidatorConstants.ParameterNames.NativeRunConfiguration.Test_LoadEnableNativeReliableStateManager].GetValue <bool>(); } }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var serviceSettings = windowsFabricSettings.GetSection(this.SectionName); bool isServiceEnabled = false; if ((serviceSettings != null) && serviceSettings.ContainsKey(FabricValidatorConstants.ParameterNames.IsEnabled)) { isServiceEnabled = Boolean.Parse(serviceSettings[FabricValidatorConstants.ParameterNames.IsEnabled].Value); } FabricValidator.TraceSource.WriteInfo( FabricValidatorUtility.TraceTag, "DnsService feature enabled : {0}.", isServiceEnabled.ToString()); if (isServiceEnabled) { string prefix = null; string suffix = null; if (serviceSettings.ContainsKey(FabricValidatorConstants.ParameterNames.DNSService.PartitionPrefix)) { prefix = serviceSettings[FabricValidatorConstants.ParameterNames.DNSService.PartitionPrefix].Value; FabricValidator.TraceSource.WriteInfo( FabricValidatorUtility.TraceTag, string.Format( CultureInfo.CurrentCulture, "PartitionPrefix setting overriden in DnsService section, Overriden Value: {0}.", prefix)); } if (serviceSettings.ContainsKey(FabricValidatorConstants.ParameterNames.DNSService.PartitionSuffix)) { suffix = serviceSettings[FabricValidatorConstants.ParameterNames.DNSService.PartitionSuffix].Value; FabricValidator.TraceSource.WriteInfo( FabricValidatorUtility.TraceTag, string.Format( CultureInfo.CurrentCulture, "PartitionSuffix setting overriden in DnsService section, Overriden Value: {0}.", suffix)); } // Validate overriden prefix and suffix settings ValidatePrefixAndSuffix(prefix, suffix); } }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput( settingsForThisSection, FabricValidatorConstants.ParameterNames.ApplicationEtwTraceLevel, MinEtwTraceLevel, this.SectionName); ValueValidator.VerifyIntValueLessThanEqualToInput( settingsForThisSection, FabricValidatorConstants.ParameterNames.ApplicationEtwTraceLevel, MaxEtwTraceLevel, this.SectionName); ValidateApplicationUpgradeConfiguration(windowsFabricSettings); }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var RASettingsMap = windowsFabricSettings.SettingsMap[SectionName]; string apiHealthReportWaitDuration = RASettingsMap[FabricValidatorConstants.ParameterNames.ReconfigurationAgent.ServiceApiHealthDuration].Value; string reconfigurationHealthReportWaitDuration = RASettingsMap[FabricValidatorConstants.ParameterNames.ReconfigurationAgent.ServiceReconfigurationApiHealthDuration].Value; var apiHealthReportTimeSpan = TimeSpan.Parse(apiHealthReportWaitDuration); var reconfigurationHealthReportTimeSpan = TimeSpan.Parse(reconfigurationHealthReportWaitDuration); if (apiHealthReportTimeSpan < reconfigurationHealthReportTimeSpan) { FabricValidator.TraceSource.WriteWarning( FabricValidatorUtility.TraceTag, StringResources.Warning_ShouldBeSmaller, SectionName, FabricValidatorConstants.ParameterNames.ReconfigurationAgent.ServiceReconfigurationApiHealthDuration, SectionName, FabricValidatorConstants.ParameterNames.ReconfigurationAgent.ServiceApiHealthDuration); } // Validate IsDeactivationInfoEnabled should always be true var isDeactivationInfoEnabledStr = RASettingsMap[FabricValidatorConstants.ParameterNames.ReconfigurationAgent.IsDeactivationInfoEnabled].Value; if (!string.IsNullOrEmpty(isDeactivationInfoEnabledStr) && !bool.Parse(isDeactivationInfoEnabledStr)) { throw new ArgumentException("IsDeactivationInfoEnabled can not be false."); } var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ReconfigurationAgent.GracefulReplicaShutdownMaxDuration, 0, SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ReconfigurationAgent.ReplicaChangeRoleFailureRestartThreshold, 0, SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ReconfigurationAgent.ReplicaChangeRoleFailureWarningReportThreshold, 0, SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ReconfigurationAgent.ApplicationUpgradeMaxReplicaCloseDuration, 0, SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ReconfigurationAgent.ServiceApiHealthDuration, 0, SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ReconfigurationAgent.PeriodicApiSlowTraceInterval, 0, SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ReconfigurationAgent.NodeDeactivationMaxReplicaCloseDuration, 0, SectionName); ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ReconfigurationAgent.FabricUpgradeMaxReplicaCloseDuration, 0, SectionName); }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); ValueValidator.VerifyIntValueGreaterThanInput(settingsForThisSection, FabricValidatorConstants.ParameterNames.ActivationMaxFailureCount, 0, SectionName); }
public override void ValidateConfigurationUpgrade(WindowsFabricSettings currentWindowsFabricSettings, WindowsFabricSettings targetWindowsFabricSettings) { // Fail if preview features are not enabled for the cluster but one of the preview features is opted-in var settingsForThisSection = targetWindowsFabricSettings.GetSection(this.SectionName); bool arePreviewFeaturesEnabledForTheCluster = settingsForThisSection[FabricValidatorConstants.ParameterNames.Common.EnableUnsupportedPreviewFeatures].GetValue <bool>(); if (!arePreviewFeaturesEnabledForTheCluster) { // Is SFVolumeDisk enabled? var settingsHostingSection = targetWindowsFabricSettings.GetSection(FabricValidatorConstants.SectionNames.Hosting); bool isSFVolumeDiskServiceEnabled = settingsHostingSection[FabricValidatorConstants.ParameterNames.Hosting.IsSFVolumeDiskServiceEnabled].GetValue <bool>(); if (isSFVolumeDiskServiceEnabled) { // Fail the upgrade throw new InvalidOperationException("Cannot use SFVolumeDisk service preview feature when preview features are disabled for the cluster"); } } // Is CentralSecretService enabled? var settingsCentralSecretServiceSection = targetWindowsFabricSettings.GetSection(FabricValidatorConstants.SectionNames.CentralSecretService); bool isCentralSecretServiceEnabled = settingsCentralSecretServiceSection[FabricValidatorConstants.ParameterNames.CentralSecretService.IsEnabled].GetValue <bool>(); if (!arePreviewFeaturesEnabledForTheCluster && isCentralSecretServiceEnabled) { // Fail the upgrade throw new InvalidOperationException("Cannot use Central Secret Service preview feature when preview features are disabled for the cluster"); } // CentralSecretService: Is cluster cert configured? if (arePreviewFeaturesEnabledForTheCluster && isCentralSecretServiceEnabled) { if (string.IsNullOrWhiteSpace(settingsCentralSecretServiceSection[FabricValidatorConstants.ParameterNames.CentralSecretService.EncryptionCertificateThumbprint].GetValue <string>())) { var securitySection = targetWindowsFabricSettings.GetSection(FabricValidatorConstants.SectionNames.Security); var clusterCredentialTypeString = securitySection[FabricValidatorConstants.ParameterNames.ClusterCredentialType].GetValue <string>(); CredentialType clusterCredentialType; if (!Enum.TryParse <CredentialType>(clusterCredentialTypeString, out clusterCredentialType) || clusterCredentialType != CredentialType.X509 || string.IsNullOrWhiteSpace(securitySection["CertificateInformation/ClusterCertificate/Thumbprint"].GetValue <string>())) { throw new InvalidOperationException("Central Secret Service preview feature requires either an encryption certificate configured (CentralSecretService/EncryptionCertificateThumbprint) or the cluster must be secured with a certificate (ClusterCredentialType must be X509 with a thumbprint configured)."); } } } // Is NetworkInventoryManager enabled? var settingsNetworkInventoryManagerSection = targetWindowsFabricSettings.GetSection(FabricValidatorConstants.SectionNames.NetworkInventoryManager); bool isNetworkInventoryManagerEnabled = settingsNetworkInventoryManagerSection[FabricValidatorConstants.ParameterNames.NetworkInventoryManager.IsEnabled].GetValue <bool>(); if (!arePreviewFeaturesEnabledForTheCluster && isNetworkInventoryManagerEnabled) { // Fail the upgrade throw new InvalidOperationException("Cannot use Isolated Network preview feature when preview features are disabled for the cluster"); } // Is IsolatedNetworkSetup enabled? var settingsSetupSection = targetWindowsFabricSettings.GetSection(FabricValidatorConstants.SectionNames.Setup); bool isIsolatedNetworkSetupEnabled = settingsSetupSection[FabricValidatorConstants.ParameterNames.Setup.IsolatedNetworkSetup].GetValue <bool>(); if (!arePreviewFeaturesEnabledForTheCluster && isIsolatedNetworkSetupEnabled) { // Fail the upgrade throw new InvalidOperationException("Cannot use Isolated Network preview feature when preview features are disabled for the cluster"); } }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); int yieldDurationPer10ms = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.YieldDurationPer10ms].GetValue <int>(); double SwapPrimaryProbability = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.SwapPrimaryProbability].GetValue <double>(); double LoadDecayFactor = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.LoadDecayFactor].GetValue <double>(); double AffinityMoveParentReplicaProbability = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.AffinityMoveParentReplicaProbability].GetValue <double>(); double PLBRefreshInterval = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.PLBRefreshInterval].GetValue <double>(); double MinLoadBalancingInterval = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.MinLoadBalancingInterval].GetValue <double>(); double LocalBalancingThreshold = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.LocalBalancingThreshold].GetValue <double>(); double LocalDomainWeight = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.LocalDomainWeight].GetValue <double>(); double MinPlacementInterval = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.MinPlacementInterval].GetValue <double>(); double MinConstraintCheckInterval = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.MinConstraintCheckInterval].GetValue <double>(); double PLBRefreshGap = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.PLBRefreshGap].GetValue <double>(); double BalancingDelayAfterNewNode = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.BalancingDelayAfterNewNode].GetValue <double>(); double BalancingDelayAfterNodeDown = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.BalancingDelayAfterNodeDown].GetValue <double>(); double GlobalMovementThrottleCountingInterval = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.GlobalMovementThrottleCountingInterval].GetValue <double>(); double MovementPerPartitionThrottleCountingInterval = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.MovementPerPartitionThrottleCountingInterval].GetValue <double>(); double PlacementSearchTimeout = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.PlacementSearchTimeout].GetValue <double>(); double ConstraintCheckSearchTimeout = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.ConstraintCheckSearchTimeout].GetValue <double>(); double FastBalancingSearchTimeout = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.FastBalancingSearchTimeout].GetValue <double>(); double SlowBalancingSearchTimeout = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.SlowBalancingSearchTimeout].GetValue <double>(); bool UseScoreInConstraintCheck = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.UseScoreInConstraintCheck].GetValue <bool>(); double MaxPercentageToMove = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.MaxPercentageToMove].GetValue <double>(); double MaxPercentageToMoveForPlacement = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.MaxPercentageToMoveForPlacement].GetValue <double>(); double MoveParentToFixAffinityViolationTransitionPercentage = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.MoveParentToFixAffinityViolationTransitionPercentage].GetValue <double>(); int PlacementConstraintPriority = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.PlacementConstraintPriority].GetValue <int>(); int PreferredLocationConstraintPriority = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.PreferredLocationConstraintPriority].GetValue <int>(); int ScaleoutCountConstraintPriority = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.ScaleoutCountConstraintPriority].GetValue <int>(); int ApplicationCapacityConstraintPriority = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.ApplicationCapacityConstraintPriority].GetValue <int>(); int CapacityConstraintPriority = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.CapacityConstraintPriority].GetValue <int>(); int AffinityConstraintPriority = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.AffinityConstraintPriority].GetValue <int>(); int FaultDomainConstraintPriority = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.FaultDomainConstraintPriority].GetValue <int>(); int UpgradeDomainConstraintPriority = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.UpgradeDomainConstraintPriority].GetValue <int>(); int ThrottlingConstraintPriority = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.ThrottlingConstraintPriority].GetValue <int>(); bool isPlacementTimerDefined = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.MinPlacementInterval].IsFromClusterManifest; bool isCCTimerDefined = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.MinConstraintCheckInterval].IsFromClusterManifest; bool isRefreshTimerDefined = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.PLBRefreshInterval].IsFromClusterManifest; bool MoveParentToFixAffinityViolation = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.MoveParentToFixAffinityViolation].GetValue <bool>(); bool QuorumBasedLogicAutoSwitch = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.QuorumBasedLogicAutoSwitch].GetValue <bool>(); double StatisticsTracingInterval = settingsForThisSection[FabricValidatorConstants.ParameterNames.PLB.StatisticsTracingInterval].GetValue <double>(); if (isRefreshTimerDefined && (isPlacementTimerDefined || isCCTimerDefined)) { throw (new ArgumentException(StringResources.Error_Fabric_Validator_LoadBalancingMultipleTimersError)); } if (MinPlacementInterval < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.MinPlacementInterval, MinPlacementInterval, 0.0)); } if (MinConstraintCheckInterval < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.MinConstraintCheckInterval, MinConstraintCheckInterval, 0.0)); } if (PLBRefreshGap < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.PLBRefreshGap, PLBRefreshGap, 0.0)); } if (BalancingDelayAfterNewNode < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.BalancingDelayAfterNewNode, BalancingDelayAfterNewNode, 0.0)); } if (BalancingDelayAfterNodeDown < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.BalancingDelayAfterNodeDown, BalancingDelayAfterNodeDown, 0.0)); } if (StatisticsTracingInterval < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThanOrEqualTo, FabricValidatorConstants.ParameterNames.PLB.StatisticsTracingInterval, StatisticsTracingInterval, 0.0)); } if (GlobalMovementThrottleCountingInterval < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.GlobalMovementThrottleCountingInterval, GlobalMovementThrottleCountingInterval, 0.0)); } if (MovementPerPartitionThrottleCountingInterval < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.MovementPerPartitionThrottleCountingInterval, MovementPerPartitionThrottleCountingInterval, 0.0)); } if (PlacementSearchTimeout < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.PlacementSearchTimeout, PlacementSearchTimeout, 0.0)); } if (ConstraintCheckSearchTimeout < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.ConstraintCheckSearchTimeout, ConstraintCheckSearchTimeout, 0.0)); } if (FastBalancingSearchTimeout < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.FastBalancingSearchTimeout, FastBalancingSearchTimeout, 0.0)); } if (SlowBalancingSearchTimeout < 0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueGreaterThan, FabricValidatorConstants.ParameterNames.PLB.SlowBalancingSearchTimeout, SlowBalancingSearchTimeout, 0.0)); } if (LocalBalancingThreshold != 0.0 && LocalBalancingThreshold < 1.0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_DoubleValueEqualToInputOrGreaterThanEqualToInput, 0.0, 1.0)); } if (LocalDomainWeight < 0.0 || LocalDomainWeight > 1.0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueInRange, FabricValidatorConstants.ParameterNames.PLB.LocalDomainWeight, LocalDomainWeight, 0.0, 1.0)); } if (MaxPercentageToMove < 0.0 || MaxPercentageToMove > 1.0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueInRange, FabricValidatorConstants.ParameterNames.PLB.MaxPercentageToMove, MaxPercentageToMove, 0.0, 1.0)); } if (MaxPercentageToMoveForPlacement < 0.0 || MaxPercentageToMoveForPlacement > 1.0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueInRange, FabricValidatorConstants.ParameterNames.PLB.MaxPercentageToMoveForPlacement, MaxPercentageToMoveForPlacement, 0.0, 1.0)); } if (yieldDurationPer10ms < 0 || yieldDurationPer10ms >= 10) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedIntValueInRangeExcludingRight, FabricValidatorConstants.ParameterNames.PLB.YieldDurationPer10ms, yieldDurationPer10ms, 0, 10)); } if ((SwapPrimaryProbability < 0.0) || (SwapPrimaryProbability > 1.0)) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueInRange, FabricValidatorConstants.ParameterNames.PLB.SwapPrimaryProbability, SwapPrimaryProbability, 0.0, 1.0)); } if ((LoadDecayFactor < 0.0) || (LoadDecayFactor > 1.0)) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueInRange, FabricValidatorConstants.ParameterNames.PLB.LoadDecayFactor, LoadDecayFactor, 0.0, 1.0)); } if ((AffinityMoveParentReplicaProbability < 0.0) || (AffinityMoveParentReplicaProbability > 1.0)) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueInRange, FabricValidatorConstants.ParameterNames.PLB.AffinityMoveParentReplicaProbability, AffinityMoveParentReplicaProbability, 0.0, 1.0)); } if (PlacementConstraintPriority < -1) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_FirstIntParameterGreaterThanOrEqualToSecondIntParameter, FabricValidatorConstants.ParameterNames.PLB.PlacementConstraintPriority + " = " + PlacementConstraintPriority, -1)); } if (PreferredLocationConstraintPriority < -1) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_FirstIntParameterGreaterThanOrEqualToSecondIntParameter, FabricValidatorConstants.ParameterNames.PLB.PreferredLocationConstraintPriority + " = " + PreferredLocationConstraintPriority, -1)); } if (ScaleoutCountConstraintPriority < -1) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_FirstIntParameterGreaterThanOrEqualToSecondIntParameter, FabricValidatorConstants.ParameterNames.PLB.ScaleoutCountConstraintPriority + " = " + ScaleoutCountConstraintPriority, -1)); } if (ApplicationCapacityConstraintPriority < -1) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_FirstIntParameterGreaterThanOrEqualToSecondIntParameter, FabricValidatorConstants.ParameterNames.PLB.ApplicationCapacityConstraintPriority + " = " + ApplicationCapacityConstraintPriority, -1)); } if (CapacityConstraintPriority < -1) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_FirstIntParameterGreaterThanOrEqualToSecondIntParameter, FabricValidatorConstants.ParameterNames.PLB.CapacityConstraintPriority + " = " + CapacityConstraintPriority, -1)); } if (AffinityConstraintPriority < -1) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_FirstIntParameterGreaterThanOrEqualToSecondIntParameter, FabricValidatorConstants.ParameterNames.PLB.AffinityConstraintPriority + " = " + AffinityConstraintPriority, -1)); } if (FaultDomainConstraintPriority < -1) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_FirstIntParameterGreaterThanOrEqualToSecondIntParameter, FabricValidatorConstants.ParameterNames.PLB.FaultDomainConstraintPriority + " = " + FaultDomainConstraintPriority, -1)); } if (UpgradeDomainConstraintPriority < -1) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_FirstIntParameterGreaterThanOrEqualToSecondIntParameter, FabricValidatorConstants.ParameterNames.PLB.UpgradeDomainConstraintPriority + " = " + UpgradeDomainConstraintPriority, -1)); } if (ThrottlingConstraintPriority < -1) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_FirstIntParameterGreaterThanOrEqualToSecondIntParameter, FabricValidatorConstants.ParameterNames.PLB.ThrottlingConstraintPriority + " = " + ThrottlingConstraintPriority, -1)); } if (MoveParentToFixAffinityViolationTransitionPercentage < 0.0 || MoveParentToFixAffinityViolationTransitionPercentage > 1.0) { throw new ArgumentException(string.Format(StringResources.Error_FabricValidator_NamedDoubleValueInRange, FabricValidatorConstants.ParameterNames.PLB.MoveParentToFixAffinityViolationTransitionPercentage, MoveParentToFixAffinityViolationTransitionPercentage, 0.0, 1.0)); } }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); if (settingsForThisSection.ContainsKey(FabricValidatorConstants.ParameterNames.IsEnabled)) { bool isEnabled = bool.Parse(settingsForThisSection[FabricValidatorConstants.ParameterNames.IsEnabled].Value); if (!isEnabled) { FabricValidatorUtility.WriteWarningInVSOutputFormat( FabricValidatorUtility.TraceTag, "Performance counter collection on node is disabled because section '{0}' parameter '{1}' is set to 'false'.", FabricValidatorConstants.SectionNames.PerformanceCounterLocalStore, FabricValidatorConstants.ParameterNames.IsEnabled); } } if (settingsForThisSection[FabricValidatorConstants.ParameterNames.Counters].IsFromClusterManifest) { string counterList = settingsForThisSection[FabricValidatorConstants.ParameterNames.Counters].Value; string[] counters = counterList.Split(','); if (counters.Length == 0) { throw new ArgumentException( string.Format( "Section '{0}' parameter '{1}' should specify at least one performance counter.", FabricValidatorConstants.SectionNames.PerformanceCounterLocalStore, FabricValidatorConstants.ParameterNames.Counters)); } bool defaultCountersSpecified = false; bool emptyStringPresent = false; foreach (string counterAsIs in counters) { string counter = counterAsIs.Trim(); if (String.IsNullOrEmpty(counter)) { emptyStringPresent = true; } else if (counter.Equals(FabricValidatorConstants.DefaultTag, StringComparison.OrdinalIgnoreCase)) { defaultCountersSpecified = true; } } if (emptyStringPresent) { throw new ArgumentException( string.Format( "The counter list in section '{0}' parameter '{1}' contains at least one empty string.", FabricValidatorConstants.SectionNames.PerformanceCounterLocalStore, FabricValidatorConstants.ParameterNames.Counters)); } if (false == defaultCountersSpecified) { FabricValidatorUtility.WriteWarningInVSOutputFormat( FabricValidatorUtility.TraceTag, "Section '{0}' parameter '{1}' does not include the default performance counters representation ({2}). Therefore, the default performance counters will not be collected.", FabricValidatorConstants.SectionNames.PerformanceCounterLocalStore, FabricValidatorConstants.ParameterNames.Counters, FabricValidatorConstants.DefaultTag); } } if (settingsForThisSection[FabricValidatorConstants.ParameterNames.NewCounterBinaryFileCreationIntervalMinutes].IsFromClusterManifest) { int minRecommendedNewFileCreationIntervalMinutes = 5; int maxNewFileCreationIntervalMinutes = int.MaxValue / 60; ValueValidator.VerifyIntValueGreaterThanEqualToInput( settingsForThisSection, FabricValidatorConstants.ParameterNames.NewCounterBinaryFileCreationIntervalMinutes, minRecommendedNewFileCreationIntervalMinutes, this.SectionName); ValueValidator.VerifyIntValueLessThanEqualToInput( settingsForThisSection, FabricValidatorConstants.ParameterNames.NewCounterBinaryFileCreationIntervalMinutes, maxNewFileCreationIntervalMinutes, this.SectionName); } if (settingsForThisSection[FabricValidatorConstants.ParameterNames.TestOnlyCounterFilePath].IsFromClusterManifest) { string testOnlyCounterFilePath = settingsForThisSection[FabricValidatorConstants.ParameterNames.TestOnlyCounterFilePath].Value; if (String.IsNullOrEmpty(testOnlyCounterFilePath)) { throw new ArgumentException(String.Format( "Section '{0}' parameter '{1}' should not be an empty string.", FabricValidatorConstants.SectionNames.PerformanceCounterLocalStore, FabricValidatorConstants.ParameterNames.TestOnlyCounterFilePath)); } } if (settingsForThisSection[FabricValidatorConstants.ParameterNames.TestOnlyCounterFileNamePrefix].IsFromClusterManifest) { string testOnlyCounterFileNamePrefix = settingsForThisSection[FabricValidatorConstants.ParameterNames.TestOnlyCounterFileNamePrefix].Value; if (String.IsNullOrEmpty(testOnlyCounterFileNamePrefix)) { throw new ArgumentException(String.Format( "Section '{0}' parameter '{1}' should not be an empty string.", FabricValidatorConstants.SectionNames.PerformanceCounterLocalStore, FabricValidatorConstants.ParameterNames.TestOnlyCounterFileNamePrefix)); } } }
public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings) { var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName); string PeriodicFlushTimeString = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.PeriodicFlushTime].GetValue <string>(); int PeriodicFlushTime = int.Parse(PeriodicFlushTimeString); int PeriodicFlushTimeMin = 15; int PeriodicFlushTimeMax = 5 * 60; if ((PeriodicFlushTime < PeriodicFlushTimeMin) || (PeriodicFlushTime > PeriodicFlushTimeMax)) { throw new ArgumentException( string.Format( "Section '{0}'- PeriodicFlushTime (" + PeriodicFlushTime.ToString() + ") must be greater than " + PeriodicFlushTimeMin.ToString() + " and less than " + PeriodicFlushTimeMax.ToString(), this.SectionName)); } string PeriodicTimerIntervalString = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.PeriodicTimerInterval].GetValue <string>(); int PeriodicTimerInterval = int.Parse(PeriodicTimerIntervalString); int PeriodicTimerIntervalMin = 1; int PeriodicTimerIntervalMax = 60; if ((PeriodicTimerInterval < PeriodicTimerIntervalMin) || (PeriodicTimerInterval > PeriodicTimerIntervalMax)) { throw new ArgumentException( string.Format( "Section '{0}'- PeriodicTimerInterval (" + PeriodicTimerInterval.ToString() + ") must be greater than " + PeriodicTimerIntervalMin.ToString() + " and less than " + PeriodicTimerIntervalMax.ToString(), this.SectionName)); } if (PeriodicTimerInterval > PeriodicFlushTime) { throw new ArgumentException( string.Format( "Section '{0}'- PeriodicTimerInterval (" + PeriodicTimerInterval.ToString() + ") must be less than PeriodicFlushTime" + PeriodicFlushTime.ToString(), this.SectionName)); } string AllocationTimeoutString = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.AllocationTimeout].GetValue <string>(); int AllocationTimeout = int.Parse(AllocationTimeoutString); int AllocationTimeoutMin = 0; int AllocationTimeoutMax = 60 * 60; if ((AllocationTimeout < AllocationTimeoutMin) || (AllocationTimeout > AllocationTimeoutMax)) { throw new ArgumentException( string.Format( "Section '{0}'- AllocationTimeout (" + AllocationTimeout.ToString() + ") must be greater than " + AllocationTimeoutMin.ToString() + " and less than " + AllocationTimeoutMax.ToString(), this.SectionName)); } int PinnedMemoryLimitInKB = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.PinnedMemoryLimitInKB].GetValue <int>(); if (PinnedMemoryLimitInKB != 0) { throw new ArgumentException( string.Format( "Section '{0}'- PinnedMemoryLimitInKB (" + PinnedMemoryLimitInKB.ToString() + ") must be set to no limit (0)", SectionName)); } int WriteBufferMemoryPoolMinimumInKB = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.WriteBufferMemoryPoolMinimumInKB].GetValue <int>(); int WriteBufferMemoryPoolMinimumInKBMin = 16 * 1024; if ((WriteBufferMemoryPoolMinimumInKB != 0) && (WriteBufferMemoryPoolMinimumInKB < WriteBufferMemoryPoolMinimumInKBMin)) { throw new ArgumentException( string.Format( "Section '{0}'- WriteBufferMemoryPoolMinimumInKB (" + WriteBufferMemoryPoolMinimumInKB + ") must be greater than " + WriteBufferMemoryPoolMinimumInKBMin, SectionName)); } int WriteBufferMemoryPoolMaximumInKB = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.WriteBufferMemoryPoolMaximumInKB].GetValue <int>(); int WriteBufferMemoryPoolPerStreamInKB = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.WriteBufferMemoryPoolPerStreamInKB].GetValue <int>(); int WriteBufferMemoryPoolPerStreamInKBMin = 1024; if ((WriteBufferMemoryPoolPerStreamInKB != -1) && (WriteBufferMemoryPoolPerStreamInKB != 0)) { if (WriteBufferMemoryPoolPerStreamInKB < WriteBufferMemoryPoolPerStreamInKBMin) { throw new ArgumentException( string.Format( "Section '{0}'- WriteBufferMemoryPoolPerStreamInKB (" + WriteBufferMemoryPoolPerStreamInKB.ToString() + ") must be greater than " + WriteBufferMemoryPoolPerStreamInKBMin.ToString(), this.SectionName)); } } if (WriteBufferMemoryPoolMaximumInKB != 0) { if (WriteBufferMemoryPoolMinimumInKB == 0) { throw new ArgumentException( string.Format( "Section '{0}'- WriteBufferMemoryPoolMinimumInKB must not have no limit if WriteBufferMemoryPoolMaximumInKB does have a limit", SectionName)); } if (WriteBufferMemoryPoolMinimumInKB > WriteBufferMemoryPoolMaximumInKB) { throw new ArgumentException( string.Format( "Section '{0}'- WriteBufferMemoryPoolMinimumInKB (" + WriteBufferMemoryPoolMinimumInKB + ") must be less than or equal to WriteBufferMemoryPoolMaximumInKB (" + WriteBufferMemoryPoolMaximumInKB + ")", SectionName)); } } uint sharedLogCreateFlags = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.SharedLogCreateFlags].GetValue <uint>(); int sharedLogSizeInMB = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.SharedLogSizeInMB].GetValue <int>(); int sharedLogSizeInMBMin = 512; string sharedLogId = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.SharedLogId].GetValue <string>(); string sharedLogPath = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.SharedLogPath].GetValue <string>(); int sharedLogNumberStreams = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.SharedLogNumberStreams].GetValue <int>(); int sharedLogNumberStreamsMin = 3 * 512; int sharedLogNumberStreamsMax = 3 * 8192; int sharedLogMaximumRecordSizeInKB = settingsForThisSection[FabricValidatorConstants.ParameterNames.KtlLogger.SharedLogMaximumRecordSizeInKB].GetValue <int>(); if (sharedLogCreateFlags != 0) { throw new ArgumentException( string.Format( "Section '{0}'- SharedLogCreateFlags (" + sharedLogCreateFlags + ") must be zero", SectionName)); } if (sharedLogMaximumRecordSizeInKB != 0) { throw new ArgumentException( string.Format( "Section '{0}'- SharedLogMaximumRecordSizeInKB (" + sharedLogMaximumRecordSizeInKB + ") must be zero", SectionName)); } if ((sharedLogNumberStreams < sharedLogNumberStreamsMin) || (sharedLogNumberStreams > sharedLogNumberStreamsMax)) { throw new ArgumentException( string.Format( "Section '{0}'- SharedLogNumberOfStreams (" + sharedLogNumberStreams + ") must be greater than or equal to " + sharedLogNumberStreamsMin + " and less than " + sharedLogNumberStreamsMax, SectionName)); } if (sharedLogSizeInMB < sharedLogSizeInMBMin) { throw new ArgumentException( string.Format( "Section '{0}'- SharedLogSizeInMB (" + sharedLogSizeInMB + ") must be greater than or equal to " + sharedLogSizeInMBMin, SectionName)); } ValidateKtlLoggerSharedPathAndId(sharedLogPath, sharedLogId, SectionName); }