Skip to content

Commit

Permalink
Merge pull request #519 from yoguo/master
Browse files Browse the repository at this point in the history
Fix the issue when getting the active nic
  • Loading branch information
yoguo authored Feb 18, 2025
2 parents 45a51d3 + 2e7d54a commit 746bce3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions os_tests/libs/utils_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,7 @@ def collect_kmemleak(test_instance=None):
test_instance.log.info('Memory leak found!')

def get_active_nic(test_instance=None, rmt_node=None, vm=None):
cmd = "sudo ip link show|grep mtu|grep -v lo|awk -F':' '{print $2}'"
cmd = "sudo ip link show|grep mtu|grep -v lo|awk -F': ' '{print $2}'"
output = run_cmd(test_instance, cmd, rmt_node=rmt_node, vm=vm)
test_instance.active_nic = "eth0"
test_instance.log.info("Test which nic connects to public")
Expand All @@ -1973,7 +1973,7 @@ def get_active_nic(test_instance=None, rmt_node=None, vm=None):
if len(net) < 3:
continue
cmd = "sudo ping {} -c 6 -I {}".format(test_instance.params.get('ping_server'), net)
ret = run_cmd(test_instance, cmd, rmt_node=rmt_node, vm=vm)
ret = run_cmd(test_instance, cmd, ret_status=True, rmt_node=rmt_node, vm=vm)
if ret == 0:
test_instance.active_nic = net
nic_found = True
Expand Down

0 comments on commit 746bce3

Please sign in to comment.