提交 b39f88e2 编写于 作者: Y Yu Wang

set_link: fix problem of packets lost during ping on windows guest

Add ip check for windows guest and extend the timeout.
Signed-off-by: NYu Wang <wyu@redhat.com>
上级 a5014d83
- set_link: install setup image_copy unattended_install.cdrom
requires_root = yes
type = set_link
test_timeout = 2000
test_timeout = 2500
filesize = 4000
transfer_timeout = 1000
kill_vm =yes
......
......@@ -140,6 +140,43 @@ def run(test, params, env):
finally:
session.close()
def check_interface_ip_routine(session, mac_addr):
"""
The routine to check the ip of interface.
:param session: a session to send check commands
:param mac_addr: the interface mac address
"""
ip_addr = utils_net.get_net_if_addrs_win(session, mac_addr)
guest_ipv4 = ip_addr["ipv4"]
for ip in guest_ipv4:
logging.debug("Check address: %s" % ip)
if len(ip) != 0 and not ip.startswith("169.254"):
return True
return False
def check_interface_ip(timeout=600):
"""
Check whether the vm has got the available ip address.
The check will be performed repeatedly until a correct ip address
is detected or after the specified time is expired.
:param timeout: total checking time allowed
"""
error_context.context("Start checking guest ip", logging.info)
session = vm.wait_for_serial_login()
mac_addr = vm.get_mac_address()
try:
if not utils_misc.wait_for(
lambda: check_interface_ip_routine(session, mac_addr),
timeout,
step=5.0):
err_msg = "Can't get valid ip in %s seconds" % timeout
test.fail(err_msg)
finally:
session.close()
def set_link_test(linkid, link_up, expect_status,
operstate_always_up=False, change_queues=False):
"""
......@@ -165,6 +202,8 @@ def run(test, params, env):
expect_status = win_media_connected
guest_interface_operstate_check(expect_status, guest_ifname,
change_queues)
if params.get("os_type") == "windows":
check_interface_ip()
error_context.context("Check if guest network connective",
logging.info)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册