Skip to content

fix: correct volumeRestorePolicy assignment in `VirtualMachineRestore#2726

Open
acinko-rh wants to merge 1 commit into
RedHatQE:mainfrom
acinko-rh:fix_volume_restore_policy_attribute
Open

fix: correct volumeRestorePolicy assignment in `VirtualMachineRestore#2726
acinko-rh wants to merge 1 commit into
RedHatQE:mainfrom
acinko-rh:fix_volume_restore_policy_attribute

Conversation

@acinko-rh
Copy link
Copy Markdown

@acinko-rh acinko-rh commented May 20, 2026

Short description:

There was a mistake in naming of one attribute. This provides a fix.

More details:

The attribute was volume_name_policy mapping to volumeNamePolicy in kubevirt. The actual mapping should be volume_restore_policy to volumeRestorePolicy.

What this PR does / why we need it:
Which issue(s) this PR fixes:

Fixes the assignment of the restore policy in the test code. It actually applies in kubevirt.

Special notes for reviewer:

https://redhat.atlassian.net/browse/CNV-80304

Bug:

Summary by CodeRabbit

  • Bug Fixes
    • Virtual machine restore operations now use updated policy configuration parameters for improved API consistency.

Review Change Stack

Signed-off-by: Adam Cinko <acinko@redhat.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Walkthrough

VirtualMachineRestore renames a constructor parameter from volume_name_policy to volume_restore_policy, updates the instance field, and changes the corresponding spec key in serialization from volumeNamePolicy to volumeRestorePolicy.

Changes

Volume Restore Policy Rename

Layer / File(s) Summary
Constructor parameter and spec serialization update
ocp_resources/virtual_machine_restore.py
Constructor parameter renamed from volume_name_policy to volume_restore_policy, instance field assignment updated, and to_dict() now conditionally writes spec["volumeRestorePolicy"] instead of spec["volumeNamePolicy"].

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description includes key sections (short description, more details, issue reference) and explains the naming mistake and its fix, though 'What this PR does / why we need it' section is empty.
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.
Title check ✅ Passed The title accurately summarizes the main change: correcting the volumeRestorePolicy assignment in VirtualMachineRestore by renaming the parameter from volume_name_policy to volume_restore_policy.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

@redhat-qe-bot
Copy link
Copy Markdown
Contributor

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: Disabled for this repository
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: All label categories are enabled (default configuration)

📋 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
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message

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

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. Status Checks: All required status checks must pass
  3. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  4. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

  • myakove
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge
AI Features
  • Conventional Title: Mode: fix (claude/claude-opus-4-6[1m])
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • 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.

@redhat-qe-bot redhat-qe-bot requested review from myakove and rnetser May 20, 2026 11:57
@redhat-qe-bot redhat-qe-bot changed the title fix volumeRestorePolicy assignment in VirtualMachineRestore object fix: correct volumeRestorePolicy assignment in `VirtualMachineRestore May 20, 2026
Copy link
Copy Markdown

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ocp_resources/virtual_machine_restore.py`:
- Line 26: The change in VirtualMachineRestore from volumeNamePolicy to
volumeRestorePolicy is correct per KubeVirt API but is inconsistent with the
VirtualMachineClone implementation; update VirtualMachineClone to use the same
naming and spec key (replace the volume_name_policy parameter and
volumeNamePolicy spec key with volume_restore_policy / volumeRestorePolicy or
another consistent pair), or if the difference is intentional, add a clear
comment/docstring in both VirtualMachineRestore and VirtualMachineClone
explaining the reason; locate symbols VirtualMachineClone, volume_name_policy,
and volumeNamePolicy in the clone class and align them with
VirtualMachineRestore's volume_restore_policy and volumeRestorePolicy.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5bcc1612-ba07-4b04-bc62-9d5ffa24c899

📥 Commits

Reviewing files that changed from the base of the PR and between 78a6683 and 7664e88.

📒 Files selected for processing (1)
  • ocp_resources/virtual_machine_restore.py

Comment thread ocp_resources/virtual_machine_restore.py
@jpeimer
Copy link
Copy Markdown
Contributor

jpeimer commented May 20, 2026

/lgtm

yaml_file=None,
delete_timeout=TIMEOUT_4MINUTES,
volume_name_policy=None,
volume_restore_policy=None,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this introdcues a breaking change
how was this verified if this is a wrong name?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

we can look in the git blame

Copy link
Copy Markdown
Contributor

@jpeimer jpeimer May 20, 2026

Choose a reason for hiding this comment

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

It was introduced only 2 weeks ago #2709
I believe @vsibirsk looked at the VMClone and thought it's the same field name for VMRestore, but it's different (and Vasiliy noticed this in the initial review for @acinko-rh's PR in the tests repo)

VirtualMachineRestore.spec.volumeRestorePolicy
VirtualMachineClone.spec.volumeNamePolicy

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.

6 participants