Pass MTU and AZ into network_create_precommit
The values of MTU and AZ aren't passed to network_create_precommit.
Call network_create_precommit after updating those parameters.
Co-Authored-By: Manjeet Singh Bhatia <manjeet.s.bhatia@intel.com>
Change-Id: If966a4158db727091bf2bcc6ba4d48fa9294a96c
Closes-Bug: #1675891
(cherry picked from commit 2b7c6b2e98
)
This commit is contained in:
parent
90db5afe2b
commit
46e6dd5705
|
@ -755,9 +755,6 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
|||
vlt = vlantransparent.get_vlan_transparent(net_data)
|
||||
net_db['vlan_transparent'] = vlt
|
||||
result['vlan_transparent'] = vlt
|
||||
mech_context = driver_context.NetworkContext(self, context,
|
||||
result)
|
||||
self.mechanism_manager.create_network_precommit(mech_context)
|
||||
|
||||
result[api.MTU] = self._get_network_mtu(result)
|
||||
|
||||
|
@ -769,6 +766,10 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
|||
net_db[az_ext.AZ_HINTS] = az_hints
|
||||
result[az_ext.AZ_HINTS] = az_hints
|
||||
|
||||
mech_context = driver_context.NetworkContext(self, context,
|
||||
result)
|
||||
self.mechanism_manager.create_network_precommit(mech_context)
|
||||
|
||||
self._apply_dict_extend_functions('networks', result, net_db)
|
||||
return result, mech_context
|
||||
|
||||
|
|
|
@ -2648,6 +2648,18 @@ class TestML2Segments(Ml2PluginV2TestCase):
|
|||
self.assertRaises(
|
||||
exc.VlanIdInUse, self._reserve_segment, network, 10)
|
||||
|
||||
def test_create_network_mtu_on_precommit(self):
|
||||
with mock.patch.object(mech_test.TestMechanismDriver,
|
||||
'create_network_precommit') as bmp:
|
||||
with mock.patch.object(
|
||||
self.driver, '_get_network_mtu') as mtu:
|
||||
mtu.return_value = 1100
|
||||
with self.network() as network:
|
||||
self.assertIn('mtu', network['network'])
|
||||
all_args = bmp.call_args_list
|
||||
mech_context = all_args[0][0][0]
|
||||
self.assertEqual(1100, mech_context.__dict__['_network']['mtu'])
|
||||
|
||||
def test_reserve_segment_update_network_mtu(self):
|
||||
with self.network() as network:
|
||||
network_id = network['network']['id']
|
||||
|
|
Loading…
Reference in New Issue