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 Nov 21, 2024
1 parent bcd89cd commit ad006cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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
8 changes: 8 additions & 0 deletions qemu/tests/multi_nics_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ def _check_ip_number():
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=600,
first=0,
step=30,
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")

Expand Down

0 comments on commit ad006cd

Please sign in to comment.