From ad006cd06e9ad5b5e75d0234cc288d7f535e35b1 Mon Sep 17 00:00:00 2001 From: wji Date: Fri, 11 Oct 2024 12:10:37 +0800 Subject: [PATCH] Netkvm: Fix multi_nics_verify test by adding NIC initialization check 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 --- qemu/tests/cfg/multi_nics_verify.cfg | 1 + qemu/tests/multi_nics_verify.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/qemu/tests/cfg/multi_nics_verify.cfg b/qemu/tests/cfg/multi_nics_verify.cfg index f87d092256..a166ebd11f 100644 --- a/qemu/tests/cfg/multi_nics_verify.cfg +++ b/qemu/tests/cfg/multi_nics_verify.cfg @@ -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 diff --git a/qemu/tests/multi_nics_verify.py b/qemu/tests/multi_nics_verify.py index 86874cdeb4..210b2478bb 100644 --- a/qemu/tests/multi_nics_verify.py +++ b/qemu/tests/multi_nics_verify.py @@ -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")