Skip to content

Commit

Permalink
Netkvm: Fix multi_nics_verify test by adding NIC initialization check
Browse files Browse the repository at this point in the history
The test failed because Windows didn't assign IPs to all NICs
immediately after boot. A loop was added to check the NIC count until
all are initialized, ensuring the test waits for all NICs to get their
IP addresses before proceeding.

Signed-off-by: wji <[email protected]>
  • Loading branch information
heywji committed Oct 23, 2024
1 parent 9851239 commit 8f7b411
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions qemu/tests/cfg/multi_nics_verify.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
network_manager = yes
RHEL.7, RHEL.8:
network_manager = no
nics_num_checking_cmd = 'ipconfig | find /c "Ethernet adapter"'
variants:
- nic_virtio:
only virtio_net
Expand Down
4 changes: 3 additions & 1 deletion qemu/tests/multi_nics_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ def _check_ip_number():

# Check all the interfaces in guest get ips
session_srl = vm.wait_for_serial_login(timeout=int(params.get("login_timeout", 360)))
nics_num_checking_cmd = params.get("nics_num_checking_cmd")
utils_misc.wait_for(lambda: int(session.cmd_output(nics_num_checking_cmd, timeout=360)) == nics_num, timeout=60, first=30, step=10, text="waiting for all nics to get ip")

if not utils_misc.wait_for(_check_ip_number, 1000, step=10):
test.error("Timeout when wait for nics to get ip")

nic_interface = []
for index, nic in enumerate(vm.virtnet):
test.log.info("index %s nic", index)
Expand Down

0 comments on commit 8f7b411

Please sign in to comment.