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
This commit is contained in:
parent
2d9a88a3cc
commit
2b7c6b2e98
|
@ -759,9 +759,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)
|
||||
|
||||
|
@ -774,6 +771,9 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
|||
result[az_ext.AZ_HINTS] = az_hints
|
||||
|
||||
self._apply_dict_extend_functions('networks', result, net_db)
|
||||
mech_context = driver_context.NetworkContext(self, context,
|
||||
result)
|
||||
self.mechanism_manager.create_network_precommit(mech_context)
|
||||
return result, mech_context
|
||||
|
||||
@utils.transaction_guard
|
||||
|
|
|
@ -2486,6 +2486,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