Skip to content

Commit

Permalink
Fix ValueError When mapping muti physnets to a same OVS bridge
Browse files Browse the repository at this point in the history
Multi physnets can map to a same OVS bridge in OVN South bound DB, this
is reasonable configuration, but there is a ValueError in
helpers.parse_mappings() as following.
ValueError: Value br-ex in mapping: 'public2:br-ex' not unique
This patch fixes this bug.

Change-Id: Id6e2ec0328e9026716595d366453a4f319ee5754
Signed-off-by: Dong Jun <dongj@dtdream.com>
  • Loading branch information
dongjun666 committed May 3, 2017
1 parent 32529db commit a4781fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion networking_ovn/ovsdb/impl_idl_ovn.py
Expand Up @@ -561,7 +561,8 @@ def __init__(self, driver, trigger=None):

def _get_chassis_physnets(self, chassis):
bridge_mappings = chassis.external_ids.get('ovn-bridge-mappings', '')
mapping_dict = helpers.parse_mappings(bridge_mappings.split(','))
mapping_dict = helpers.parse_mappings(bridge_mappings.split(','),
unique_values=False)
return list(mapping_dict.keys())

def chassis_exists(self, hostname):
Expand Down
3 changes: 2 additions & 1 deletion networking_ovn/ovsdb/ovsdb_monitor.py
Expand Up @@ -52,7 +52,8 @@ def run(self, event, row, old):
phy_nets = []
if event != self.ROW_DELETE:
bridge_mappings = row.external_ids.get('ovn-bridge-mappings', '')
mapping_dict = helpers.parse_mappings(bridge_mappings.split(','))
mapping_dict = helpers.parse_mappings(bridge_mappings.split(','),
unique_values=False)
phy_nets = list(mapping_dict)

self.driver.update_segment_host_mapping(host, phy_nets)
Expand Down
2 changes: 1 addition & 1 deletion networking_ovn/tests/unit/ovsdb/test_impl_idl_ovn.py
Expand Up @@ -662,7 +662,7 @@ class TestSBImplIdlOvn(TestDBImplIdlOvn):
'public:br-ex,private:br-0'}},
{'name': 'host-2', 'hostname': 'host-2.localdomain.com',
'external_ids': {'ovn-bridge-mappings':
'public:br-ex'}},
'public:br-ex,public2:br-ex'}},
{'name': 'host-3', 'hostname': 'host-3.localdomain.com',
'external_ids': {'ovn-bridge-mappings':
'public:br-ex'}},
Expand Down

0 comments on commit a4781fd

Please sign in to comment.