-
Notifications
You must be signed in to change notification settings - Fork 61
feat: update MTV Plan resource #2526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks (1 passed, 1 warning, 1 inconclusive)❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
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.
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 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. Comment |
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
There was a problem hiding this 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_disksOptionally 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 builtintype
— optional refactorRename the constructor parameter
type
→plan_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
📒 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 relevantspec
snippet), and indicate whether you mean the top-levelspec.type
/spec.targetPowerState
or the per-VM entries underspec.vms[]
? I’ll then fetch the exact allowed values and explain howspec.type
interacts withspec.warm
.
Summary by CodeRabbit