Skip to content

feat(provider): add Hyper-V provider type and managementType setting - #2783

Open
krcmarik wants to merge 2 commits into
RedHatQE:mainfrom
krcmarik:feat/hyperv-provider-type
Open

feat(provider): add Hyper-V provider type and managementType setting#2783
krcmarik wants to merge 2 commits into
RedHatQE:mainfrom
krcmarik:feat/hyperv-provider-type

Conversation

@krcmarik

@krcmarik krcmarik commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Add HYPERV constant to ProviderType and managementType optional setting to Provider class for Hyper-V standalone/cluster modes.

Summary by CodeRabbit

  • New Features
    • Added support for specifying a provider’s management type.
    • Added Hyper-V as a supported provider type.

Add HYPERV constant to ProviderType and managementType optional
setting to Provider class for Hyper-V standalone/cluster modes.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: beafa548-129e-49e8-8c65-75d222377595

📥 Commits

Reviewing files that changed from the base of the PR and between 54684e3 and 121fe14.

📒 Files selected for processing (2)
  • ocp_resources/provider.py
  • ocp_resources/utils/resource_constants.py

Walkthrough

Provider now accepts an optional management type and includes it in serialized settings. ResourceConstants.ProviderType now defines the HYPERV identifier.

Changes

Provider management type

Layer / File(s) Summary
Provider management type support
ocp_resources/provider.py, ocp_resources/utils/resource_constants.py
Provider stores and serializes management_type as spec.settings.managementType. ProviderType.HYPERV defines the value "hyperv".

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description states the main changes and purpose but omits all required template sections and supporting details. Use the repository template and add details for the short description, implementation, issue references, reviewer notes, and bug status.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the added Hyper-V provider type and optional managementType setting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add Hyper-V provider type and optional managementType setting

✨ Enhancement 🕐 10-20 Minutes

Grey Divider

AI Description

• Add Hyper-V provider type constant for MTV Provider resources.
• Extend Provider to emit optional spec.settings.managementType for Hyper-V modes.
Diagram

graph TD
  A["Client code"] --> B["Provider.__init__(management_type)"] --> C["Provider.to_dict()"] --> D["CR spec.settings.managementType"]
  E["ResourceConstants.ProviderType.HYPERV"] --> B
  C --> F["CR spec.type=hyperv"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Model managementType as an enum/constants
  • ➕ Prevents invalid strings for known management modes (e.g., standalone vs cluster).
  • ➕ Improves discoverability and autocomplete for callers.
  • ➖ Requires agreeing on/encoding allowed values and maintaining them as API evolves.
  • ➖ Slightly more surface area than a simple optional string.
2. Accept a generic Provider settings dict
  • ➕ Avoids adding a new Provider attribute for each future settings key.
  • ➕ More flexible for provider-specific settings expansions.
  • ➖ Weaker typing and discoverability; harder to validate/guide correct keys.
  • ➖ Call sites become more error-prone (stringly-typed keys).

Recommendation: Current approach (optional management_type serialized to spec.settings.managementType) is a good incremental step and keeps call sites simple. If more provider-specific settings are expected, consider introducing either a typed constants/enum for managementType values or a structured settings object to reduce future churn while preserving usability.

Files changed (2) +5 / -0

Enhancement (2) +5 / -0
provider.pyAdd optional management_type field and serialize to spec.settings +4/-0

Add optional management_type field and serialize to spec.settings

• Extends Provider initialization with an optional management_type attribute. Updates to_dict() to emit settings["managementType"] when provided, enabling Hyper-V standalone/cluster mode configuration.

ocp_resources/provider.py

resource_constants.pyAdd HYPERV provider type constant +1/-0

Add HYPERV provider type constant

• Adds ProviderType.HYPERV = "hyperv" to the shared constants to allow selecting Hyper-V as a provider type.

ocp_resources/utils/resource_constants.py

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

@redhat-qe-bot

Copy link
Copy Markdown
Contributor

Clean rebase detected — no code changes compared to previous head (121fe14).

@krcmarik

krcmarik commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants