⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@RoniKishner
Copy link
Contributor

@RoniKishner RoniKishner commented Feb 9, 2026

Short description:

Update virtual_machine_instance.py with class generator

More details:
  • Update VirtualMachineInstance class with class generator.
  • Kept the previous class functions for backwards compatibility.
What this PR does / why we need it:

Keep VirtualMachineInstance up to date and allow the use of the dry_run field in the class.

Summary by CodeRabbit

  • New Features

    • Expanded virtual machine instance settings: richer scheduling, networking, storage, resource, affinity, probes, hostname/subdomain and pod-level configuration options.
  • Bug Fixes

    • Added runtime validation to ensure required configuration is provided when creating virtual machine instances.

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Walkthrough

The VirtualMachineInstance class constructor was expanded to accept many Kubernetes/KubeVirt configuration parameters (access credentials, affinity, domain, networks, tolerations, volumes, etc.) and store them as attributes. to_dict was refactored to call super().to_dict(), validate presence of domain when creating from parameters, and populate a spec block conditionally from the new attributes. The inner Status class was removed and api_group was retyped.

Changes

Cohort / File(s) Summary
Constructor & public API
ocp_resources/virtual_machine_instance.py
Replaced lightweight constructor with a fully parameterized __init__ exposing 20+ VMI/Kubernetes fields (e.g., access_credentials, affinity, architecture, dns_config, dns_policy, domain, eviction_strategy, hostname, liveness_probe, networks, node_selector, priority_class_name, readiness_probe, resource_claims, scheduler_name, start_strategy, subdomain, termination_grace_period_seconds, tolerations, topology_spread_constraints, volumes) and added a detailed docstring.
Serialization, validation & logic
ocp_resources/virtual_machine_instance.py (to_dict)
Changed to_dict signature to -> None, now calls super().to_dict(), enforces domain presence when not using kind_dict/yaml_file (raises MissingRequiredArgumentError), and constructs a spec dict that conditionally includes numerous fields based on the new instance attributes.
Metadata, imports & class body
ocp_resources/virtual_machine_instance.py
Converted api_group to a typed class attribute (api_group: str = NamespacedResource.ApiGroup.KUBEVIRT_IO), removed the inner Status subclass/constants, added MissingRequiredArgumentError import, and added a placeholder comment marker (“# End of generated code”).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change—updating the VirtualMachineInstance class with a class generator—which aligns with the core modifications in the changeset.
Description check ✅ Passed The description covers all required template sections with appropriate content: short description, more details, and what/why justification. However, the 'Which issue(s) this PR fixes', 'Special notes for reviewer', and 'Bug' sections are not addressed.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
ocp_resources/virtual_machine_instance.py (1)

12-12: Import path deviates from established codebase pattern (generated code).

This is within the generated code block so the fix belongs in the class-generator tool, not here. The established pattern in this codebase is to import MissingRequiredArgumentError from ocp_resources.resource, not ocp_resources.exceptions.

Based on learnings: "MissingRequiredArgumentError should be imported from ocp_resources.resource (not ocp_resources.exceptions), as it's re-exported there and this is the established pattern used throughout the codebase."


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.

@RoniKishner RoniKishner marked this pull request as ready for review February 12, 2026 08:27
@rh-bot-1
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: 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. LGTM Count: Minimum 0 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No WIP, hold, conflict labels
  5. Verified: PR must be marked as verified (if verification is enabled)

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

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

@RoniKishner RoniKishner changed the title Update virtual_machine_instance.py with class generator feat: Update virtual_machine_instance.py with class generator Feb 12, 2026
@RoniKishner
Copy link
Contributor Author

/retest conventional-title

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