Skip to content

fix: limit NIC name detection to preserve_static_ips tests#536

Open
MiriSafra wants to merge 1 commit into
RedHatQE:mainfrom
MiriSafra:fix/nic-detection-gate-on-preserve-static-ips
Open

fix: limit NIC name detection to preserve_static_ips tests#536
MiriSafra wants to merge 1 commit into
RedHatQE:mainfrom
MiriSafra:fix/nic-detection-gate-on-preserve-static-ips

Conversation

@MiriSafra
Copy link
Copy Markdown
Member

@MiriSafra MiriSafra commented Jun 1, 2026

Summary

  • Gate detect_guest_nic_names (pre-migration) and check_nic_name_preservation (post-migration) on preserve_static_ips config
  • NIC name preservation udev rules are generated by the same firstboot script as static IP preservation, so they share the same precondition
  • Fixes regression from feat: add NIC name preservation check for vSphere migrations #524 where detect_guest_nic_names crashed setup on clone-based tests (e.g. copy-offload) where VMware Tools hadn't reported guestFamily yet

Summary by CodeRabbit

Bug Fixes

  • Updated network interface preservation validation logic to properly align with static IP preservation configuration.
  • Refined conditional checks for guest operations IP detection during migration, ensuring operations only execute when static IP preservation is enabled.

Refactor

  • Consolidated conditional logic for network operations to follow consistent static IP preservation checks.

NIC name preservation udev rules are generated by the same firstboot
script as static IP preservation. Gate both detect_guest_nic_names
(pre-migration) and check_nic_name_preservation (post-migration) on
preserve_static_ips config, matching the static IP check pattern.

Fixes regression where detect_guest_nic_names crashed setup on
clone-based tests (e.g. copy-offload) where VMware Tools hadn't
reported guestFamily yet.
@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
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

Walkthrough

This PR aligns NIC name preservation logic across two integration test paths. The test fixture setup and post-migration validation both now gate NIC name operations on the preserve_static_ips configuration flag, establishing consistent behavior across the test flow.

Changes

NIC name preservation conditional alignment

Layer / File(s) Summary
Test fixture NIC detection conditional
conftest.py
The prepared_plan fixture now wraps detect_guest_nic_names(...) inside an if plan.get("preserve_static_ips") block instead of calling it unconditionally after VMware Guest Operations error handling.
Post-migration NIC validation conditional
utilities/post_migration.py
The check_vms function now conditions NIC name validation on preserve_static_ips and source_vm_data presence, replacing the prior destination_vm.get("guest_agent_running") check to align with the fixture-level gate.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • RedHatQE/mtv-api-tests#524: Introduces detect_guest_nic_names for vSphere NIC name preservation and establishes the preserve_static_ips flow that this PR gates upon.

Suggested labels

size/L, branch-main, commented-coderabbitai[bot], commented-MiriSafra

Suggested reviewers

  • krcmarik
  • solenoci
  • myakove
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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 Check skipped - CodeRabbit’s high-level summary is enabled.
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 describes the main change: gating NIC name detection to only run when preserve_static_ips is enabled, which is the core fix across both conftest.py and post_migration.py.

✏️ 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

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 build-container - Rebuild and test container image
  • /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. 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
  • solenoci

Reviewers:

  • krcmarik
  • myakove
  • solenoci
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])
  • Test Oracle: Triggers: approved (cursor/gpt-5.4-xhigh-fast); /test-oracle can be used anytime

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

@MiriSafra
Copy link
Copy Markdown
Member Author

/verified

@MiriSafra MiriSafra changed the title fix: gate NIC name detection on preserve_static_ips fix: limit NIC name detection to preserve_static_ips tests Jun 1, 2026
Comment thread conftest.py
source_provider_data=fixture_store["source_provider_data"],
vm_details=source_vm_details,
)
if plan.get("preserve_static_ips"):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The gating on preserve_static_ips makes sense - NIC name detection and static IP origin detection share the same precondition of a running source guest with tools active. I believe tho that It's currently an undocumented assumption - preserve_static_ips implicitly requires source_vm_power: "on" in the test config - without a running guest, neither static IP origins nor NIC names can be collected. We should consider making it explicit with a validation in the prepared_plan fixture (validating that if we set preserve_static_ips in the text config source_vm_power is set to "on" too) or alternatively, document this requirement (or both).

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