From 67b0760d2b123ee834f8552057aed0e68a282257 Mon Sep 17 00:00:00 2001 From: Dino Simeon Madarang Date: Thu, 15 Oct 2015 16:01:14 +0100 Subject: Stop OVS from generating misleading add-br errors Create bridge and set datapath_type in 1 transaction to prevent OVS from generating misleading error messages which jenkins considers as build errors. Update vswitch interface to include optional parameters. Change-Id: I668f474ea909b284f3726807aab42d52ae2fb504 JIRA: VSPERF-122 Signed-off-by: Dino Simeon Madarang Reviewed-by: Maryam Tahhan Reviewed-by: Billy O Mahony Reviewed-by: Gene Snider Reviewed-by: Martin Klozik Reviewed-by: Radek Zetik --- src/ovs/ofctl.py | 14 ++++++++++---- vswitches/ovs_dpdk_vhost.py | 12 ++++++++---- vswitches/ovs_vanilla.py | 4 ++-- vswitches/vswitch.py | 4 +++- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/ovs/ofctl.py b/src/ovs/ofctl.py index 7cbdfe2c..2aae1ec8 100644 --- a/src/ovs/ofctl.py +++ b/src/ovs/ofctl.py @@ -65,15 +65,18 @@ class OFBase(object): # datapath management - def add_br(self, br_name=_OVS_BRIDGE_NAME): + def add_br(self, br_name=_OVS_BRIDGE_NAME, params=None): """Add datapath. :param br_name: Name of bridge :return: Instance of :class OFBridge: """ + if params is None: + params = [] + self.logger.debug('add bridge') - self.run_vsctl(['add-br', br_name]) + self.run_vsctl(['add-br', br_name]+params) return OFBridge(br_name, self.timeout) @@ -133,11 +136,14 @@ class OFBridge(OFBase): return tasks.run_task( cmd, self.logger, 'Running ovs-ofctl...', check_error) - def create(self): + def create(self, params=None): """Create bridge. """ + if params is None: + params = [] + self.logger.debug('create bridge') - self.add_br(self.br_name) + self.add_br(self.br_name, params=params) def destroy(self): """Destroy bridge. diff --git a/vswitches/ovs_dpdk_vhost.py b/vswitches/ovs_dpdk_vhost.py index 874cc97b..553915bc 100644 --- a/vswitches/ovs_dpdk_vhost.py +++ b/vswitches/ovs_dpdk_vhost.py @@ -69,11 +69,17 @@ class OvsDpdkVhost(IVSwitch): dpdk.cleanup() dpdk.remove_vhost_modules() - def add_switch(self, switch_name): + def add_switch(self, switch_name, params=None): """See IVswitch for general description """ bridge = OFBridge(switch_name) - bridge.create() + if params is None: + bridge.create(['--', 'set', 'bridge', switch_name, + 'datapath_type=netdev']) + else: + bridge.create(['--', 'set', 'bridge', switch_name, + 'datapath_type=netdev'] + params) + bridge.set_db_attribute('Open_vSwitch', '.', 'other_config:max-idle', settings.getValue('VSWITCH_FLOW_TIMEOUT')) @@ -85,8 +91,6 @@ class OvsDpdkVhost(IVSwitch): 'other_config:pmd-cpu-mask', settings.getValue('VSWITCH_PMD_CPU_MASK')) - bridge.set_db_attribute('Bridge', bridge.br_name, - 'datapath_type', 'netdev') self._bridges[switch_name] = bridge def del_switch(self, switch_name): diff --git a/vswitches/ovs_vanilla.py b/vswitches/ovs_vanilla.py index acea4ecb..04058d97 100644 --- a/vswitches/ovs_vanilla.py +++ b/vswitches/ovs_vanilla.py @@ -77,11 +77,11 @@ class OvsVanilla(IVSwitch): self._module_manager.remove_modules() - def add_switch(self, switch_name): + def add_switch(self, switch_name, params=None): """See IVswitch for general description """ bridge = OFBridge(switch_name) - bridge.create() + bridge.create(params) bridge.set_db_attribute('Open_vSwitch', '.', 'other_config:max-idle', '60000') self._bridges[switch_name] = bridge diff --git a/vswitches/vswitch.py b/vswitches/vswitch.py index dbf3e7d5..fbec861a 100644 --- a/vswitches/vswitch.py +++ b/vswitches/vswitch.py @@ -36,10 +36,12 @@ class IVSwitch(object): """ raise NotImplementedError() - def add_switch(self, switch_name): + def add_switch(self, switch_name, params): """Create a new logical switch with no ports :param switch_name: The name of the new logical switch + :param params: Optional parameters to configure switch + :returns: None """ raise NotImplementedError() -- cgit 1.2.3-korg