Fix pci_diff_detach: add --live to detach and wait for async hotunplug#6815
Fix pci_diff_detach: add --live to detach and wait for async hotunplug#6815BulaYoungR wants to merge 1 commit intoautotest:masterfrom
Conversation
The detach used only --persistent, which doesn't remove the interface from active XML of a running VM. Added --live flag and replaced the immediate XML check with utils_misc.wait_for() polling, since PCI hotunplug is asynchronous and the device may not disappear instantly. Committer: Bolatbek Issakh <bissakh@redhat.com>
WalkthroughA test file for virtual network interface hotplug operations has been modified to change how interface detachment is verified. The detach interface command now includes both Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
libvirt/tests/src/virtual_network/hotplug/attach_detach_interface/attach_interface_with_options_and_vm_status.py (1)
265-277: Correct approach for handling asynchronous PCI hotunplug.The polling mechanism using
utils_misc.wait_for()is the right solution since PCI hotunplug is asynchronous and the device may not disappear from the XML immediately. The 60-second timeout with 5-second steps provides reasonable tolerance for the operation to complete.Consider parameterizing the timeout and step values for easier adjustment in different test environments:
+ detach_timeout = params.get_numeric("detach_timeout", 60) + detach_step = params.get_numeric("detach_step", 5) ... - if not utils_misc.wait_for(_check_interface_detached, timeout=60, step=5): + if not utils_misc.wait_for(_check_interface_detached, timeout=detach_timeout, step=detach_step):🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@libvirt/tests/src/virtual_network/hotplug/attach_detach_interface/attach_interface_with_options_and_vm_status.py` around lines 265 - 277, Parameterize the hard-coded polling values used for PCI hotunplug by replacing the inline numbers in the utils_misc.wait_for call inside the _check_interface_detached block with configurable variables (e.g., HOTUNPLUG_TIMEOUT and HOTUNPLUG_STEP) so tests can adjust timing per environment; update the call to utils_misc.wait_for(_check_interface_detached, timeout=HOTUNPLUG_TIMEOUT, step=HOTUNPLUG_STEP) and ensure any related checks (the subsequent check_interface_xml calls and the test.fail messages) reference or document these parameters so maintainers can tune the timeout and step without changing the function body.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@libvirt/tests/src/virtual_network/hotplug/attach_detach_interface/attach_interface_with_options_and_vm_status.py`:
- Around line 265-277: Parameterize the hard-coded polling values used for PCI
hotunplug by replacing the inline numbers in the utils_misc.wait_for call inside
the _check_interface_detached block with configurable variables (e.g.,
HOTUNPLUG_TIMEOUT and HOTUNPLUG_STEP) so tests can adjust timing per
environment; update the call to utils_misc.wait_for(_check_interface_detached,
timeout=HOTUNPLUG_TIMEOUT, step=HOTUNPLUG_STEP) and ensure any related checks
(the subsequent check_interface_xml calls and the test.fail messages) reference
or document these parameters so maintainers can tune the timeout and step
without changing the function body.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
libvirt/tests/src/virtual_network/hotplug/attach_detach_interface/attach_interface_with_options_and_vm_status.py
|
Before fix After fix |
The detach used only --persistent, which doesn't remove the interface from active XML of a running VM. Added --live flag and replaced the immediate XML check with utils_misc.wait_for() polling, since PCI hotunplug is asynchronous and the device may not disappear instantly.
Committer: Bolatbek Issakh bissakh@redhat.com
Summary by CodeRabbit
Release Notes