Skip to content

Conversation

devanshjainms
Copy link
Contributor

This pull request introduces significant refactoring and new validation logic to the HA cluster configuration validation codebase. The main focus is shifting from a parsing-first approach to a "constants-first" validation strategy, ensuring that all expected parameters from the constants are validated against the cluster information base (CIB), with improved support for offline validation. Additionally, parameter handling is enhanced to consistently track required status and expected values, and the overall status calculation now accounts for warnings as well as errors.

Validation and Parameter Handling Improvements:

  • Introduced a "constants-first" validation workflow via the new validate_from_constants method in get_pcmk_properties.py, replacing the previous parsing orchestration in parse_ha_cluster_config. This ensures all expected parameters defined in constants are checked, and supports offline validation. (src/module_utils/get_pcmk_properties.py, src/module_utils/get_pcmk_properties.pyL479-R490)
  • Added helper methods _validate_basic_constants, _find_param_with_element_info, _validate_resource_constants, and _validate_constraint_constants to systematically validate parameters from constants and CIB XML, including constraints and resources. (src/module_utils/get_pcmk_properties.py, src/module_utils/get_pcmk_properties.pyL538-R669)
  • Updated parameter creation and expected value retrieval logic to consistently use a tuple (value, required) format, improving handling of required parameters and complex expected value types. (src/module_utils/get_pcmk_properties.py, [1] [2] [3] [4] [5]

Status Calculation and Reporting:

  • Enhanced overall status calculation to distinguish between errors, warnings, and success when reporting validation results, providing more granular feedback. (src/module_utils/get_pcmk_properties.py, src/module_utils/get_pcmk_properties.pyL538-R669)

Codebase and API Changes:

  • Removed legacy parsing methods (_parse_basic_config, _parse_constraints) and updated entry points in get_pcmk_properties_db.py to use the new validation method. Also adjusted resource category exclusions for improved flexibility in resource parsing. (src/module_utils/get_pcmk_properties.py, [1] [2]; src/modules/get_pcmk_properties_db.py, [3] [4]
  • Minor type annotation and import cleanups for consistency. (src/module_utils/sap_automation_qa.py, [1]; src/modules/get_pcmk_properties_db.py, [2]

…etrieval in get_pcmk_properties.py for improved clarity and consistency
…pdate requirements.txt for package version upgrades
…terValidator for improved clarity and consistency; update required flag in constants.yaml
…esource constant checks; refactor to use constants-first validation approach.
…clean up parsing logic for improved clarity and maintainability.
…eters method and updating parameter retrieval to include unique IDs for improved clarity and functionality.
…ue handling by introducing a tuple format for expected values, improving clarity and consistency across configurations.
…ields for configuration parameters; update report.html to adjust warning color for better visibility.
…roving provider value retrieval logic for better clarity and consistency.
…date constants.yaml to enhance configuration parameter structure with 'value' and 'required' fields.
@devanshjainms devanshjainms requested a review from a team as a code owner September 23, 2025 23:05
@devanshjainms devanshjainms requested review from KimForss and removed request for a team September 23, 2025 23:05
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces significant refactoring to the HA cluster configuration validation codebase, shifting from a parsing-first to a "constants-first" validation strategy. The main changes ensure all expected parameters from constants are validated against the cluster information base (CIB), with improved support for offline validation and enhanced parameter handling with required status tracking.

  • Introduced a new validate_from_constants method replacing parse_ha_cluster_config for constants-first validation
  • Enhanced parameter handling to use tuple (value, required) format for better tracking of required parameters
  • Improved status calculation to distinguish between errors, warnings, and success for more granular feedback

Reviewed Changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/module_utils/get_pcmk_properties.py Core refactoring with new validation methods and parameter handling logic
src/modules/get_pcmk_properties_*.py Updated entry points to use new validation method
src/roles/*/constants.yaml Updated constants structure to include value and required fields
tests/ Updated test assertions to match new tuple return format
src/vars/input-api.yaml Enabled previously disabled test groups

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@hdamecharla hdamecharla self-requested a review September 24, 2025 17:12
@devanshjainms devanshjainms added the enhancement New feature or request label Sep 24, 2025
Copy link
Member

@hdamecharla hdamecharla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@devanshjainms devanshjainms merged commit 52cfb89 into Azure:development-sep-2025 Sep 30, 2025
6 checks passed
mkdeegan pushed a commit that referenced this pull request Oct 3, 2025
* Bump requests from 2.32.4 to 2.32.5 (#105)

* Bump requests from 2.32.4 to 2.32.5 (#106)

* Updated logic for HA DB/SCS cluster configuration validation  (#114)

* Restructure the documents for high availability testing (#116)

* Bump pandas from 2.3.1 to 2.3.3 (#118)

Bumps [pandas](https://github.com/pandas-dev/pandas) from 2.3.1 to 2.3.3.
- [Release notes](https://github.com/pandas-dev/pandas/releases)
- [Commits](pandas-dev/pandas@v2.3.1...v2.3.3)

---
updated-dependencies:
- dependency-name: pandas
  dependency-version: 2.3.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Devansh Jain <86314060+devanshjainms@users.noreply.github.com>

* Updated commands to get the automated-register and priority fencing delay (#122)

* Add provider value resolution and enhance parameter status determination logic

* Refactor cluster parameter retrieval logic and update related tests

* Refactor command imports and update cluster status retrieval logic to use new parameters

* Refactor HANA resource handling by renaming parameters and updating related logic across multiple files

* Refactor command execution logic to simplify parameter value retrieval

* Fix typo in method name and update related test cases for cluster parameter retrieval

* Fix inconsistent quote style in test case for cluster parameter retrieval

* Update cluster parameter retrieval to include PRIORITY_FENCING_DELAY and fix typo in test case name

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants