Skip to content

feat: Add process sub resource to VirtualMachineTemplate - #2775

Open
RoniKishner wants to merge 1 commit into
RedHatQE:mainfrom
RoniKishner:vmt-process
Open

feat: Add process sub resource to VirtualMachineTemplate#2775
RoniKishner wants to merge 1 commit into
RedHatQE:mainfrom
RoniKishner:vmt-process

Conversation

@RoniKishner

@RoniKishner RoniKishner commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
Short description:

Add the process action to VirtualMachineTemplate

More details:

A VirtualMachineTemplate is able to be processed, thus creating a manifest for a VirtualMachine resource to be created from.
This allows a user to call process on the VirtualMachineTemplate object.

What this PR does / why we need it:

Ability to create a VirtualMachine manifest from a VirtualMachineTemplate

Which issue(s) this PR fixes:
Special notes for reviewer:
Bug:

Summary by CodeRabbit

  • New Features

    • Added the ability to process virtual machine templates by calling the template “process” subresource, including support for optional request parameters.
    • Returns the processed result from the API as a dictionary.
  • Tests

    • Added unit tests covering the correct POST endpoint, request body contents (including default empty parameters), client selection behavior, and response-to-dictionary handling.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@RoniKishner, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 78d87994-a910-4b72-af86-2e16ba66f9f0

📥 Commits

Reviewing files that changed from the base of the PR and between 5be875b and 0fe257f.

📒 Files selected for processing (2)
  • ocp_resources/virtual_machine_template.py
  • tests/test_virtual_machine_template.py

Walkthrough

Changes

VirtualMachineTemplate processing

Layer / File(s) Summary
Process subresource request
ocp_resources/virtual_machine_template.py
Adds process() to build a ProcessOptions request, POST it to the namespaced template process endpoint, and return the response as a dictionary.
Process request validation
tests/test_virtual_machine_template.py
Adds tests for the endpoint, request body, client selection, parameter handling, and dictionary return value.

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

Suggested reviewers: myakove, rnetser

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding process support to VirtualMachineTemplate.
Description check ✅ Passed The description follows the required template and covers the main sections, though the issue, notes, and bug fields are empty.
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.

@rh-bot-1

Copy link
Copy Markdown

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 (PR author or approvers)
  • /hold cancel - Unblock PR merging (PR author or approvers)
  • /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
  • /security-override - Set security check runs to pass (maintainers only)
  • /security-override cancel - Re-run security checks

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
  • /cherry-pick-retry <branch> - Retry a failed cherry-pick (merged PRs only)

Branch Management

  • /rebase - Rebase this PR branch onto its base branch

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)
Security Checks
  • Suspicious Path Detection: Monitors paths: .claude/, .vscode/, .cursor/, .devcontainer/, .pi/, .github/workflows/, .github/actions/
  • Committer Identity Check: Verifies last committer matches PR author
  • Mandatory: Security checks block merge (use /security-override to bypass — maintainers only)

💡 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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_template.py`:
- Around line 68-101: Add tests for VirtualMachineTemplate.process covering the
generated process subresource path, ProcessOptions request body, empty default
and supplied parameters, injected client usage, and returning
response.to_dict(). Follow the existing ocp_resources test patterns and verify
the request and result without changing process behavior.
- Around line 96-100: Update the _client.request call in the virtual machine
template process operation to use the client’s accepted argument names or
positional arguments, supplying the POST method, subresource path, and body to
the required parameters _method, _path, and _body so the request executes
without TypeError.
- Line 70: Update the parameters annotation in the affected public wrapper to
dict[str, str] | None = None, matching KubeVirt’s ProcessOptions contract and
preventing unsupported value types from being accepted.
🪄 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 Plus

Run ID: 3025c10c-9a75-497f-8a94-26fe42a120e2

📥 Commits

Reviewing files that changed from the base of the PR and between c387dde and b9b93bd.

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

Comment thread ocp_resources/virtual_machine_template.py
Comment thread ocp_resources/virtual_machine_template.py Outdated
Comment thread ocp_resources/virtual_machine_template.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@tests/test_virtual_machine_template.py`:
- Around line 23-37: Replace the standalone MagicMock clients created by
_make_init_client and _make_process_client with repository-standard
get_client(fake=True) instances. Retain only the targeted mocks for
resources.search and request().to_dict() needed by each test, and update any
related fixture setup in the referenced sections to use the same fake-client
path.
🪄 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 Plus

Run ID: b991a87c-7fcf-4c80-903d-fa6a85b43bac

📥 Commits

Reviewing files that changed from the base of the PR and between b9b93bd and 5be875b.

📒 Files selected for processing (2)
  • ocp_resources/virtual_machine_template.py
  • tests/test_virtual_machine_template.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • ocp_resources/virtual_machine_template.py

Comment thread tests/test_virtual_machine_template.py Outdated
Signed-off-by: rkishner <rkishner@redhat.com>
@RoniKishner

Copy link
Copy Markdown
Contributor Author

/verified
verified using RedHatQE/openshift-virtualization-tests@main...RoniKishner:openshift-virtualization-tests:vm-template-admission

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.

4 participants