From 7622023a6c0f543bf99eea8fa720994e10001ee7 Mon Sep 17 00:00:00 2001 From: wji Date: Mon, 9 Sep 2024 17:42:58 +0800 Subject: [PATCH] Netkvm: Fix session handling issue during netkvm driver installation During acceptance testing, installing the netkvm driver on an existing network interface caused session handling issues, leading to test failures. This patch changes the session handling from SSH to serial session by replacing vm.wait_for_login() with vm.wait_for_serial_login() . It also adds a ping test to verify network connectivity after the driver installation. Signed-off-by: wji --- qemu/tests/single_driver_install.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/qemu/tests/single_driver_install.py b/qemu/tests/single_driver_install.py index 2549c0d2ed..bb5ffc6625 100644 --- a/qemu/tests/single_driver_install.py +++ b/qemu/tests/single_driver_install.py @@ -5,6 +5,7 @@ from virttest import error_context from virttest import utils_misc +from virttest import utils_net from virttest.utils_windows import virtio_win, wmic from virttest.utils_test.qemu import windrv_verify_running @@ -144,7 +145,7 @@ def run(test, params, env): vm.destroy() vm.create() vm = env.get_vm(params["main_vm"]) - session = vm.wait_for_login() + session = vm.wait_for_serial_login() else: session = vm.reboot(session) @@ -179,6 +180,16 @@ def run(test, params, env): "by hwids: '%s'" % device_hwid) error_context.context("Verifying target driver", test.log.info) + + ext_host = utils_net.get_ip_address_by_interface(ifname="%s" % params.get("netdst")) + test.log.info("ext_host of netkvm adapte is %s" % ext_host) + guest_ip = vm.get_address(1) + test.log.info("guest_ip of netkvm adapte is %s" % guest_ip) + status, output = utils_net.ping( + ext_host, interface=guest_ip, count=10, timeout=60, session=session) + if status: + test.fail("Ping %s failed, output=%s" % (ext_host, output)) + session = vm.reboot(session) windrv_verify_running(session, test, driver_verifier)