提交 b8ca158b 编写于 作者: X Xu Han 提交者: GitHub

Merge pull request #1092 from kimi1978wy/1489738

multi_nics_stress: add dhclient to get new added nics ip
......@@ -4,12 +4,10 @@
kill_vm = yes
flexible_nic_index = yes
image_snapshot = yes
hostpassword = redhat
# nic1 is for control, nic2 is for data connection
vms = "vm1 vm2 vm3 vm4 vm5"
netperf_client = vm1
netperf_server = "vm2 vm3 vm4 vm5"
nics_vm1 = 'nic1 nic2 nic3 nic4'
nics_vm1 = "nic1 nic2 nic3 nic4"
test_protocols = "TCP_STREAM TCP_MAERTS TCP_SENDFILE UDP_STREAM TCP_RR TCP_CRR UDP_RR"
netperf_sessions = 1
package_sizes = 1500
......@@ -24,3 +22,5 @@
server_path_win = "c:\\"
client_path_win = "c:\\"
test_protocols = "TCP_STREAM TCP_MAERTS UDP_STREAM TCP_RR TCP_CRR UDP_RR"
Linux:
dhcp_cmd = "for nic in `ls /sys/class/net|grep -v lo`;do arp -a|grep -v $nic && dhclient -v $nic;done"
......@@ -12,7 +12,8 @@ from virttest import utils_test
def launch_netperf_client(server_ips, netperf_clients, test_option,
test_duration, netperf_para_sess, netperf_cmd_prefix):
test_duration, netperf_para_sess,
netperf_cmd_prefix):
"""
start netperf client in guest.
"""
......@@ -58,14 +59,12 @@ def run(test, params, env):
netperf_client = params.get("netperf_client")
guest_username = params.get("username", "")
guest_password = params.get("password", "")
host_password = params.get("hostpassword", "redhat")
shell_client = params.get("shell_client")
shell_port = params.get("shell_port")
os_type = params.get("os_type")
shell_prompt = params.get("shell_prompt", "^root@.*[\#\$]\s*$|#")
linesep = params.get("shell_linesep", "\n").decode('string_escape')
status_test_command = params.get("status_test_command", "echo $?")
host_ip = utils_net.get_host_ip_address(params)
ping_count = int(params.get("ping_count", 10))
compile_option_client = params.get("compile_option_client", "")
compile_option_server = params.get("compile_option_server", "")
......@@ -114,13 +113,18 @@ def run(test, params, env):
client_vm = env.get_vm(client)
client_vm.verify_alive()
client_ctl = client_vm.wait_for_login(timeout=login_timeout)
if params.get("dhcp_cmd"):
status, output = client_ctl.cmd_status_output(params["dhcp_cmd"], timeout=600)
if status:
logging.warn("Failed to execute dhcp-command, output:\n %s" %
output)
error.context("Stop fireware on netperf client guest.",
logging.info)
client_ctl.cmd("service iptables stop; iptables -F",
ignore_all_errors=True)
client_ip = client_vm.get_address()
client_ips.append(client_ip)
client_ctl_mac = server_vm.get_mac_address()
params_client_nic = params.object_params(client)
nics_count = len(params_client_nic.get("nics", "").split())
if nics_count > 1:
......@@ -228,7 +232,6 @@ def run(test, params, env):
netperf_sessions = params.get("netperf_sessions", "1")
p_sizes = params.get("package_sizes")
netperf_cmd_prefix = params.get("netperf_cmd_prefix", "")
netperf_pkg_size = params.get("netperf_pkg_size", "")
error.context("Start netperf clients.", logging.info)
for protocol in test_protocols.split():
error.context("Testing %s protocol" % protocol, logging.info)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册