Merge "[OVN] Allow only one physical network per bridge" into stable/wallaby

This commit is contained in:
Zuul 2022-01-14 10:09:41 +00:00 committed by Gerrit Code Review
commit 8cd7048591
4 changed files with 16 additions and 5 deletions

View File

@ -822,8 +822,7 @@ class OvsdbSbOvnIdl(sb_impl_idl.OvnSbApiIdlImpl, Backend):
def _get_chassis_physnets(self, chassis):
bridge_mappings = chassis.external_ids.get('ovn-bridge-mappings', '')
mapping_dict = helpers.parse_mappings(bridge_mappings.split(','),
unique_values=False)
mapping_dict = helpers.parse_mappings(bridge_mappings.split(','))
return list(mapping_dict.keys())
def chassis_exists(self, hostname):

View File

@ -137,8 +137,7 @@ class ChassisEvent(row_event.RowEvent):
phy_nets = []
if event != self.ROW_DELETE:
bridge_mappings = row.external_ids.get('ovn-bridge-mappings', '')
mapping_dict = helpers.parse_mappings(bridge_mappings.split(','),
unique_values=False)
mapping_dict = helpers.parse_mappings(bridge_mappings.split(','))
phy_nets = list(mapping_dict)
self.driver.update_segment_host_mapping(host, phy_nets)

View File

@ -53,7 +53,7 @@ class TestSbApi(BaseOvnIdlTest):
{'external_ids': {'ovn-bridge-mappings':
'public:br-ex,private:br-0'}},
{'external_ids': {'ovn-bridge-mappings':
'public:br-ex,public2:br-ex'}},
'public:br-ex,public2:br-ex2'}},
{'external_ids': {'ovn-bridge-mappings':
'public:br-ex'}},
]
@ -99,6 +99,15 @@ class TestSbApi(BaseOvnIdlTest):
self.assertGreaterEqual(set(mapping.keys()),
{c['name'] for c in self.data['chassis']})
def test_multiple_physnets_in_one_bridge(self):
self.data = {
'chassis': [
{'external_ids': {'ovn-bridge-mappings': 'p1:br-ex,p2:br-ex'}}
]
}
self.load_test_data()
self.assertRaises(ValueError, self.api.get_chassis_and_physnets)
def _add_switch_port(self, chassis_name, type='localport'):
sname, pname = (utils.get_rand_device_name(prefix=p)
for p in ('switch', 'port'))

View File

@ -0,0 +1,4 @@
---
other:
- |
OVN mechanism driver allows only to have one physical network per bridge.