Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netkvm: Fix session handling issue during netkvm driver installation #4158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion qemu/tests/single_driver_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -144,7 +145,8 @@ def run(test, params, env):
vm.destroy()
vm.create()
vm = env.get_vm(params["main_vm"])
session = vm.wait_for_login()
# This is a workaround for session logout issue
session = vm.wait_for_serial_login()
heywji marked this conversation as resolved.
Show resolved Hide resolved
else:
session = vm.reboot(session)

Expand Down Expand Up @@ -172,6 +174,15 @@ def run(test, params, env):
if not utils_misc.wait_for(lambda: not session.cmd_status(chk_cmd),
600, 60, 10):
test.fail("Failed to install driver '%s'" % driver_name)
if device_name[0:30] == "Red Hat VirtIO Ethernet Adapte":
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("nic2")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please tell why using 'nic2' here? I thought it is similar with 'index2'. How about getting the ether name inside guest with some keywords, such as "Red Hat VirtIO Ethernet Adapte"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @xiagao, I used 'nic2' because it's the second element in the vm.virtnet list. You can see vm.virtnet code defined in this function: avocado-framework/avocado-vt/blob/master/virttest/virt_vm.py#L832.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And "nic2" has already been defined in our cfg file: tp-qemu/blob/master/qemu/tests/cfg/single_driver_install.cfg#L56.

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))

installed_any |= True
if not installed_any:
Expand Down
Loading