aboutsummaryrefslogtreecommitdiffstats
path: root/vswitches/ovs_dpdk_vhost.py
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2016-05-05 14:59:32 +0100
committerMartin Klozik <martinx.klozik@intel.com>2016-05-06 10:06:11 +0100
commitfdfd540284e31d9349173285619f5927aa8fc057 (patch)
tree93426222eb2e4de0095cc6c965e411539b69420e /vswitches/ovs_dpdk_vhost.py
parent22ffe5b07adeb514572dc3db8b435ef4107e348b (diff)
dpdk: Support new way of DPDK configuration in ovs-vswitchd
Configuration of DPDK options in ovs-vswitchd has changed. Previously used option --dpdk was deprecated and all DPDK related options have to be configured through ovsdb via ovs-vsctl calls. VSPERF was modified to detect and use correct version of DPDK configuration. New configuration options should be put into VSWITCHD_DPDK_CONFIG dictionary. VSPERF classes specific to OVS were refactored. Change-Id: Ia3fad5906221439f477638f1f9734289dbf737bb JIRA: VSPERF-291 Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com> Reviewed-by: Al Morton <acmorton@att.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Brian Castelli <brian.castelli@spirent.com>
Diffstat (limited to 'vswitches/ovs_dpdk_vhost.py')
-rw-r--r--vswitches/ovs_dpdk_vhost.py47
1 files changed, 40 insertions, 7 deletions
diff --git a/vswitches/ovs_dpdk_vhost.py b/vswitches/ovs_dpdk_vhost.py
index 9d29c9d1..82b952de 100644
--- a/vswitches/ovs_dpdk_vhost.py
+++ b/vswitches/ovs_dpdk_vhost.py
@@ -16,10 +16,13 @@
"""
import logging
+import subprocess
+import os
+
+from src.ovs import OFBridge
+from src.dpdk import dpdk
from conf import settings
from vswitches.ovs import IVSwitchOvs
-from src.ovs import VSwitchd
-from src.dpdk import dpdk
class OvsDpdkVhost(IVSwitchOvs):
""" Open vSwitch with DPDK support
@@ -36,16 +39,32 @@ class OvsDpdkVhost(IVSwitchOvs):
def __init__(self):
super(OvsDpdkVhost, self).__init__()
self._logger = logging.getLogger(__name__)
+ self._expect = r'EAL: Master l*core \d+ is ready'
+
+ vswitchd_args = []
+
+ # legacy DPDK configuration through --dpdk option of vswitchd
+ if self.old_dpdk_config():
+ vswitchd_args = ['--dpdk'] + settings.getValue('VSWITCHD_DPDK_ARGS')
+ if self._vswitchd_args:
+ self._vswitchd_args = vswitchd_args + ['--'] + self._vswitchd_args
+ else:
+ self._vswitchd_args = vswitchd_args
- self._vswitchd_args = ['--dpdk']
- self._vswitchd_args += settings.getValue('VSWITCHD_DPDK_ARGS')
if settings.getValue('VNF').endswith('Cuse'):
self._logger.info("Inserting VHOST Cuse modules into kernel...")
dpdk.insert_vhost_modules()
- self._vswitchd = VSwitchd(vswitchd_args=self._vswitchd_args,
- expected_cmd=
- r'EAL: Master l*core \d+ is ready')
+ def configure(self):
+ """ Configure vswitchd DPDK options through ovsdb if needed
+ """
+ dpdk_config = settings.getValue('VSWITCHD_DPDK_CONFIG')
+ if dpdk_config and not self.old_dpdk_config():
+ # enforce calls to ovs-vsctl with --no-wait
+ tmp_br = OFBridge(timeout=-1)
+ for option in dpdk_config:
+ tmp_br.set_db_attribute('Open_vSwitch', '.',
+ 'other_config:' + option, dpdk_config[option])
def start(self):
"""See IVswitch for general description
@@ -115,3 +134,17 @@ class OvsDpdkVhost(IVSwitchOvs):
of_port = bridge.add_port(port_name, params)
return (port_name, of_port)
+
+ @staticmethod
+ def old_dpdk_config():
+ """Checks if ovs-vswitchd uses legacy dpdk configuration via --dpdk option
+
+ :returns: True if legacy --dpdk option is supported, otherwise it returns False
+ """
+
+ ovs_vswitchd_bin = os.path.join(settings.getValue('OVS_DIR'), 'vswitchd', 'ovs-vswitchd')
+ try:
+ subprocess.check_output(ovs_vswitchd_bin + r' --help | grep "\-\-dpdk"', shell=True)
+ return True
+ except subprocess.CalledProcessError:
+ return False