Skip to content

Conversation

@yanglei-rh
Copy link
Contributor

@yanglei-rh yanglei-rh commented Dec 9, 2025

Automate RHEL-292670 heavy network traffic test after set adapterrss

ID:LIBVIRTAT-22206
Signed-off-by: Lei Yang [email protected]

Summary by CodeRabbit

  • Tests
    • Added an automated test and configuration to validate network adapter Receive Side Scaling (RSS) on Windows virtual machines, including lifecycle control, NIC RSS configuration, and repeated performance benchmarking to log and verify throughput and stability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 9, 2025

Walkthrough

Adds a new Libvirt test configuration libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg and a new test script libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py. The config defines a Windows-only netkvm_rss_test with VM CPU topology, NIC RSS parameters, OVMF options, lifecycle steps, and PowerShell-based command templates. The script implements run(test, params, env): boots the guest, opens a serial session, copies the Speedtest utility into the VM, determines the Windows NIC name from the MAC, applies RSS settings, and executes repeated Speedtest runs with logging and an execute_command helper for timeouts and optional failure omission.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review test flow and sequencing in libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py
  • Verify execute_command timeout, logging, and omit_on_fail behavior
  • Check MAC retrieval and Windows NIC name resolution logic
  • Ensure config parameters from libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg are referenced correctly
  • Inspect the PowerShell command templates (RSS, license, start/test) and file copy/destination paths

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add case to support heavy network traffic test after set adapterrss' directly and accurately describes the main changes: adding a new test case (netkvm_rss_test) that validates network adapter RSS behavior followed by heavy network traffic testing.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

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

🧹 Nitpick comments (2)
libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg (1)

1-24: RSS queue/CPU settings may not match the intended 4‑vCPU topology

Here smp = 4, queues_nic1 = ${smp}, but vcpu_cores = 1 and set-NetAdapterRss uses ${vcpu_cores} for both -NumberOfReceiveQueues and -MaxProcessors. That effectively limits RSS to a single core/queue even though the VM/NIC are configured for 4.

If the goal is to exercise multiple RSS queues, consider tying these parameters to smp/queues_nic1 instead of a hard‑coded 1, e.g.:

-    vcpu_cores = 1
+    vcpu_cores = ${smp}
@@
-    set_adapterrss_cmd = 'powershell -command "Set-NetAdapterRss -Name \"%s\" -NumberOfReceiveQueues ${vcpu_cores} -MaxProcessors ${vcpu_cores} -Profile Conservative"'
+    set_adapterrss_cmd = 'powershell -command "Set-NetAdapterRss -Name \"%s\" -NumberOfReceiveQueues ${queues_nic1} -MaxProcessors ${smp} -Profile Conservative"'

Please double‑check that this aligns with how you expect RSS to be distributed across vCPUs.

libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py (1)

58-59: Rename unused loop index to _ to satisfy Ruff B007

The loop index i isn’t used inside the body; static analysis (B007) prefers an underscore for intentional unused vars. Simple tweak:

-    for i in range(10):
+    for _ in range(10):
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a0aed5c and 558f344.

📒 Files selected for processing (2)
  • libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg (1 hunks)
  • libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: qiankehan
Repo: autotest/tp-libvirt PR: 6652
File: libvirt/tests/cfg/virtual_network/passt/passt_function.cfg:106-106
Timestamp: 2025-11-24T10:44:47.801Z
Learning: In libvirt/tests/cfg/virtual_network/passt/passt_function.cfg, passt test cases have only one interface, so running `dhcpcd` without specifying an interface is safe and doesn't cause network disruption.
📚 Learning: 2025-11-24T10:44:47.801Z
Learnt from: qiankehan
Repo: autotest/tp-libvirt PR: 6652
File: libvirt/tests/cfg/virtual_network/passt/passt_function.cfg:106-106
Timestamp: 2025-11-24T10:44:47.801Z
Learning: In libvirt/tests/cfg/virtual_network/passt/passt_function.cfg, passt test cases have only one interface, so running `dhcpcd` without specifying an interface is safe and doesn't cause network disruption.

Applied to files:

  • libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py
  • libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg
🧬 Code graph analysis (1)
libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py (1)
provider/guest_os_booting/guest_os_booting_base.py (1)
  • get_vm (18-56)
🪛 Ruff (0.14.8)
libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py

58-58: Loop control variable i not used within loop body

Rename unused i to _i

(B007)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Python 3.11
  • GitHub Check: Python 3.8
  • GitHub Check: Python 3.12
  • GitHub Check: Python 3.9
🔇 Additional comments (1)
libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py (1)

29-57: End‑to‑end VM/RSS/Speedtest flow looks consistent

VM selection, serial login, Speedtest deployment, Windows NIC lookup (get_windows_nic_attribute), and RSS configuration via the formatted set_adapterrss_cmd all line up with the cfg parameters; I don’t see functional issues in this part of the flow.

@yanglei-rh
Copy link
Contributor Author

Hi @nanli1 @qiankehan Could you please help me review this patch? This is a widows only scenario, thanks a lot.

Copy link
Contributor

@qiankehan qiankehan left a comment

Choose a reason for hiding this comment

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

Only one tine update needed. The other LGTM

Automate RHEL-292670 heavy network traffic test after set adapterrss

Signed-off-by: Lei Yang <[email protected]>
Copy link

@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

🧹 Nitpick comments (3)
libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py (3)

19-27: Consider enhancing the command execution helper for better diagnostics.

The helper function works correctly but could provide better diagnostics:

  • It only returns output, not status, limiting caller flexibility
  • Error messages don't include the command that failed
  • Successful outputs aren't logged (only failures when omit=False)

Consider this enhancement:

-    def execute_command(command, timeout=60, omit=False):
+    def execute_command(command, timeout=60, omit_failure=False):
         """
-        Execute command and return the output
+        Execute command and return status and output
+        
+        :param command: Command to execute
+        :param timeout: Command timeout in seconds
+        :param omit_failure: If True, don't fail the test on non-zero exit
+        :return: Tuple of (status, output)
         """
         test.log.info("Sending command: %s", command)
         status, output = session.cmd_status_output(command, timeout)
-        if status != 0 and omit is False:
-            test.error("execute command fail: %s" % output)
-        return output
+        if status != 0:
+            test.log.warning("Command failed (status=%d): %s", status, output)
+            if not omit_failure:
+                test.error("Command '%s' failed: %s" % (command, output))
+        else:
+            test.log.debug("Command succeeded: %s", output)
+        return status, output

Note: This would require updating callers to handle the tuple return value.


46-50: Consider verifying that RSS settings were applied successfully.

While the command execution will fail the test if the PowerShell command returns non-zero, it would be more robust to verify the RSS configuration was actually applied by reading back the settings with Get-NetAdapterRss.

Add verification after line 50:

    # Verify RSS settings were applied
    verify_cmd = 'powershell -command "Get-NetAdapterRss -Name \\"%s\\" | Select-Object NumberOfReceiveQueues"' % ifname
    output = execute_command(verify_cmd)
    test.log.info("Current RSS settings: %s", output)

52-60: Consider adding cleanup code and final status reporting.

The test doesn't explicitly clean up the session or report final test status. While the test framework may handle session cleanup automatically, explicitly closing resources is a best practice.

Add cleanup at the end:

    # Final test status
    test.log.info("Network traffic test after RSS configuration completed")
    
    # Cleanup
    if session:
        session.close()
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 558f344 and 359b814.

📒 Files selected for processing (2)
  • libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg (1 hunks)
  • libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: qiankehan
Repo: autotest/tp-libvirt PR: 6652
File: libvirt/tests/cfg/virtual_network/passt/passt_function.cfg:106-106
Timestamp: 2025-11-24T10:44:47.801Z
Learning: In libvirt/tests/cfg/virtual_network/passt/passt_function.cfg, passt test cases have only one interface, so running `dhcpcd` without specifying an interface is safe and doesn't cause network disruption.
📚 Learning: 2025-11-24T10:44:47.801Z
Learnt from: qiankehan
Repo: autotest/tp-libvirt PR: 6652
File: libvirt/tests/cfg/virtual_network/passt/passt_function.cfg:106-106
Timestamp: 2025-11-24T10:44:47.801Z
Learning: In libvirt/tests/cfg/virtual_network/passt/passt_function.cfg, passt test cases have only one interface, so running `dhcpcd` without specifying an interface is safe and doesn't cause network disruption.

Applied to files:

  • libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py
  • libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Python 3.11
  • GitHub Check: Python 3.8
  • GitHub Check: Python 3.12
  • GitHub Check: Python 3.9
🔇 Additional comments (1)
libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py (1)

38-43: LGTM - directory creation with proper error handling.

The logic correctly handles the case where the directory already exists on Windows, which is appropriate.

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.

3 participants