Skip to content

Commit 7df7152

Browse files
committed
tests: Fix device removal order in test_hotplug_max_devices
Remove devices from the guest before sending the API delete request, not after. The guest should release the device first before the VMM removes it. Signed-off-by: Ilias Stamatis <ilstam@amazon.com>
1 parent c3ee1f9 commit 7df7152

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/integration_tests/functional/test_hotplug.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,11 +480,7 @@ def test_hotplug_max_devices(uvm_any_with_pci):
480480
is_read_only=False,
481481
)
482482

483-
# Unplug all hotplugged devices
484-
for i in range(free_slots):
485-
vm.api.drive.delete(f"block{i}")
486-
487-
# Remove the stale devices from the guest
483+
# Remove the devices from the guest first
488484
new_bdfs = [
489485
l.split()[0]
490486
for l in set(lspci_full.strip().splitlines())
@@ -493,6 +489,10 @@ def test_hotplug_max_devices(uvm_any_with_pci):
493489
for bdf in new_bdfs:
494490
vm.ssh.check_output(f"echo 1 > /sys/bus/pci/devices/0000:{bdf}/remove")
495491

492+
# Then unplug all hotplugged devices via the API
493+
for i in range(free_slots):
494+
vm.api.drive.delete(f"block{i}")
495+
496496
# Verify we're back to the initial number of devices
497497
_, lspci, _ = vm.ssh.check_output("lspci -n")
498498
assert len(lspci.strip().splitlines()) == used_slots

0 commit comments

Comments
 (0)