-
Notifications
You must be signed in to change notification settings - Fork 181
Fix wrongly set expr_driver for vfio_vfio variant #6617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The vfio_vfio variant uses the generic vfio-pci driver but was incorrectly expecting mlx5_vfio_pci driver. This caused false test failures where the test reported 'Get incorrect driver vfio-pci, it should be mlx5_vfio_pci' even though the actual driver was correct. Changes: - Add expr_driver = 'vfio-pci' for the vfio_vfio variant - Move test_pf parameter to x86_64 section only (not needed for aarch64) AI assisted code and commit. Human reviewed.
WalkthroughMoved Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Runner as Test runner
participant CFG as Variant config file
participant Parser as parse_iface_dict()
participant VMTest as VFIO attach/detach logic
note right of CFG #E8F8E8: Config variants include\nx86_64 (now has `test_pf`),\nmlx5_vfio, vfio_vfio
Runner->>CFG: load variant (e.g., x86_64 / mlx5_vfio / vfio_vfio)
CFG-->>Runner: return variant data (includes test_pf, expr_driver, original_driver)
Runner->>Parser: parse_iface_dict(variant data)
Parser->>Parser: read original_driver (default "mlx5_core")
Parser-->>Runner: iface dict with driver fields
Runner->>VMTest: run attach/detach using iface dict
VMTest->>VMTest: verify driver post-detach using original_driver
VMTest-->>Runner: test result (pass/fail)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ 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)
🔇 Additional comments (2)
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. Comment |
The test was hardcoded to expect 'mlx5_core' as the original driver after detaching VFIO devices, but different systems use different original drivers (e.g., 'igbvf' on Intel systems). Changes: - Add original_driver parameter to config variants - Update test script to use configurable original_driver instead of hardcoded 'mlx5_core' - Set original_driver = 'igbvf' for vfio_vfio variant to match Intel systems - Set original_driver = 'mlx5_core' for mlx5_vfio variant for Mellanox systems This fixes the error: 'Get incorrect driver igbvf, it should be mlx5_core' AI assisted code and commit. Human reviewed.
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
libvirt/tests/cfg/sriov/plug_unplug/sriov_attach_detach_device_vfio_variant_driver.cfg(1 hunks)libvirt/tests/src/sriov/plug_unplug/sriov_attach_detach_device_vfio_variant_driver.py(1 hunks)
🧰 Additional context used
🪛 Ruff (0.14.0)
libvirt/tests/src/sriov/plug_unplug/sriov_attach_detach_device_vfio_variant_driver.py
45-45: Local variable original_driver is assigned to but never used
Remove assignment to unused variable original_driver
(F841)
⏰ 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.9
- GitHub Check: Python 3.12
- GitHub Check: Python 3.8
🔇 Additional comments (2)
libvirt/tests/cfg/sriov/plug_unplug/sriov_attach_detach_device_vfio_variant_driver.cfg (2)
12-12: LGTM - original_driver correctly set for mlx5_vfio variant.This properly specifies the original driver that should be restored after detaching the VF device.
7-9: No issues found with aarch64 compatibility.The original review concern is incorrect. While
test_pfis now defined only for x86_64 in the config, the Python code insriov_vfio.py(line 67) has a default value: test_pf = params.get("test_pf", "ens3f0np0")This means aarch64 will receive the same default value ("ens3f0np0") even when test_pf is not defined in the config. Both architectures will have identical behavior, and the
is_linked()function receives a valid string parameter on both platforms.
| expr_driver = "vfio-pci" | ||
| original_driver = "igbvf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good fix for vfio_vfio expected driver, but Python code needs update.
Line 15 correctly fixes the issue described in the PR objectives - the vfio_vfio variant now expects the correct "vfio-pci" driver instead of inheriting the "mlx5_vfio_pci" default from line 4.
However, line 16 sets original_driver = "igbvf" but the Python code at line 103 in sriov_attach_detach_device_vfio_variant_driver.py hardcodes exp_driver="mlx5_core" when checking the driver after detachment. This will cause the vfio_vfio variant to fail when verifying driver restoration.
🤖 Prompt for AI Agents
In
libvirt/tests/cfg/sriov/plug_unplug/sriov_attach_detach_device_vfio_variant_driver.cfg
around lines 15–16 and in
libvirt/tests/sriov/sriov_attach_detach_device_vfio_variant_driver.py at line
103, the config sets expr_driver="vfio-pci" and original_driver="igbvf" but the
Python test still hardcodes exp_driver="mlx5_core"; update the test to use the
config's original_driver (or read the device's pre-detach driver) instead of the
hardcoded "mlx5_core" so the post-detach verification checks exp_driver ==
original_driver (or the fetched original driver) and thus matches the variant's
configured original_driver.
libvirt/tests/src/sriov/plug_unplug/sriov_attach_detach_device_vfio_variant_driver.py
Show resolved
Hide resolved
The test was using hardcoded "mlx5_core" for the post-detach driver check instead of the configurable original_driver parameter. This caused failures on systems using different original drivers (e.g., igbvf on Intel systems). Change the hardcoded "mlx5_core" to use the original_driver parameter that is configured per variant in the test configuration. AI assisted code and commit. Human reviewed.
|
replaced with #6629 |
The vfio_vfio variant uses the generic vfio-pci driver but was incorrectly expecting mlx5_vfio_pci driver. This caused false test failures where the test reported 'Get incorrect driver vfio-pci, it should be mlx5_vfio_pci' even though the actual driver was correct.
Changes:
AI assisted code and commit. Human reviewed.
Summary by CodeRabbit