Skip to content

Commit 47078b5

Browse files
committed
Netkvm: Fix session handling issue during netkvm driver installation
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 the 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 <[email protected]>
1 parent ada7894 commit 47078b5

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

qemu/tests/single_driver_install.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import re
33

44
from aexpect import ShellTimeoutError
5-
from virttest import error_context, utils_misc
5+
from virttest import error_context, utils_misc, utils_net
66
from virttest.utils_test.qemu import windrv_verify_running
77
from virttest.utils_windows import virtio_win, wmic
88

@@ -147,7 +147,8 @@ def run(test, params, env):
147147
vm.destroy()
148148
vm.create()
149149
vm = env.get_vm(params["main_vm"])
150-
session = vm.wait_for_login()
150+
# This is a workaround for session logout issue
151+
session = vm.wait_for_serial_login()
151152
else:
152153
session = vm.reboot(session)
153154

@@ -175,6 +176,18 @@ def run(test, params, env):
175176
lambda: not session.cmd_status(chk_cmd), 600, 60, 10
176177
):
177178
test.fail("Failed to install driver '%s'" % driver_name)
179+
if "Red Hat VirtIO Ethernet Adapter" in device_name:
180+
ext_host = utils_net.get_ip_address_by_interface(
181+
ifname="%s" % params.get("netdst")
182+
)
183+
test.log.info("ext_host of netkvm adapter is %s", ext_host)
184+
guest_ip = vm.get_address("nic2")
185+
test.log.info("guest_ip of netkvm adapter is %s", guest_ip)
186+
status, output = utils_net.ping(
187+
ext_host, interface=guest_ip, count=10, timeout=60, session=session
188+
)
189+
if status:
190+
test.fail("Ping %s failed, output=%s" % (ext_host, output))
178191

179192
installed_any |= True
180193
if not installed_any:

0 commit comments

Comments
 (0)