From 9b1af783ec53050129239102355e1a5c3ceb1d97 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Fri, 26 Aug 2016 15:39:29 +0100 Subject: paths: Support binary packages Currently VSPERF supports OVS, DPDK and QEMU built from the source code only. In some cases it is required to support installation of these tools from binary packages available for given linux distribution. Thus VSPERF configuration and code was modified to suport both source and binary versions of tools. This can be configured perf tool, so various combinations of source and binary version are supported. Together with new configuration also a handling of kernel modules was modified to automatically detect and load module dependencies. JIRA: VSPERF-340 JIRA: VSPERF-339 Change-Id: I855cb438cbd8998bdc499613ea5e7de2526299d7 Signed-off-by: Martin Klozik Reviewed-by: Maryam Tahhan Reviewed-by: Al Morton Reviewed-by: Christian Trautman Reviewed-by: Bill Michalowski Reviewed-by: Otto Sabart --- src/dpdk/dpdk.py | 51 ++++++++++-------------------------------------- src/dpdk/testpmd_proc.py | 6 +----- src/ovs/dpctl.py | 5 +---- src/ovs/ofctl.py | 17 +++++----------- 4 files changed, 17 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/dpdk/dpdk.py b/src/dpdk/dpdk.py index bd9bb9cf..16223915 100644 --- a/src/dpdk/dpdk.py +++ b/src/dpdk/dpdk.py @@ -25,13 +25,11 @@ import subprocess import logging import glob -from conf import settings +from conf import settings as S from tools import tasks from tools.module_manager import ModuleManager _LOGGER = logging.getLogger(__name__) -RTE_PCI_TOOL = glob.glob(os.path.join( - settings.getValue('RTE_SDK_USER'), 'tools', 'dpdk*bind.py'))[0] _DPDK_MODULE_MANAGER = ModuleManager() @@ -48,7 +46,7 @@ def init(): """ global _NICS global _NICS_PCI - _NICS = settings.getValue('NICS') + _NICS = S.getValue('NICS') _NICS_PCI = list(nic['pci'] for nic in _NICS) if not _is_linux(): _LOGGER.error('Not running on a compatible Linux version. Exiting...') @@ -91,44 +89,13 @@ def _insert_modules(): """Ensure required modules are inserted on system. """ - _DPDK_MODULE_MANAGER.insert_modules(settings.getValue('SYS_MODULES')) - - mod_path_prefix = settings.getValue('OVS_DIR') - _DPDK_MODULE_MANAGER.insert_module_group(settings.getValue('OVS_MODULES'), - mod_path_prefix) - if 'vfio-pci' not in settings.getValue('DPDK_MODULES'): - mod_path_prefix = os.path.join(settings.getValue('RTE_SDK'), - settings.getValue('RTE_TARGET')) - _DPDK_MODULE_MANAGER.insert_module_group(settings.getValue('DPDK_MODULES'), - mod_path_prefix) - else: - _DPDK_MODULE_MANAGER.insert_modules(settings.getValue('DPDK_MODULES')) + _DPDK_MODULE_MANAGER.insert_modules(S.getValue('TOOLS')['dpdk_modules']) def _remove_modules(): """Ensure required modules are removed from system. """ _DPDK_MODULE_MANAGER.remove_modules() -# -# vhost specific modules management -# - -def insert_vhost_modules(): - """Inserts VHOST related kernel modules - """ - mod_path_prefix = os.path.join(settings.getValue('RTE_SDK'), - 'lib', - 'librte_vhost') - _DPDK_MODULE_MANAGER.insert_module_group(settings.getValue('VHOST_MODULE'), mod_path_prefix) - - -def remove_vhost_modules(): - """Removes all VHOST related kernel modules - """ - # all modules are removed automatically by _remove_modules() method - pass - - # # 'vhost-net' module cleanup # @@ -150,7 +117,8 @@ def _remove_vhost_net(): def _vhost_user_cleanup(): """Remove files created by vhost-user tests. """ - for sock in glob.glob(settings.getValue('VHOST_USER_SOCKS')): + for sock in glob.glob(os.path.join(S.getValue('TOOLS')['ovs_var_tmp'], + S.getValue('VHOST_USER_SOCKS'))): if os.path.exists(sock): try: tasks.run_task(['sudo', 'rm', sock], @@ -173,7 +141,7 @@ def _bind_nics(): """ try: _driver = 'igb_uio' - if 'vfio-pci' in settings.getValue('DPDK_MODULES'): + if 'vfio-pci' in S.getValue('TOOLS')['dpdk_modules']: _driver = 'vfio-pci' tasks.run_task(['sudo', 'chmod', 'a+x', '/dev/vfio'], _LOGGER, 'Setting VFIO permissions .. a+x', @@ -182,7 +150,8 @@ def _bind_nics(): _LOGGER, 'Setting VFIO permissions .. 0666', True) - tasks.run_task(['sudo', RTE_PCI_TOOL, '--bind=' + _driver] + + tasks.run_task(['sudo', S.getValue('TOOLS')['bind-tool'], + '--bind=' + _driver] + _NICS_PCI, _LOGGER, 'Binding NICs %s...' % _NICS_PCI, True) @@ -193,7 +162,7 @@ def _unbind_nics(): """Unbind NICs using the Intel DPDK ``dpdk*bind.py`` tool. """ try: - tasks.run_task(['sudo', RTE_PCI_TOOL, '--unbind'] + + tasks.run_task(['sudo', S.getValue('TOOLS')['bind-tool'], '--unbind'] + _NICS_PCI, _LOGGER, 'Unbinding NICs %s...' % str(_NICS_PCI), True) @@ -204,7 +173,7 @@ def _unbind_nics(): for nic in _NICS: try: if nic['driver']: - tasks.run_task(['sudo', RTE_PCI_TOOL, '--bind', + tasks.run_task(['sudo', S.getValue('TOOLS')['bind-tool'], '--bind', nic['driver'], nic['pci']], _LOGGER, 'Binding NIC %s to %s...' % (nic['pci'], nic['driver']), diff --git a/src/dpdk/testpmd_proc.py b/src/dpdk/testpmd_proc.py index 990ef8da..a8fa8eee 100644 --- a/src/dpdk/testpmd_proc.py +++ b/src/dpdk/testpmd_proc.py @@ -27,10 +27,6 @@ from tools import tasks _TESTPMD_PROMPT = 'Done' -_TESTPMD_BIN = os.path.join( - settings.getValue('RTE_SDK'), settings.getValue('RTE_TARGET'), - 'app', 'testpmd') - _LOG_FILE_VSWITCHD = os.path.join( settings.getValue('LOG_DIR'), settings.getValue('LOG_FILE_VSWITCHD')) @@ -57,7 +53,7 @@ class TestPMDProcess(tasks.Process): if not self._expect: self._expect = _TESTPMD_PROMPT testpmd_args = testpmd_args or [] - self._cmd = ['sudo', '-E', _TESTPMD_BIN] + testpmd_args + self._cmd = ['sudo', '-E', settings.getValue('TOOLS')['testpmd']] + testpmd_args # startup/shutdown diff --git a/src/ovs/dpctl.py b/src/ovs/dpctl.py index 8ecac6dc..44a4ec9b 100644 --- a/src/ovs/dpctl.py +++ b/src/ovs/dpctl.py @@ -23,9 +23,6 @@ import string from tools import tasks from conf import settings -_OVS_DPCTL_BIN = os.path.join(settings.getValue('OVS_DIR'), 'utilities', - 'ovs-dpctl') - _OVS_LOCAL_DATAPATH = 'ovs-system' class DPCtl(object): @@ -51,7 +48,7 @@ class DPCtl(object): :return: None """ - cmd = ['sudo', _OVS_DPCTL_BIN, + cmd = ['sudo', settings.getValue('TOOLS')['ovs-dpctl'], '--timeout', str(self.timeout)] + args return tasks.run_task( diff --git a/src/ovs/ofctl.py b/src/ovs/ofctl.py index a75d0be2..27349a92 100644 --- a/src/ovs/ofctl.py +++ b/src/ovs/ofctl.py @@ -28,13 +28,6 @@ import re from tools import tasks from conf import settings -_OVS_VSCTL_BIN = os.path.join(settings.getValue('OVS_DIR'), 'utilities', - 'ovs-vsctl') -_OVS_OFCTL_BIN = os.path.join(settings.getValue('OVS_DIR'), 'utilities', - 'ovs-ofctl') -_OVS_APPCTL_BIN = os.path.join(settings.getValue('OVS_DIR'), 'utilities', - 'ovs-appctl') - _OVS_BRIDGE_NAME = settings.getValue('VSWITCH_BRIDGE_NAME') _CACHE_FILE_NAME = '/tmp/vsperf_flows_cache' @@ -66,9 +59,9 @@ class OFBase(object): :return: None """ if self.timeout == -1: - cmd = ['sudo', _OVS_VSCTL_BIN, '--no-wait'] + args + cmd = ['sudo', settings.getValue('TOOLS')['ovs-vsctl'], '--no-wait'] + args else: - cmd = ['sudo', _OVS_VSCTL_BIN, '--timeout', str(self.timeout)] + args + cmd = ['sudo', settings.getValue('TOOLS')['ovs-vsctl'], '--timeout', str(self.timeout)] + args return tasks.run_task( cmd, self.logger, 'Running ovs-vsctl...', check_error) @@ -81,7 +74,7 @@ class OFBase(object): :return: None """ - cmd = ['sudo', _OVS_APPCTL_BIN, + cmd = ['sudo', settings.getValue('TOOLS')['ovs-appctl'], '--timeout', str(self.timeout)] + args return tasks.run_task( @@ -184,8 +177,8 @@ class OFBridge(OFBase): :return: None """ tmp_timeout = self.timeout if timeout == None else timeout - cmd = ['sudo', _OVS_OFCTL_BIN, '-O', 'OpenFlow13', '--timeout', - str(tmp_timeout)] + args + cmd = ['sudo', settings.getValue('TOOLS')['ovs-ofctl'], '-O', + 'OpenFlow13', '--timeout', str(tmp_timeout)] + args return tasks.run_task( cmd, self.logger, 'Running ovs-ofctl...', check_error) -- cgit 1.2.3-korg