未验证 提交 76b438ac 编写于 作者: Q Qianqian Zhu 提交者: GitHub

Merge pull request #1129 from quanwenli/tweak

Netperf: tweak configuration according whitepaper
......@@ -54,14 +54,16 @@
shell_prompt_host = \[root@.{0,50}][\#\$]
#Test base env configration
ver_cmd = rpm -q qemu-kvm
netperf_version = 2.6.0
netperf_pkg = performance/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"
netperf_version = 2.7.1
netperf_pkg = performance/netperf-2.7.1.tar.bz2
setup_cmd = "cd /tmp && rm -rf netperf-2.7.1 && tar xvfj netperf-2.7.1.tar.bz2 && cd netperf-2.7.1 && sh autogen.sh && ./configure --enable-burst --enable-demo=yes && make"
ppc64:
setup_cmd = "cd /tmp && rm -rf netperf-2.6.0 && tar xvfj netperf-2.6.0.tar.bz2 && cd netperf-2.6.0 && ./configure --build=ppc64 --enable-burst --enable-demo=yes && make"
setup_cmd = "cd /tmp && rm -rf netperf-2.7.1 && tar xvfj netperf-2.7.1.tar.bz2 && cd netperf-2.7.1 && sh autogen.sh && ./configure --build=ppc64 --enable-burst --enable-demo=yes && make"
ppc64le:
setup_cmd = "cd /tmp && rm -rf netperf-2.6.0 && tar xvfj netperf-2.6.0.tar.bz2 && cd netperf-2.6.0 && ./configure --build=ppc64le --enable-burst --enable-demo=yes && make"
setup_cmd = "cd /tmp && rm -rf netperf-2.7.1 && tar xvfj netperf-2.7.1.tar.bz2 && cd netperf-2.7.1 && sh autogen.sh && ./configure --build=ppc64le --enable-burst --enable-demo=yes && make"
log_hostinfo_script = scripts/rh_perf_log_hostinfo_script.sh
host_tuned_profile = "tuned-adm profile virtual-host"
client_tuned_profile = "tuned-adm profile virtual-host"
# Now the get status functions are implemented for RHEL and Fedora guests.
# Not test with other guests, please set this depends on your guest os
# environment.
......@@ -71,14 +73,23 @@
# log_guestinfo_script = scripts/rh_perf_log_guestinfo_script.sh
# log_guestinfo_exec = bash
# log_guestinfo_path = /tmp/log_guestinfo.sh
server_tuned_profile = "tuned-adm profile virtual-guest"
server_mtu_cmd = "ifconfig %s mtu %s"
Windows:
# log_guestinfo_script = scripts/rh_perf_log_guestinfo_script.bat
# log_guestinfo_exec = cmd /c
# log_guestinfo_path = C:\log_guestinfo.bat
server_mtu_cmd = "netsh interface ipv4 set subinterface "%s" mtu=%s"
i386, x86_64:
cpu_model_flags = ",hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0xfff"
client_mtu_cmd = "ifconfig %s mtu %s"
host_mtu_cmd = "ifconfig %s mtu %s"
env_setup_cmd = "systemctl stop firewalld.service || service iptables stop;"
env_setup_cmd += " echo 2 > /proc/sys/net/ipv4/conf/all/arp_ignore;"
env_setup_cmd += " echo 0 > /sys/kernel/mm/ksm/run;"
env_setup_cmd += " echo 0 > /proc/sys/kernel/watchdog;"
env_setup_cmd += " echo 0 > /proc/sys/kernel/nmi_watchdog;"
env_setup_cmd += " setenforce 1"
variants:
- guest_guest:
no Jeos
......
......@@ -88,12 +88,8 @@ def run(test, params, env):
"""
def env_setup(session, ip, user, port, password):
error_context.context("Setup env for %s" % ip)
ssh_cmd(session, "iptables -F", ignore_status=True)
ssh_cmd(session, "service iptables stop", ignore_status=True)
ssh_cmd(session, "systemctl stop firewalld.service",
ignore_status=True)
ssh_cmd(session, "echo 2 > /proc/sys/net/ipv4/conf/all/arp_ignore")
ssh_cmd(session, "echo 0 > /sys/kernel/mm/ksm/run", ignore_status=True)
if params.get("env_setup_cmd"):
ssh_cmd(session, params.get("env_setup_cmd"), ignore_status=True)
pkg = params["netperf_pkg"]
pkg = os.path.join(data_dir.get_deps_dir(), pkg)
......@@ -141,6 +137,27 @@ def run(test, params, env):
process.run(host_mtu_cmd % (iface, mtu), ignore_status=False,
shell=True)
def tweak_tuned_profile():
"""
Tweak configuration with truned profile
"""
client_tuned_profile = params.get("client_tuned_profile")
server_tuned_profile = params.get("server_tuned_profile")
host_tuned_profile = params.get("host_tuned_profile")
error_context.context("Changing tune profile of guest", logging.info)
if params.get("os_type") == "linux" and server_tuned_profile:
ssh_cmd(server_ctl, server_tuned_profile)
error_context.context("Changing tune profile of client/host",
logging.info)
if client_tuned_profile:
ssh_cmd(client, client_tuned_profile)
if host_tuned_profile:
ssh_cmd(host, host_tuned_profile)
def _pin_vm_threads(vm, node):
if node:
if not isinstance(node, utils_misc.NumaNode):
......@@ -153,27 +170,12 @@ def run(test, params, env):
vm.verify_alive()
login_timeout = int(params.get("login_timeout", 360))
server_ip = vm.wait_for_get_address(0, timeout=5)
vm.wait_for_serial_login(timeout=login_timeout, restart_network=True).close()
if len(params.get("nics", "").split()) > 1:
vm.wait_for_serial_login(timeout=30, restart_network=True).close()
server_ctl = vm.wait_for_login(nic_index=1, timeout=login_timeout)
server_ctl_ip = vm.wait_for_get_address(1, timeout=5)
session = vm.wait_for_login(nic_index=1, timeout=30)
session = vm.wait_for_login(nic_index=1, timeout=login_timeout)
else:
server_ctl = vm.wait_for_login(timeout=login_timeout)
server_ctl_ip = server_ip
session = vm.wait_for_login(timeout=login_timeout)
mac = vm.get_mac_address(0)
queues = int(params.get("queues", 1))
if queues > 1:
if params.get("os_type") == "linux":
ethname = utils_net.get_linux_ifname(session, mac)
session.cmd_status_output("ethtool -L %s combined %s" %
(ethname, queues))
else:
logging.info("FIXME: support to enable MQ for Windows guest!")
config_cmds = params.get("config_cmds")
if config_cmds:
for config_cmd in config_cmds.split(","):
......@@ -185,6 +187,25 @@ def run(test, params, env):
test.error(msg)
if params.get("reboot_after_config", "yes") == "yes":
session = vm.reboot(session=session, timeout=login_timeout)
vm.wait_for_serial_login(timeout=login_timeout, restart_network=True).close()
server_ip = vm.wait_for_get_address(0, timeout=90)
if len(params.get("nics", "").split()) > 1:
server_ctl = vm.wait_for_login(nic_index=1, timeout=login_timeout)
server_ctl_ip = vm.wait_for_get_address(1, timeout=90)
else:
server_ctl = vm.wait_for_login(timeout=login_timeout)
server_ctl_ip = server_ip
mac = vm.get_mac_address(0)
queues = int(params.get("queues", 1))
if queues > 1:
if params.get("os_type") == "linux":
ethname = utils_net.get_linux_ifname(session, mac)
session.cmd_status_output("ethtool -L %s combined %s" %
(ethname, queues))
else:
logging.info("FIXME: support to enable MQ for Windows guest!")
if params.get("rh_perf_envsetup_script"):
utils_test.service_setup(vm, session, test.virtdir)
......@@ -200,17 +221,12 @@ def run(test, params, env):
else:
server_cyg = None
if len(params.get("nics", "").split()) > 1:
vm.wait_for_login(nic_index=1, timeout=login_timeout,
restart_network=True)
server_ctl_ip = vm.wait_for_get_address(1, timeout=5)
logging.debug(process.system_output("numactl --hardware",
verbose=False, ignore_status=True,
shell=True))
shell=True).decode())
logging.debug(process.system_output("numactl --show",
verbose=False, ignore_status=True,
shell=True))
shell=True).decode())
# pin guest vcpus/memory/vhost threads to last numa node of host by default
numa_node = _pin_vm_threads(vm, params.get("numa_node"))
......@@ -269,6 +285,7 @@ def run(test, params, env):
password = params_tmp["password"]
username = params_tmp["username"]
env_setup(i, ip_dict[i], username, shell_port, password)
tweak_tuned_profile()
mtu = int(params.get("mtu", "1500"))
mtu_set(mtu)
......@@ -342,19 +359,14 @@ def start_test(server, server_ctl, host, clients, resultsdir, test_duration=60,
guest_ver_cmd = params.get("guest_ver_cmd", "uname -r")
fd = open("%s/netperf-result.%s.RHS" % (resultsdir, time.time()), "w")
test.write_test_keyval({'kvm-userspace-ver':
process.system_output(ver_cmd,
verbose=False,
ignore_status=True,
shell=True
).strip()})
test.write_test_keyval({'kvm-userspace-ver': ssh_cmd(host,
ver_cmd).strip()})
test.write_test_keyval({'guest-kernel-ver': ssh_cmd(server_ctl,
guest_ver_cmd).strip()})
test.write_test_keyval({'session-length': test_duration})
fd.write('### kvm-userspace-ver : %s\n' %
process.system_output(ver_cmd, verbose=False,
ignore_status=True, shell=True).strip())
fd.write('### kvm-userspace-ver : %s\n' % ssh_cmd(host,
ver_cmd).strip())
fd.write('### guest-kernel-ver : %s\n' % ssh_cmd(server_ctl,
guest_ver_cmd).strip())
fd.write('### kvm_version : %s\n' % os.uname()[2])
......@@ -462,7 +474,8 @@ def ssh_cmd(session, cmd, timeout=120, ignore_status=False):
"""
if session == "localhost":
o = process.system_output(cmd, timeout=timeout,
ignore_status=ignore_status, shell=True)
ignore_status=ignore_status,
shell=True).decode()
else:
o = session.cmd(cmd, timeout=timeout, ignore_all_errors=ignore_status)
return o
......@@ -605,8 +618,9 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args,
if numa_enable:
n = abs(int(params.get("numa_node"))) - 1
cmd += "numactl --cpunodebind=%s --membind=%s " % (n, n)
cmd += "`command -v python python3 ` "
cmd += "/tmp/netperf_agent.py %d %s -D 1 -H %s -l %s %s" % (
i, client_path, server, int(l) * 1.5, nf_args)
i, client_path, server, int(l) * 1.5, nf_args)
cmd += " >> %s" % fname
logging.info("Start netperf thread by cmd '%s'" % cmd)
ssh_cmd(client_s, cmd)
......@@ -641,7 +655,7 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args,
test.error("We couldn't expect this parallism, expect %s get %s"
% (sessions, nresult))
niteration = nresult / sessions
niteration = nresult // sessions
result = 0.0
for this in lines[-sessions * niteration:]:
if "Interim" in this:
......@@ -693,7 +707,7 @@ def launch_client(sessions, server, server_ctl, host, clients, l, nf_args,
msg += " end state: %s\n" % end_state
logging.warn(msg)
else:
for i in range(len(end_state) / 2):
for i in range(len(end_state) // 2):
ret[end_state[i * 2]] = (end_state[i * 2 + 1] -
start_state[i * 2 + 1])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册