private static void ValidateSpecifiedValuesInSectionAreGreaterThanZero(Dictionary <string, SettingsOverridesTypeSectionParameter> section, string[] parameters, string sectionName)
 {
     foreach (string parameterName in parameters)
     {
         ValueValidator.VerifyIntValueGreaterThanInput(section, parameterName, 0, sectionName, EventLevel.Error);
     }
 }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        public override void ValidateConfiguration(WindowsFabricSettings windowsFabricSettings)
        {
            var settingsForThisSection = windowsFabricSettings.GetSection(this.SectionName);

            foreach (string key in settingsForThisSection.Keys)
            {
                ValueValidator.VerifyIntValueGreaterThanEqualToInput(settingsForThisSection, key, 0, SectionName);
            }
        }
Example #5
0
        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);

            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);
        }
Example #7
0
        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 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));
                }
            }
        }