提交 59b88171 编写于 作者: Y Yunping Zheng 提交者: Lucas Meneghel Rodrigues

virt.tests: Updates to netperf

Get netperf src package from web;
Make the script compatible with netperf 2.6.0;
Modify the method of get winutils vol;
Modify the method of start netserver in windows guest
Using wait_for  to wait until all net perf clients start to work;
Reorganize the configure file.
Signed-off-by: NYunping Zheng <yunzheng@redhat.com>
上级 c0eaea97
- netperf: install setup image_copy unattended_install.cdrom - netperf: install setup image_copy unattended_install.cdrom
virt_test_type = qemu libvirt virt_test_type = qemu libvirt
no JeOS
only Linux
type = netperf type = netperf
kill_vm = yes kill_vm = yes
image_snapshot = yes image_snapshot = yes
nics += ' nic2' # Please update following comments params when you need special cfg for
# your test nic cards
# nic1 is for control, nic2 is for data connection # nic1 is for control, nic2 is for data connection
netdst_nic1 = private nics += ' nic2'
nic_model_nic1 = virtio
netdst_nic2 = switch
#Configure different types of network adapters. #Configure different types of network adapters.
nic_model_nic1 = virtio
nic_model_nic2 = e1000 nic_model_nic2 = e1000
netperf_files = netperf-2.6.0.tar.bz2 netdst_nic1 = private
setup_cmd = "cd /tmp && rm -rf netperf-2.6.0 && tar xvfj netperf-2.6.0.tar.bz2 && cd netperf-2.6.0 && ./configure --enable-burst --enable-demo=yes && make" netdst_nic2 = switch
# please fix the mac for nic2 if you needed with this, this can be empty
# nic_mac_nic2 =
# please add the physical nic you want to add to your private bridge
# this can be empty
# physical_nic =
# bridge_force_create=yes
# bridge_nic1 =
#numa configration
numa_node = -1
netperf_with_numa = yes
# configure netperf test parameters, some seconds will be took to # configure netperf test parameters, some seconds will be took to
# wait all the clients work, this wait time should be less than # wait all the clients work, this wait time should be less than
# 0.5 * l, the wait time will augments if you have move # 0.5 * l, the wait time will augments if you have move
# threads. So experientially suggest l should be not less than 60. # threads. So experientially suggest l should be not less than 60.
l = 60 l = 60
#need modify the netperf_start_timeout, if you adjust the value of l
netperf_start_timeout = 360
#Test protocol and test data configration
protocols = "TCP_STREAM TCP_MAERTS TCP_RR TCP_CRR" protocols = "TCP_STREAM TCP_MAERTS TCP_RR TCP_CRR"
sessions = "1 2 4" sessions = "1 2 4"
sessions_rr = "50 100 250 500" sessions_rr = "50 100 250 500"
sizes = "64 256 512 1024" sizes = "64 256 512 1024"
sizes_rr = "64 256 512 1024" sizes_rr = "64 256 512 1024"
numa_node = -1 #client configuration
client = localhost
username_client = root username_client = root
password_client = 123456 password_client = 123456
shell_client_client = ssh shell_client_client = ssh
shell_port_client = 22 shell_port_client = 22
shell_prompt_client = \[root@.{0,50}][\#\$] shell_prompt_client = \[root@.{0,50}][\#\$]
#host configuration
shell_port_host = 22 shell_port_host = 22
password_host = 123456 password_host = 123456
username_host = root username_host = root
os_type_client = linux os_type_client = linux
os_type_host = linux os_type_host = linux
shell_prompt_host = \[root@.{0,50}][\#\$] shell_prompt_host = \[root@.{0,50}][\#\$]
#Test base env configration
ver_cmd = rpm -qa |grep kvm ver_cmd = rpm -qa |grep kvm
netperf_version = 2.6.0
# this script is used to setup test env for (linux)guest/host netperf_download_link = ftp://ftp.netperf.org/netperf/netperf-2.6.0.tar.bz2
# before performance testing pkg_md5sum = 9654ffdfd4c4f2c93ce3733cd9ed9236
# rh_perf_envsetup_script = scripts/rh_perf_envsetup.sh setup_cmd = "cd /tmp && rm -rf netperf-2.6.0 && tar xvfj netperf-2.6.0.tar.bz2 && cd netperf-2.6.0 && ./configure --enable-burst --enable-demo=yes && make"
client = vm2
variants: variants:
- guest_guest: - guest_guest:
no Jeos
only Linux
client = vm2
vms += " vm2" vms += " vm2"
nics = 'nic1' nics = 'nic1'
- host_guest: - host_guest:
client = localhost Windows:
# to test exthost <-> guest: netserv_start_cmd = "start /b %s:\netserver-2.6.0.exe"
# client = <external host ip> guest_ver_cmd = "ver"
use_cygwin = no
- netperf_win:
only Windows
# only support guest run netserver and host run netperf now.
host = localhost
# this is a default value in test env
# please change this to your client machine ip if your guest
# uses static ip
client = vm2
type = netperf
kill_vm = yes
image_snapshot = yes
pci_model_nic1 = virtio_net
# Please update following comments params when you need special cfg for
# your test nic cards
# please fix the mac for nic2 if you needed with this, this can be empty
# nic_mac_nic2 =
# bridge_nic1 =
# please add the physical nic you want to add to your private bridge
# this can be empty
# physical_nic =
# bridge_force_create=yes
pci_model_nic2 = e1000
nics += ' nic2'
netperf_files = netperf-2.6.0.tar.bz2
setup_cmd = "cd /tmp && rm -rf netperf-2.6.0 && tar xvfj netperf-2.6.0.tar.bz2 && cd netperf-2.6.0 && ./configure --enable-burst --enable-demo=yes && make"
guest_ver_cmd = "ver"
netperf_with_numa = yes
# configure netperf test parameters
l = 30
protocols = "TCP_STREAM TCP_MAERTS TCP_RR TCP_CRR"
sessions_rr="1 25 50 100"
sessions="1 2 4"
sizes_rr="256"
sizes="256 1024 4096 16384 65535"
numa_node = -1
username_client = root
password_client = 123456
shell_client_client = ssh
shell_port_client = 22
shell_prompt_client = \[root@.{0,50}][\#\$]
shell_port_host = 22
password_host = 123456
username_host = root
os_type_client = linux
os_type_host = linux
shell_prompt_host = \[root@.{0,50}][\#\$]
ver_cmd = rpm -qa |grep kvm
variants:
- netperf_exe:
use_cygwin = no
netserv_start_cmd = "(dir C:\temp || mkdir C:\temp) && start /b %s:\netserver.exe"
variants: variants:
- default_setting: - @default_setting:
Linux:
no Jeos
# to test exthost <-> guest:
# client = <external host ip>
Windows:
#client = <external host/guest ip>
- best_registry_setting: - best_registry_setting:
only Windows
reboot_after_config = yes reboot_after_config = yes
# For more information about windows registry setting document, please refer to http://www.linux-kvm.org/page/WindowsGuestDrivers/kvmnet/registry # For more information about windows registry setting document,
#please refer to http://www.linux-kvm.org/page/WindowsGuestDrivers/kvmnet/registry
config_cmds = afd_cmd1,afd_cmd2,afd_cmd3, tcpip_cmd1,tcpip_cmd2 config_cmds = afd_cmd1,afd_cmd2,afd_cmd3, tcpip_cmd1,tcpip_cmd2
afd_cmd1 = reg add "HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters" /v DefaultSendWindow /d 0x00100000 /t REG_DWORD /f afd_cmd1 = reg add "HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters" /v DefaultSendWindow /d 0x00100000 /t REG_DWORD /f
afd_cmd2 = reg add "HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters" /v DefaultReceiveWindow /d 0x00100000 /t REG_DWORD /f afd_cmd2 = reg add "HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters" /v DefaultReceiveWindow /d 0x00100000 /t REG_DWORD /f
...@@ -118,11 +91,12 @@ ...@@ -118,11 +91,12 @@
enable_ctcp_cmd = "netsh int tcp set global congestionprovider=ctcp" enable_ctcp_cmd = "netsh int tcp set global congestionprovider=ctcp"
Win2008, Win2008r2, Win7: Win2008, Win2008r2, Win7:
config_cmds += ,disable_tcp_heuristics_cmd,disabled_tcp_autotuning_cmd,enable_ctcp_cmd config_cmds += ,disable_tcp_heuristics_cmd,disabled_tcp_autotuning_cmd,enable_ctcp_cmd
- netperf_cygwin: - cygwin:
use_cygwin = yes only Windows
netperf_src = %s:\netperf\netperf-2.6.0 use_cygwin = yes
cygwin_root = C:\rhcygwin\home\Administrator netperf_src = %s:\netperf\netperf-2.6.0
cygwin_start = C:\rhcygwin\Cygwin.bat -i /Cygwin-Terminal.ico - cygwin_root = C:\rhcygwin\home\Administrator
netserv_pattern = "hostname\s+[\d+\.]+\s+port\s+\d+" netserver_path = C:\rhcygwin\usr\local\bin
netserv_start_cmd = netserver cygwin_start = C:\rhcygwin\Cygwin.bat -i /Cygwin-Terminal.ico -
netperf_install_cmd = cd netperf-2.6.0; ./configure --enable-burst --enable-demo=yes; make; make install netserv_start_cmd = netserver
netperf_install_cmd = cd netperf-2.6.0; ./configure --enable-burst --enable-demo=yes; make; make install
...@@ -3,9 +3,7 @@ import os ...@@ -3,9 +3,7 @@ import os
import commands import commands
import threading import threading
import re import re
import glob
import time import time
import shutil
from autotest.client import utils from autotest.client import utils
from autotest.client.shared import error from autotest.client.shared import error
from virttest import utils_test, utils_misc, remote, data_dir from virttest import utils_test, utils_misc, remote, data_dir
...@@ -56,20 +54,15 @@ def netperf_record(results, filter_list, header=False, base="12", fbase="2"): ...@@ -56,20 +54,15 @@ def netperf_record(results, filter_list, header=False, base="12", fbase="2"):
return record, key_list return record, key_list
def start_netserver_win(session, start_cmd, pattern): def start_netserver_win(session, start_cmd):
""" check_reg = re.compile(r"NETSERVER.*EXE", re.I)
Start netserver in Windows guest through a cygwin session. if not check_reg.findall(session.cmd_output("tasklist")):
session.sendline(start_cmd)
:param session: remote session for cygwin if not utils_misc.wait_for(lambda: check_reg.findall(
:param start_cmd: command to start netserver session.cmd_output("tasklist")),
:param pattern: pattern to judge the status of netserver 30, 5, 1, "Wait netserver start"):
""" msg = "Can not start netserver with command %s" % start_cmd
output = session.cmd_output(start_cmd) raise error.TestError(msg)
try:
re.findall(pattern, output)[0]
except IndexError:
logging.debug("Can not start netserver: %s" % output)
return bool(re.findall(pattern, output))
@error.context_aware @error.context_aware
...@@ -88,18 +81,20 @@ def run_netperf(test, params, env): ...@@ -88,18 +81,20 @@ def run_netperf(test, params, env):
""" """
def env_setup(session, ip, user, port, password): def env_setup(session, ip, user, port, password):
error.context("Setup env for %s" % ip) error.context("Setup env for %s" % ip)
ssh_cmd(session, "iptables -F; true")
ssh_cmd(session, "service iptables stop; true") ssh_cmd(session, "service iptables stop; true")
ssh_cmd(session, "echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore") ssh_cmd(session, "echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore")
netperf_dir = os.path.join(data_dir.get_root_dir(), "shared/deps") download_link = params.get("netperf_download_link")
for i in params.get("netperf_files").split(): download_dir = data_dir.get_download_dir()
remote.scp_to_remote(ip, shell_port, username, password, md5sum = params.get("pkg_md5sum")
"%s/%s" % (netperf_dir, i), "/tmp/") pkg = utils.unmap_url_cache(download_dir, download_link, md5sum)
remote.scp_to_remote(ip, shell_port, username, password, pkg, "/tmp")
ssh_cmd(session, params.get("setup_cmd")) ssh_cmd(session, params.get("setup_cmd"))
agent_path = os.path.join(test.virtdir, "scripts/netperf_agent.py") agent_path = os.path.join(test.virtdir, "scripts/netperf_agent.py")
remote.scp_to_remote(ip, shell_port, username, password, remote.scp_to_remote(ip, shell_port, username, password,
agent_path, "/tmp/") agent_path, "/tmp")
def _pin_vm_threads(vm, node): def _pin_vm_threads(vm, node):
if node: if node:
...@@ -135,7 +130,7 @@ def run_netperf(test, params, env): ...@@ -135,7 +130,7 @@ def run_netperf(test, params, env):
server_ctl_ip = server_ip server_ctl_ip = server_ip
if (params.get("os_type") == "windows" if (params.get("os_type") == "windows"
and params.get("use_cygwin") == "yes"): and params.get("use_cygwin") == "yes"):
cygwin_prompt = params.get("cygwin_prompt", "\$\s+$") cygwin_prompt = params.get("cygwin_prompt", r"\$\s+$")
cygwin_start = params.get("cygwin_start") cygwin_start = params.get("cygwin_start")
server_cyg = vm.wait_for_login(timeout=login_timeout) server_cyg = vm.wait_for_login(timeout=login_timeout)
server_cyg.set_prompt(cygwin_prompt) server_cyg.set_prompt(cygwin_prompt)
...@@ -144,8 +139,8 @@ def run_netperf(test, params, env): ...@@ -144,8 +139,8 @@ def run_netperf(test, params, env):
server_cyg = None server_cyg = None
if len(params.get("nics", "").split()) > 1: if len(params.get("nics", "").split()) > 1:
server_ctl = vm.wait_for_login(nic_index=1, timeout=login_timeout) vm.wait_for_login(nic_index=1, timeout=login_timeout)
server_ctl_ip = vm.get_address(1) server_ip = vm.get_address(1)
logging.debug(commands.getoutput("numactl --hardware")) logging.debug(commands.getoutput("numactl --hardware"))
logging.debug(commands.getoutput("numactl --show")) logging.debug(commands.getoutput("numactl --show"))
...@@ -280,7 +275,7 @@ def start_test(server, server_ctl, host, clients, resultsdir, l=60, ...@@ -280,7 +275,7 @@ def start_test(server, server_ctl, host, clients, resultsdir, l=60,
fbase = params.get("format_fbase", "2") fbase = params.get("format_fbase", "2")
output = ssh_cmd(host, "mpstat 1 1 |grep CPU") output = ssh_cmd(host, "mpstat 1 1 |grep CPU")
mpstat_head = re.findall("CPU\s+.*", output)[0].split() mpstat_head = re.findall(r"CPU\s+.*", output)[0].split()
mpstat_key = params.get("mpstat_key", "%idle") mpstat_key = params.get("mpstat_key", "%idle")
if mpstat_key in mpstat_head: if mpstat_key in mpstat_head:
mpstat_index = mpstat_head.index(mpstat_key) + 1 mpstat_index = mpstat_head.index(mpstat_key) + 1
...@@ -306,15 +301,14 @@ def start_test(server, server_ctl, host, clients, resultsdir, l=60, ...@@ -306,15 +301,14 @@ def start_test(server, server_ctl, host, clients, resultsdir, l=60,
for i in sizes_test: for i in sizes_test:
for j in sessions_test: for j in sessions_test:
if protocol in ("TCP_RR", "TCP_CRR"): if protocol in ("TCP_RR", "TCP_CRR"):
ret = launch_client( nf_args = "-t %s -v 1 -- -r %s,%s" % (protocol, i, i)
j, server, server_ctl, host, clients, l, elif (protocol == "TCP_MAERTS"):
"-t %s -v 1 -- -r %s,%s" % (protocol, i, i), nf_args = "-C -c -t %s -- -m ,%s" % (protocol, i)
netserver_port, params, server_cyg)
else: else:
ret = launch_client( nf_args = "-C -c -t %s -- -m %s" % (protocol, i)
j, server, server_ctl, host, clients, l,
"-C -c -t %s -- -m %s" % (protocol, i), ret = launch_client(j, server, server_ctl, host, clients, l,
netserver_port, params, server_cyg) nf_args, netserver_port, params, server_cyg)
thu = float(ret['thu']) thu = float(ret['thu'])
cpu = 100 - float(ret['mpstat'].split()[mpstat_index]) cpu = 100 - float(ret['mpstat'].split()[mpstat_index])
...@@ -375,50 +369,55 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args, ...@@ -375,50 +369,55 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args,
port, params, server_cyg): port, params, server_cyg):
""" Launch netperf clients """ """ Launch netperf clients """
client_path = "/tmp/netperf-2.6.0/src/netperf" netperf_version = params.get("netperf_version", "2.6.0")
server_path = "/tmp/netperf-2.6.0/src/netserver" client_path = "/tmp/netperf-%s/src/netperf" % netperf_version
server_path = "/tmp/netperf-%s/src/netserver" % netperf_version
# Start netserver # Start netserver
error.context("Start Netserver on guest", logging.info) error.context("Start Netserver on guest", logging.info)
if params.get("os_type") == "windows": if params.get("os_type") == "windows":
timeout = float(params.get("timeout", "240")) timeout = float(params.get("timeout", "240"))
cdrom_drv = utils_test.get_windows_disk_drive(server_ctl, "netserver") cdrom_drv = utils_misc.get_winutils_vol(server_ctl)
netserv_start_cmd = params.get("netserv_start_cmd") % cdrom_drv get_status_flag = False
logging.info("Netserver start cmd is '%s'" % netserv_start_cmd)
if params.get("use_cygwin") == "yes": if params.get("use_cygwin") == "yes":
netperf_src = params.get("netperf_src") netserv_start_cmd = params.get("netserv_start_cmd")
netperf_src = params.get("netperf_src") % cdrom_drv
cygwin_root = params.get("cygwin_root") cygwin_root = params.get("cygwin_root")
netserv_pattern = params.get("netserv_pattern") netserver_path = params.get("netserver_path")
netperf_install_cmd = params.get("netperf_install_cmd") netperf_install_cmd = params.get("netperf_install_cmd")
start_session = server_cyg
logging.info("Start netserver with cygwin, cmd is: %s" %
netserv_start_cmd)
if "netserver" not in server_ctl.cmd_output("tasklist"): if "netserver" not in server_ctl.cmd_output("tasklist"):
if not start_netserver_win(server_cyg, netserv_start_cmd, netperf_pack = "netperf-%s" % params.get("netperf_version")
netserv_pattern): s_check_cmd = "dir %s" % netserver_path
logging.info("Install netserver in Windows guest") p_check_cmd = "dir %s" % cygwin_root
output = server_ctl.cmd("dir %s" % cygwin_root) if not ("netserver.exe" in server_ctl.cmd(s_check_cmd) and
if "netperf" not in output: netperf_pack in server_ctl.cmd(p_check_cmd)):
cmd = "xcopy %s %s /S /I" % (netperf_src, cygwin_root) error.context("Install netserver in Windows guest cygwin",
server_ctl.cmd(cmd) logging.info)
server_cyg.cmd_output(netperf_install_cmd, cmd = "xcopy %s %s /S /I /Y" % (netperf_src, cygwin_root)
timeout=timeout) server_ctl.cmd(cmd)
if not start_netserver_win(server_cyg, netserv_start_cmd, server_cyg.cmd_output(netperf_install_cmd, timeout=timeout)
netserv_pattern): if "netserver.exe" not in server_ctl.cmd(s_check_cmd):
msg = "Can not start netserver in Windows guest" err_msg = "Install netserver cygwin failed"
raise error.TestError(msg) raise error.TestNAError(err_msg)
logging.info("Install netserver in cygwin successfully")
else: else:
if "NETSERVER.EXE" not in server_ctl.cmd_output("tasklist"): start_session = server_ctl
server_ctl.cmd_output(netserv_start_cmd) netserv_start_cmd = params.get("netserv_start_cmd") % cdrom_drv
o_tasklist = server_ctl.cmd_output("tasklist") logging.info("Start netserver without cygwin, cmd is: %s" %
if "NETSERVER.EXE" not in o_tasklist.upper(): netserv_start_cmd)
msg = "Can not start netserver in Windows guest"
raise error.TestError(msg) error.context("Start netserver on windows guest", logging.info)
start_netserver_win(start_session, netserv_start_cmd)
get_status_flag = False
else: else:
logging.info("Netserver start cmd is '%s'" % server_path) logging.info("Netserver start cmd is '%s'" % server_path)
ssh_cmd(server_ctl, "pidof netserver || %s" % server_path) ssh_cmd(server_ctl, "pidof netserver || %s" % server_path)
get_status_flag = True get_status_flag = True
ncpu = ssh_cmd(server_ctl, "cat /proc/cpuinfo |grep processor |wc -l") ncpu = ssh_cmd(server_ctl, "cat /proc/cpuinfo |grep processor |wc -l")
ncpu = re.findall("\d+", ncpu)[0] ncpu = re.findall(r"\d+", ncpu)[0]
logging.info("Netserver start successfully") logging.info("Netserver start successfully")
...@@ -436,7 +435,7 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args, ...@@ -436,7 +435,7 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args,
def get_state(): def get_state():
for i in ssh_cmd(server_ctl, "ifconfig").split("\n\n"): for i in ssh_cmd(server_ctl, "ifconfig").split("\n\n"):
if server in i: if server in i:
ifname = re.findall("(\w+\d+)[:\s]", i)[0] ifname = re.findall(r"(\w+\d+)[:\s]", i)[0]
path = "find /sys/devices|grep net/%s/statistics" % ifname path = "find /sys/devices|grep net/%s/statistics" % ifname
cmd = "%s/rx_packets|xargs cat;%s/tx_packets|xargs cat;" \ cmd = "%s/rx_packets|xargs cat;%s/tx_packets|xargs cat;" \
...@@ -474,21 +473,30 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args, ...@@ -474,21 +473,30 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args,
state_list.append(irq_inj) state_list.append(irq_inj)
return state_list return state_list
def netperf_thread(i, numa_enable, client_s): def netperf_thread(i, numa_enable, client_s, timeout):
cmd = "" cmd = ""
fname = "/tmp/netperf.%s.nf" % pid fname = "/tmp/netperf.%s.nf" % pid
if numa_enable: if numa_enable:
output = ssh_cmd(client_s, "numactl --hardware") output = ssh_cmd(client_s, "numactl --hardware")
n = int(re.findall("available: (\d+) nodes", output)[0]) - 1 n = int(re.findall(r"available: (\d+) nodes", output)[0]) - 1
cmd += "numactl --cpunodebind=%s --membind=%s " % (n, n) cmd += "numactl --cpunodebind=%s --membind=%s " % (n, n)
cmd += "/tmp/netperf_agent.py %d %s -D 1 -H %s -l %s %s" % (i, cmd += "/tmp/netperf_agent.py %d %s -D 1 -H %s -l %s %s" % (i,
client_path, server, int(l) * 1.5, nf_args) client_path, server, int(l) * 1.5, nf_args)
cmd += " >> %s" % fname cmd += " >> %s" % fname
logging.info("Start netperf thread by cmd '%s'" % cmd) logging.info("Start netperf thread by cmd '%s'" % cmd)
ssh_cmd(client_s, cmd) ssh_cmd(client_s, cmd, timeout)
logging.info("Netperf thread completed successfully") logging.info("Netperf thread completed successfully")
def all_clients_up():
try:
content = ssh_cmd(clients[-1], "cat %s" % fname)
except:
content = ""
return False
if int(sessions) == len(re.findall("MIGRATE", content)):
return True
return False
def parse_demo_result(fname, sessions): def parse_demo_result(fname, sessions):
""" """
Process the demo result, remove the noise from head, Process the demo result, remove the noise from head,
...@@ -513,7 +521,7 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args, ...@@ -513,7 +521,7 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args,
result = 0.0 result = 0.0
for this in lines[-sessions * niteration:]: for this in lines[-sessions * niteration:]:
if "Interim" in this: if "Interim" in this:
result += float(re.findall("Interim result: *(\S+)", this)[0]) result += float(re.findall(r"Interim result: *(\S+)", this)[0])
result = result / niteration result = result / niteration
logging.debug("niteration: %s" % niteration) logging.debug("niteration: %s" % niteration)
return result return result
...@@ -523,23 +531,22 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args, ...@@ -523,23 +531,22 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args,
fname = "/tmp/netperf.%s.nf" % pid fname = "/tmp/netperf.%s.nf" % pid
ssh_cmd(clients[-1], "rm -f %s" % fname) ssh_cmd(clients[-1], "rm -f %s" % fname)
numa_enable = params.get("netperf_with_numa", "yes") == "yes" numa_enable = params.get("netperf_with_numa", "yes") == "yes"
timeout_netperf_start = float(params.get("netperf_start_timeout", 360))
client_thread = threading.Thread(target=netperf_thread, client_thread = threading.Thread(target=netperf_thread,
kwargs={"i": int(sessions), kwargs={"i": int(sessions),
"numa_enable": numa_enable, "numa_enable": numa_enable,
"client_s": clients[0]}) "client_s": clients[0],
"timeout": timeout_netperf_start})
client_thread.start() client_thread.start()
ret = {} ret = {}
ret['pid'] = pid ret['pid'] = pid
while True: if utils_misc.wait_for(all_clients_up, timeout_netperf_start, 30, 5,
try: "Wait until all netperf clients start to work"):
content = ssh_cmd(clients[-1], "cat %s" % fname) logging.debug("All netperf clients start to work.")
except: else:
content = "" raise error.TestNAError("Error, not all netperf clients at work")
if int(sessions) == len(re.findall("MIGRATE", content)):
logging.debug("All netperf clients start to work.")
break
# real & effective test starts # real & effective test starts
if get_status_flag: if get_status_flag:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册