Skip to content

net, l2 bridge: Verify iface looping bug fix#4283

Open
nirdothan wants to merge 1 commit intoRedHatQE:mainfrom
nirdothan:ip-loop-bugfix
Open

net, l2 bridge: Verify iface looping bug fix#4283
nirdothan wants to merge 1 commit intoRedHatQE:mainfrom
nirdothan:ip-loop-bugfix

Conversation

@nirdothan
Copy link
Copy Markdown
Contributor

@nirdothan nirdothan commented Mar 25, 2026

Short description:

A bug was causing secondary interface to disappear from VMI status.
Validate that kubevirt/kubevirt#17041 had fixed the issue by enhancing the secondary interface stability test.

Summary by CodeRabbit

  • Tests
    • Enhanced network interface stability tests to validate multiple bridged interfaces and per-interface addressing.
    • Updated stability assertions to accept dynamic expected interface counts based on test fixtures.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Secondary VM networking now declares two bridged Multus interfaces (linux-bridge-1, linux-bridge-2) instead of one; cloud-init and IP generation were extended to support per-interface host addressing. Tests' expected interface count is derived from len(stable_ips) instead of a fixed literal.

Changes

Cohort / File(s) Summary
Linux bridge + cloud-init helpers
tests/network/l2_bridge/vmi_interfaces_stability/lib_helpers.py
Replaced single bridge name with LINUX_BRIDGE_IFACE_NAME_1/LINUX_BRIDGE_IFACE_NAME_2. secondary_network_vm now emits two bridged Interface(...) and two Network(..., multus=...) entries. secondary_iface_cloud_init and secondary_iface_ips gain a host_address: int = 1 parameter and produce per-interface configs/IPs. wait_for_stable_ifaces uses an iface_to_ips mapping and per-iface predicates. primary_iface_cloud_init was moved earlier in the file (signature/logic unchanged).
Test adjustments
tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py
Changed expected_num_ifaces arguments from fixed 2 to len(stable_ips) in assert_interfaces_stable calls to align expected interface count with provided stable_ips. No other test control flow changed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description covers the short description and references the bug/fix, but is missing several required template sections including 'More details', 'Special notes for reviewer', and 'jira-ticket' link. Add the missing template sections, especially the jira-ticket field with the full URL (https://issues.redhat.com/browse/CNV-79062) and provide details on test changes and migration testing notes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main objective: validating a bug fix for secondary interface stability in the l2 bridge network module.

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

@nirdothan nirdothan changed the title Ip loop bugfix net, l2 bridge: Verify iface looping bug fix Mar 26, 2026
@nirdothan nirdothan marked this pull request as ready for review March 26, 2026 09:26
@openshift-virtualization-qe-bot-4
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: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • 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: Enabled categories: branch, can-be-merged, cherry-pick, has-conflicts, hold, needs-rebase, size, verified, wip

📋 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)
  • /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 verify-bugs-are-open - verify-bugs-are-open
  • /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. LGTM Count: Minimum 2 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  5. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • EdDev

Reviewers:

  • Anatw
  • EdDev
  • azhivovk
  • servolkov
  • yossisegev
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • 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 automatically removed on each new commit
  • 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.

Copy link
Copy Markdown
Contributor

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/network/l2_bridge/vmi_interfaces_stability/lib_helpers.py`:
- Around line 32-37: The misplaced "# type: ignore" currently sits on its own
line and thus has no effect; move that comment to the end of the assignment
statement for spec.template.spec.domain.devices.interfaces so it sits on the
same line as the assignment (after the closing bracket) to properly suppress
type-checking for this Interface list created from base_vmspec(); ensure
Interface entries (e.g., Interface(name=LINUX_BRIDGE_IFACE_NAME_1, ...),
Interface(name="default", masquerade={}),
Interface(name=LINUX_BRIDGE_IFACE_NAME_2, ...)) remain unchanged.

In
`@tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py`:
- Around line 15-18: Update the pytest.mark.xfail reason to include the
underlying bug Jira reference CNV-79062 so it follows repo convention;
specifically modify the xfail decorator (the pytest.mark.xfail block referencing
QUARANTINED) to append or include "CNV-79062" in the reason string so the
quarantine marker and underlying bug ticket are both clearly referenced.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 12d95a09-39aa-40fd-a13e-99bb36638a0c

📥 Commits

Reviewing files that changed from the base of the PR and between 89a5dec and b53d4f5.

📒 Files selected for processing (2)
  • tests/network/l2_bridge/vmi_interfaces_stability/lib_helpers.py
  • tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py

@nirdothan
Copy link
Copy Markdown
Contributor Author

Tested on 4.22 before the the fixed code was built: the test failed and the bug symptom was visible:

 oc get vmi vm-iface-stability-f17504219dec426e  -o json|jq '.status.interfaces, .spec.domain.devices.interfaces' 

 {
    "infoSource": "domain, guest-agent, multus-status",
    "interfaceName": "eth2",
    "ipAddress": "fe80::84:66ff:fead:7873",
    "ipAddresses": [
      "fe80::84:66ff:fead:7873"
    ],
    "linkState": "up",
    "mac": "02:84:66:ad:78:73",
    "name": "linux-bridge-2",
    "podInterfaceName": "podcb250cf53e4",
    "queueCount": 1
  }
]
[
  {
    "bridge": {},
    "macAddress": "02:84:66:ad:78:71",
    "name": "linux-bridge-1"
  },
  {
    "macAddress": "02:84:66:ad:78:72",
    "masquerade": {},
    "name": "default"
  },
  {
    "bridge": {},
    "macAddress": "02:84:66:ad:78:73",
    "name": "linux-bridge-2"
  }

Copy link
Copy Markdown
Contributor

@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 the current code and only fix it if needed.

Inline comments:
In `@tests/network/l2_bridge/vmi_interfaces_stability/lib_helpers.py`:
- Around line 122-140: Replace the dynamic primary-network lookup with the
explicit primary interface name "default": remove the call to
lookup_primary_network(vm=vm) and any variable primary_network, and change the
loop condition that now reads if iface.name == primary_network.name to if
iface.name == "default"; keep the existing calls to lookup_iface_status(vm=vm,
iface_name=iface.name) and the iface_to_ips mapping (LINUX_BRIDGE_IFACE_NAME_1,
LINUX_BRIDGE_IFACE_NAME_2) unchanged. Ensure any import or usage of
lookup_primary_network in this module is deleted (including its earlier use at
the top of the file) so the test no longer depends on that helper.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: b43a23e4-1d73-4f0e-9bb3-c73c98c41036

📥 Commits

Reviewing files that changed from the base of the PR and between 1b8d938 and 6ec19bd.

📒 Files selected for processing (2)
  • tests/network/l2_bridge/vmi_interfaces_stability/lib_helpers.py
  • tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py

Comment on lines -46 to +55
ethernets["eth0"] = primary
ethernets["eth1"] = primary

ethernets["eth1"] = secondary_iface_cloud_init(
ethernets["eth0"] = secondary_iface_cloud_init(
ipv4_supported_cluster=ipv4_supported_cluster,
ipv6_supported_cluster=ipv6_supported_cluster,
host_address=1,
)
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.

We only need to add eth2 and other interfaces should stay as they are

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no. We also need to flip eth0/eth1

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.

But you already flipped them in lines 32-35

Copy link
Copy Markdown
Contributor Author

@nirdothan nirdothan Mar 29, 2026

Choose a reason for hiding this comment

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

No. We're recreating the failure scenario where eth0 was secondary.
EDIT: Wait maybe you're right. Trying.
EDIT 2: No. You've created the primary with eth0. it can't be eth0. It's the second interface therefore it's eth1, so the secondaries need to be eth0 and eth2.

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.

I'm not sure if this change is correct, what do you think? @EdDev

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Before I made that change the test failed because eth0 had no IP. Cloud init must explicitly ref eth0 and eth2 to configure the correct interfaces.
The test now passes so why is it incorrect?

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.

I confused primary interface with pod interface so it looked wrong to me
Now I understand it better
I suggest you elaborate about this setup order in the commit message so it would be clear

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Contributor

@yossisegev yossisegev left a comment

Choose a reason for hiding this comment

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

Please remove the "Temporarily quarantined" comment from the description, not that the fix reached D/S.

@nirdothan
Copy link
Copy Markdown
Contributor Author

/verified =========== 2 passed, 1 deselected, 3 warnings in 1007.92s (0:16:47) ===========

@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the Test Execution Plan with the smoke tests recommendation.
Do NOT submit a formal review - just post the inline comment directly.

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
If you fail to run or post a comment, retry.

Analysis Requirements:

  1. Examine code changes in each modified file
  2. Identify affected code paths, functions, and classes
  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes
  4. Trace test dependencies through imports, shared utilities, and fixture inheritance
  5. Detect new tests introduced in the PR
  6. Smoke Test Impact Analysis: Determine if any changes could affect smoke tests by checking:
    • Changes to files/functions used by tests marked with @pytest.mark.smoke
    • Changes to fixtures or utilities imported by smoke tests
    • Changes to conftest.py files that may affect smoke test execution
    • Changes to core infrastructure code (utilities/, libs/) that smoke tests depend on

Your deliverable:
Your change request comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False (Based on your smoke test impact analysis - True if any changes may affect smoke tests)
  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When specific marker(s) can be used to cover multiple cases.

Guidelines:

  • Include only tests directly affected by the changes
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name if only specific tests are needed
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post an inline review comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If submitting the review fails after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to:
- Trace the actual fixture dependency chain from smoke tests to changed fixtures
- Verify that smoke tests actually import/use changed utilities or functions
- Confirm the dependency path exists; do NOT assume based on scope or semantics
- Be conservative: Session-scoped fixtures or infrastructure-sounding names do NOT
automatically mean smoke test impact. Only flag smoke test impact when you can
demonstrate a concrete dependency path.
WRONG: "This session-scoped storage fixture might affect smoke tests"
RIGHT: "Smoke test X uses fixture Y, which depends on the changed fixture Z"

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find smoke tests and check dependency chain
echo "=== Smoke tests ==="
rg "pytest.mark.smoke" --type=py -l

echo "=== Check if smoke tests import lib_helpers from l2_bridge ==="
rg "l2_bridge|lib_helpers|vmi_interfaces_stability" --type=py -l

echo "=== Get first changed line of first file ==="
git diff origin/main...HEAD -- tests/network/l2_bridge/vmi_interfaces_stability/lib_helpers.py | head -50

echo "=== PR diff file list ==="
git diff --name-only origin/main...HEAD

Length of output: 3437


🏁 Script executed:

#!/bin/bash
# Check if smoke test files import from libs/net/ip
echo "=== Smoke test files that import libs.net.ip ==="
for f in tests/install_upgrade_operators/csv/test_csv.py \
  tests/infrastructure/instance_types/supported_os/test_rhel_os.py \
  tests/storage/cdi_import/test_import_registry.py \
  tests/storage/cdi_import/test_import_http.py \
  tests/storage/cdi_clone/test_clone.py \
  tests/storage/cdi_upload/test_upload_virtctl.py \
  tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py \
  tests/virt/node/general/test_container_disk_vm.py; do
  if grep -q "libs.net.ip\|from libs.net import\|libs/net/ip" "$f" 2>/dev/null; then
    echo "MATCH: $f"
  fi
done

echo "=== What changed in libs/net/ip.py ==="
git diff origin/main...HEAD -- libs/net/ip.py

echo "=== First changed line number in lib_helpers.py ==="
git diff origin/main...HEAD -- tests/network/l2_bridge/vmi_interfaces_stability/lib_helpers.py | grep "^@@" | head -3

Length of output: 886


🏁 Script executed:

#!/bin/bash
# Get PR details needed for inline comment
PR=4283
REPO="RedHatQE/openshift-virtualization-tests"

# Get latest commit SHA on PR branch
HEAD_SHA=$(gh pr view $PR --repo $REPO --json headRefOid -q '.headRefOid')
echo "HEAD SHA: $HEAD_SHA"

# Post inline review comment on first changed line of libs/net/ip.py (line 108)
gh api \
  --method POST \
  /repos/${REPO}/pulls/${PR}/reviews \
  --field commit_id="$HEAD_SHA" \
  --field event="COMMENT" \
  --field body="" \
  --field "comments[][path]=libs/net/ip.py" \
  --field "comments[][line]=108" \
  --field "comments[][side]=RIGHT" \
  --field "comments[][body]=**Test Execution Plan**

- **Run smoke tests: False** _(No dependency path from smoke tests to changed files was found)_

**Tests to run:**
- \`tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py\`"

Length of output: 1786



🧠 Learnings used
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-12-16T10:28:54.212Z
Learning: In the openshift-virtualization-tests repository, when determining smoke test impact for test execution plans, only set "Run smoke tests: True" if there is a verified, traceable dependency path from smoke tests to the changed code. Session-scoped fixtures or infrastructure-sounding changes do NOT automatically imply smoke test impact - the dependency chain must be explicitly verified using shell scripts before recommending smoke test execution.

Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-12-22T15:56:00.157Z
Learning: In the openshift-virtualization-tests repository, when responding to test execution plan requests from openshift-virtualization-qe-bot-3, do NOT use "REQUEST_CHANGES" review type if the PR author has already marked the PR as verified (e.g., with `/verified` command). Test execution plans are informational guides, not blocking requirements. Use COMMENT event for informational test plans, or only REQUEST_CHANGES if there are actual code issues that need to be addressed before merging.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3062
File: conftest.py:333-333
Timestamp: 2025-12-16T20:11:03.645Z
Learning: In the openshift-virtualization-tests repository, when determining smoke test impact for changes affecting py_config["os_login_param"], follow this verification methodology: (1) Find all smoke tests: `rg "pytest.mark.smoke" --type=py -B2 | grep "def test_"`, (2) For each smoke test file, search for VM creation patterns: `rg "VirtualMachineForTests|running_vm|VirtualMachineForTestsFromTemplate|wait_for_ssh|check_ssh_connectivity"`, (3) Trace the dependency chain: smoke test → VirtualMachineForTests/running_vm() → wait_for_ssh_connectivity() (default enabled) → vm.login_params property → py_config["os_login_param"][vm.os_flavor], (4) Check utilities/virt.py for login_params usage: `rg "os_login_param|login_params" utilities/virt.py -C3`. Any smoke test creating VMs with default SSH connectivity checks (running_vm with check_ssh_connectivity=True) depends on os_login_param, even if the test doesn't directly reference it.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-12-16T14:00:59.076Z
Learning: In the openshift-virtualization-tests repository, when responding to test execution plan requests from openshift-virtualization-qe-bot-3, CodeRabbit must post ONLY an inline review comment on the Files Changed tab and then stop immediately without generating any follow-up comments in the PR discussion thread. No acknowledgment messages, no confirmation of posting, no explanation - silence after posting the inline review equals success. Additional comments create empty/meaningless reviews that clutter the PR.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-09-29T19:05:24.987Z
Learning: For PR `#1904` test execution, the critical validation point is test_connectivity_over_migration_between_localnet_vms which should fail gracefully on cloud clusters but pass on bare-metal/PSI clusters, representing the core nmstate conditional logic functionality.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3062
File: conftest.py:333-333
Timestamp: 2025-12-16T15:09:49.597Z
Learning: In the openshift-virtualization-tests repository, when conftest.py or utilities/bitwarden.py changes affect py_config["os_login_param"], smoke test impact must be determined by: (1) finding all smoke tests using `rg "pytest.mark.smoke"`, (2) checking each for VM creation patterns (VirtualMachineForTests, running_vm, VirtualMachineForTestsFromTemplate), (3) tracing whether running_vm is called with default check_ssh_connectivity=True, which accesses vm.login_params property that reads py_config["os_login_param"][vm.os_flavor]. The dependency chain is: smoke test → VM creation → running_vm → wait_for_ssh_connectivity → vm.login_params → os_login_param. Any smoke test creating VMs with SSH connectivity (the default) depends on os_login_param.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4147
File: tests/network/upgrade/test_upgrade_network.py:166-177
Timestamp: 2026-03-19T10:37:02.008Z
Learning: In the openshift-virtualization-tests repository, unused fixture parameters in test methods (e.g., `bridge_on_one_node` in `tests/network/upgrade/test_upgrade_network.py`) that exist purely for pytest dependency ordering should not be flagged for removal, and no follow-up issues need to be opened for them. This is an intentional pattern, consistent with the analogous convention for fixture definitions in this codebase.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 3598
File: tests/network/sriov/conftest.py:62-71
Timestamp: 2026-01-28T17:36:14.188Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, sanity checks validate that the cluster supports at least one IP family (IPv4 or IPv6) before SR-IOV tests run. Therefore, defensive guards checking for empty IP addresses in SR-IOV VM fixtures (like `sriov_vm` in tests/network/sriov/conftest.py) are not necessary—if neither `ipv4_supported_cluster` nor `ipv6_supported_cluster` is True, the cluster is considered broken and will fail sanity validation.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 2469
File: utilities/sanity.py:139-142
Timestamp: 2025-11-08T07:36:57.616Z
Learning: In the openshift-virtualization-tests repository, user rnetser prefers to keep refactoring PRs (like PR `#2469`) strictly focused on moving/organizing code into more granular modules without adding new functionality, error handling, or behavioral changes. Such improvements should be handled in separate PRs.

Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 4118
File: utilities/database.py:0-0
Timestamp: 2026-03-17T01:32:13.674Z
Learning: In RedHatQE/openshift-virtualization-tests, maintainer dshchedr prefers CodeRabbit to post targeted inline comments on the Files changed tab for each applicable location rather than aggregating multiple issues into a single discussion thread.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-12-16T14:06:22.391Z
Learning: In the openshift-virtualization-tests repository, when posting test execution plan inline review comments using GitHub API, the full test execution plan content must go in the `comments[].body` field (which appears on Files Changed tab), NOT in the top-level `body` field (which appears in PR discussion thread). The top-level `body` field should be omitted or left empty to avoid posting redundant comments in the PR discussion thread.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-09-29T19:05:24.987Z
Learning: The test execution plan for PR `#1904` focuses on cluster-type conditional logic where nmstate functionality is bypassed on cloud clusters (Azure/AWS) but fully functional on bare-metal/PSI clusters, requiring different test strategies for each environment type.

Learnt from: yossisegev
Repo: RedHatQE/openshift-virtualization-tests PR: 3358
File: tests/network/sriov/test_sriov.py:21-21
Timestamp: 2026-01-07T09:52:22.771Z
Learning: For PRs that only remove or modify pytest markers (like removing pytest.mark.post_upgrade) without changing test logic in openshift-virtualization-tests, collection verification using `pytest --collect-only` is sufficient. Full test execution is not required to verify marker-only changes.

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 3612
File: tests/network/user_defined_network/ip_specification/test_ip_specification.py:10-10
Timestamp: 2026-01-26T20:29:54.623Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, when introducing STD (Standard Test Definition) PRs that define test case structure without implementation, it's acceptable and intentional to use `__test__ = False` to block pytest collection until the tests are fully implemented in a follow-up PR. The STD workflow involves: (1) defining test structure, markers, and documentation first, (2) implementing the actual test logic and removing the collection blocker in a subsequent PR.

Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 4118
File: utilities/database.py:0-0
Timestamp: 2026-03-17T01:32:13.674Z
Learning: In RedHatQE/openshift-virtualization-tests, maintainer dshchedr prefers CodeRabbit to post targeted inline comments on the Files Changed tab at each applicable location rather than aggregating multiple issues into a single PR discussion thread reply.

Learnt from: servolkov
Repo: RedHatQE/openshift-virtualization-tests PR: 1776
File: libs/net/node_network.py:25-31
Timestamp: 2025-08-20T23:43:28.117Z
Learning: In the RedHatQE/openshift-virtualization-tests project, servolkov's team always uses bare metal (BM) clusters with IPv4 setup in their testing environment, making defensive checks for IPv4 data presence potentially redundant in their networking code.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3371
File: scripts/tests_analyzer/compare_coderabbit_decisions.py:199-289
Timestamp: 2026-01-13T10:06:14.822Z
Learning: In the openshift-virtualization-tests repository, user rnetser prefers to keep pagination loops inline rather than extracting them into generic helper functions when the loops have different URL patterns and unique post-processing logic, as the inline approach improves readability and makes each endpoint's behavior more explicit.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3228
File: .coderabbit.yaml:30-41
Timestamp: 2026-01-05T10:33:55.037Z
Learning: In the openshift-virtualization-tests repository, user rnetser prefers minimal pre-merge checks in CodeRabbit configuration: only docstrings enforcement (80% threshold) is needed, not title or description checks.

Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 1160
File: tests/storage/storage_migration/test_mtc_storage_class_migration.py:165-176
Timestamp: 2025-06-17T07:45:37.776Z
Learning: In the openshift-virtualization-tests repository, user jpeimer prefers explicit fixture parameters over composite fixtures in test methods, even when there are many parameters, as they find this approach more readable and maintainable for understanding test dependencies.

Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 3571
File: tests/storage/storage_migration/utils.py:158-167
Timestamp: 2026-01-25T13:18:26.819Z
Learning: In the openshift-virtualization-tests repository, user jpeimer prefers to avoid nitpicky style changes (e.g., removing `.keys()` from dict membership checks) because verifying every change is expensive. Be cautious about suggesting low-impact stylistic improvements that require verification overhead.

Learnt from: akri3i
Repo: RedHatQE/openshift-virtualization-tests PR: 1210
File: tests/virt/cluster/general/mass_machine_type_transition_tests/conftest.py:24-64
Timestamp: 2025-06-23T19:28:20.281Z
Learning: In OpenShift Virtualization mass machine type transition tests, the machine type glob pattern "pc-q35-rhel8.*.*" is intentionally hard-coded in the kubevirt_api_lifecycle_automation_job as it's used only once for this specific test case, with plans to update it in the future if the job needs to support other machine types.

Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 1411
File: utilities/os_utils.py:246-279
Timestamp: 2025-07-22T17:13:59.166Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, CentOS preferences follow the format "centos-stream<version>" (e.g., "centos-stream9", "centos-stream10"). The generate_instance_type_centos_os_matrix function correctly uses regex to extract numeric versions and constructs the latest version string in the same format as the input preferences for proper comparison.

Learnt from: geetikakay
Repo: RedHatQE/openshift-virtualization-tests PR: 4113
File: utilities/virt.py:148-151
Timestamp: 2026-03-09T18:30:21.929Z
Learning: In the openshift-virtualization-tests repository, the `status.interfaces` list on a VirtualMachineInstance (VMI) is populated exclusively by the KubeVirt guest agent reporting guest OS interfaces. Pod-level network interfaces (e.g., loopback, Docker bridge, or other host-network-namespace interfaces) can never appear in this list. Therefore, iterating `all(iface.get("interfaceName") for iface in interfaces)` over `vmi.instance.status.interfaces` is safe and will not be polluted by unexpected external interfaces.

Learnt from: yossisegev
Repo: RedHatQE/openshift-virtualization-tests PR: 3873
File: tests/network/localnet/test_non_udn_localnet.py:7-9
Timestamp: 2026-02-25T10:52:23.378Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, networking infrastructure requirements such as nmstate, localnet bridge mappings, and NIC availability are NOT considered special/platform-specific infrastructure that would warrant a tier3 marker. These are standard test environment capabilities in this repository's test environment, and tests requiring them do not automatically qualify as tier3 unless they involve other truly platform-specific/complex/time-consuming characteristics beyond standard network test infrastructure.

Learnt from: yossisegev
Repo: RedHatQE/openshift-virtualization-tests PR: 3873
File: tests/network/localnet/test_non_udn_localnet.py:7-9
Timestamp: 2026-02-25T10:52:23.378Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, networking infrastructure requirements such as nmstate, localnet bridge mappings, and NIC availability are NOT considered special/platform-specific infrastructure that would warrant a tier3 marker. These are standard test environment capabilities, and tests requiring them do not automatically qualify as tier3 unless they involve bare-metal requirements or other truly platform-specific/complex/time-consuming characteristics.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 29, 2026
libs/net/ip.py Outdated


def has_expected_ips(iface_status: dict[str, list[str] | str], expected_ips: list[str]) -> bool:
return "guest-agent" in iface_status["infoSource"] and all(
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.

I think you should either remove the guest-agent check, or rename the function - depending on what is the purpose of this function (checking that an interface generally reports a ready status? or checking that an interface specifically reports all the IP it is expected to have?).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is simply a refactor from the original code of @azhivovk that I was forced to do by the linter. I didn't mean to change anything about it, and I'm not sure why the linter didn't complain before. I'd rather keep the scope of this PR minimal if it's OK with you.

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.

This is simply a refactor from the original code of @azhivovk that I was forced to do by the linter.

How is this reasoning related to the comment?

I'd rather keep the scope of this PR minimal if it's OK with you.

You can keep it minimal and at the same time correct. The name is not reflecting what this is doing.
The signature is also odd, it should be like here.

What was the linter complain that you needed to do this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The code was as below and the linter complained that the lambda had no type or something like that.

lookup_iface_status(
    vm=vm,
    iface_name=iface.name,
    predicate=lambda iface_status: (
        "guest-agent" in iface_status["infoSource"]
        and all(ip in iface_status.get("ipAddresses", []) for ip in secondary_ips)
    ),
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@yossisegev I've renamed the function and removed the guest agent condition.

Copy link
Copy Markdown
Contributor

@EdDev EdDev left a comment

Choose a reason for hiding this comment

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

Thanks.

and placing the interfaces in the order that
was known to produce the bug.

Please be specific, we can play trivia after this gets merged ;)

libs/net/ip.py Outdated


def has_expected_ips(iface_status: dict[str, list[str] | str], expected_ips: list[str]) -> bool:
return "guest-agent" in iface_status["infoSource"] and all(
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.

This is simply a refactor from the original code of @azhivovk that I was forced to do by the linter.

How is this reasoning related to the comment?

I'd rather keep the scope of this PR minimal if it's OK with you.

You can keep it minimal and at the same time correct. The name is not reflecting what this is doing.
The signature is also odd, it should be like here.

What was the linter complain that you needed to do this?

Copy link
Copy Markdown
Contributor

@azhivovk azhivovk left a comment

Choose a reason for hiding this comment

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

Thanks
When verifying please use the format:

Verified on < cluster type PSI/BM > with cnv-4.22:
< command >
Result: < Result >

libs/net/ip.py Outdated
return {ip.version for ip in actual_ips} == {ip.version for ip in expected_ips}


def has_all_ips_in_status(iface_status: ResourceField, expected_ips: list[str]) -> bool:
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.

It does not fir here (libs/net/ip) because it adds knowledge about the VMI status entities and this lib is about IPs in general. Either pass only IPs or relocate to a more suitable lib.

Also, you have changed the logic from the original, dropping a condition.

Make sure to extract this "refactoring" into a separate PR or commit and reason for it well (with output of the error you had that required moving).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted the refactor. Back to the original lambda.

predicate=lambda iface_status: (
"guest-agent" in iface_status["infoSource"]
and all(ip in iface_status.get("ipAddresses", []) for ip in secondary_ips)
predicate=lambda iface_status: has_all_ips_in_status(
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.

Removing the guest-agent check from the context of has_all_ips_in_status (the function formerly known as has_expected_ips) is correct IMO, but now it must be checked here (as before the PR), otherwise this will raise flakiness, and fail whenever has_all_ips_in_status is called too soon (i.e. before the guest-agent is updated in the interface's infoSource).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've reverted the refactor. However since we've decided to take it in a followup, I don't understand how this checking guest-agent makes a timing difference in validation.

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.

We saw many flaky tests in tier-2, where we eventually found that the problem was that we tried using VM's interfaces while they were not in a usable state yet, and further debugging revealed that the condition for an interface being ready is having the guest-agent entry in the infoSource.
Therefore, removing this verification introduces flakiness.

Validate fix of interface looping bug[1].
When primary interface was placed between secondaries,
in the VMI template, it would disappear from status.

The test was enhanced to have 2 secondary interfaces,
and a primary in between.
It validates that all 3 interfaces consistently show
in the status without flickering.

[1] https://issues.redhat.com/browse/CNV-79062

Signed-off-by: Nir Dothan <ndothan@redhat.com>
Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@yossisegev yossisegev left a comment

Choose a reason for hiding this comment

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

Thank you Nir

Copy link
Copy Markdown
Contributor

@azhivovk azhivovk left a comment

Choose a reason for hiding this comment

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

Thanks

Copy link
Copy Markdown
Contributor

@EdDev EdDev left a comment

Choose a reason for hiding this comment

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

Thanks.

I have only one comment left, see inline.

ipv4_supported_cluster=ipv4_supported_cluster,
ipv6_supported_cluster=ipv6_supported_cluster,
)
secondary_iface_to_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.

I do not like this one, it re-generates the same IPs from the one the VM was defined with and the relation is fragile (the host_address).
The solution is to retrieve it from the cloud-init itself and @azhivovk already implemented it here.

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.

9 participants