Skip to content

Commit 217316a

Browse files
committed
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 <[email protected]>
1 parent af63fc5 commit 217316a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

qemu/tests/single_driver_install.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from virttest import error_context
77
from virttest import utils_misc
8+
from virttest import utils_net
89
from virttest.utils_windows import virtio_win, wmic
910
from virttest.utils_test.qemu import windrv_verify_running
1011

@@ -144,7 +145,8 @@ def run(test, params, env):
144145
vm.destroy()
145146
vm.create()
146147
vm = env.get_vm(params["main_vm"])
147-
session = vm.wait_for_login()
148+
# This is a workaround for session logout issue
149+
session = vm.wait_for_serial_login()
148150
else:
149151
session = vm.reboot(session)
150152

@@ -172,6 +174,15 @@ def run(test, params, env):
172174
if not utils_misc.wait_for(lambda: not session.cmd_status(chk_cmd),
173175
600, 60, 10):
174176
test.fail("Failed to install driver '%s'" % driver_name)
177+
if device_name[0:30] == "Red Hat VirtIO Ethernet Adapte":
178+
ext_host = utils_net.get_ip_address_by_interface(ifname="%s" % params.get("netdst"))
179+
test.log.info("ext_host of netkvm adapte is %s" % ext_host)
180+
guest_ip = vm.get_address("nic2")
181+
test.log.info("guest_ip of netkvm adapte is %s" % guest_ip)
182+
status, output = utils_net.ping(
183+
ext_host, interface=guest_ip, count=10, timeout=60, session=session)
184+
if status:
185+
test.fail("Ping %s failed, output=%s" % (ext_host, output))
175186

176187
installed_any |= True
177188
if not installed_any:

0 commit comments

Comments
 (0)