Skip to content

Conversation

jpeimer
Copy link
Contributor

@jpeimer jpeimer commented Sep 11, 2025

Summary by CodeRabbit

  • New Features
    • Added optional Plan configuration options: type, pvcNameTemplateUseGenerateName, skipGuestConversion, targetPowerState, useCompatibilityMode, and migrateSharedDisks for finer migration control.
  • Documentation
    • Updated Plan documentation to describe the new configuration options.

Copy link

coderabbitai bot commented Sep 11, 2025

Walkthrough

Adds six optional migration-related fields to Plan in ocp_resources/plan.py, updates init to accept/store them, and extends to_dict to include corresponding spec keys when provided. Updates class docstring accordingly. No other files changed.

Changes

Cohort / File(s) Summary of changes
Plan resource enhancements
ocp_resources/plan.py
Added optional fields: type, pvc_name_template_use_generate_name, skip_guest_conversion, target_power_state, use_compatibility_mode, migrate_shared_disks; updated init to accept/store them; extended to_dict to conditionally emit spec keys: type, pvcNameTemplateUseGenerateName, skipGuestConversion, targetPowerState, useCompatibilityMode, migrateSharedDisks; updated docstring.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Plan: add typing #2235 — Also updates Plan in ocp_resources/plan.py, modifying init and related hook handling; overlaps in class interface changes.

Suggested labels

size/M, branch-main

Suggested reviewers

  • dbasunag
  • rnetser

Pre-merge checks (1 passed, 1 warning, 1 inconclusive)

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive I cannot validate the pull request description because the input did not include the PR's current description nor the repository's required description_template to compare against. The provided raw_summary documents code changes (adding six new optional Plan fields), but without the actual PR body I cannot confirm whether required sections like summary, motivation, test plan, or release notes are present or complete. Therefore the description check is inconclusive. Please provide the pull request body (or paste the current_description) and, if available, the repository description_template so I can verify compliance; ensure the PR description includes a clear summary of changes, motivation, testing steps, and any required release/compatibility notes, then I will re-run the check. If the PR already contains those sections, paste them here or point to the PR body and I will re-evaluate.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "feat: update MTV Plan resource" is concise, uses conventional-commit style, and correctly indicates the PR modifies the MTV Plan resource (matching the changes in ocp_resources/plan.py that add several optional fields). It is related to the main change described in the raw_summary, though it is somewhat broad and does not name the key additions. Overall the title is acceptable for quick scanning but could be more specific to aid clarity.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@redhat-qe-bot1
Copy link

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • Pre-commit Checks: pre-commit runs automatically if .pre-commit-config.yaml exists
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /automerge - Enable automatic merging when all requirements are met (maintainers and approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest python-module-install - Test Python package installation
  • /retest conventional-title - Validate commit message format
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 0 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No WIP, hold, or conflict labels
  5. Verified: PR must be marked as verified (if verification is enabled)

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

  • dbasunag
  • myakove
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is automatically removed on each new commit
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
ocp_resources/plan.py (3)

78-83: Persist renamed field and (optionally) validate contradictory combinations.

  • Keep internal naming consistent with the rename.
-        self.type = type
+        self.plan_type = plan_type
         self.pvc_name_template_use_generate_name = pvc_name_template_use_generate_name
         self.skip_guest_conversion = skip_guest_conversion
         self.target_power_state = target_power_state
         self.use_compatibility_mode = use_compatibility_mode
         self.migrate_shared_disks = migrate_shared_disks

Optionally add lightweight validation after these assignments (outside this hunk) to avoid conflicting config if the CRD treats warm and type as coupled:

if self.plan_type in {"warm", "live"} and not self.warm_migration:
    raise ValueError("warm_migration must be True when type is 'warm' or 'live'")
if self.plan_type == "cold" and self.warm_migration:
    raise ValueError("warm_migration must be False when type is 'cold'")

Please confirm the exact rules from the CRD before adding guards.


53-58: Avoid shadowing builtin type — optional refactor

Rename the constructor parameter typeplan_type and keep emitting spec["type"] from that value; repo has ruff configured (pyproject.toml) and .flake8 (select=FCN,M511) with no flake8-builtins/pylint W0622/A001 rules found, so this is an optional cleanliness/lint-prevention change.

-        type: str | None = None,
+        plan_type: str | None = None,
         pvc_name_template_use_generate_name: bool | None = None,
         skip_guest_conversion: bool | None = None,
         target_power_state: str | None = None,
         use_compatibility_mode: bool | None = None,
         migrate_shared_disks: bool | None = None,

138-157: Consolidate optional-field mapping; preserve spec["type"] and verify CRD keys.

  • Replace the repeated if-blocks with a single opt dict and update spec with non-None values (e.g., spec.update({k: v for k, v in opt.items() if v is not None})).
  • Keep spec["type"] sourced from self.type; if a fallback to a renamed attribute is desired use getattr(self, "type", getattr(self, "plan_type", None)).
  • Confirm the exact CRD key names (pvcNameTemplateUseGenerateName, skipGuestConversion, targetPowerState, useCompatibilityMode, migrateSharedDisks) match the CRD.

Location: ocp_resources/plan.py:138-157

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5bb6d44 and ddd16c8.

📒 Files selected for processing (1)
  • ocp_resources/plan.py (4 hunks)
🔇 Additional comments (1)
ocp_resources/plan.py (1)

23-31: Could you please paste the Plan CR you’re working with (or at least the relevant spec snippet), and indicate whether you mean the top-level spec.type/spec.targetPowerState or the per-VM entries under spec.vms[]? I’ll then fetch the exact allowed values and explain how spec.type interacts with spec.warm.

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.

2 participants