diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index d6d4f0352ac..dfcecfb03f5 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -792,9 +792,11 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon, with context.session.begin(subtransactions=True): subnet, changes = self.ipam.update_db_subnet(context, id, s, db_pools) + # we expire here since ipam may have made changes to relationships + # that will be stale on any subsequent lookups while the subnet object + # is in the session otherwise. + context.session.expire(subnet) result = self._make_subnet_dict(subnet, context=context) - # Keep up with fields that changed - result.update(changes) if update_ports_needed: # Find ports that have not yet been updated diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index 3fa8d9bf9ef..b337af27771 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -811,7 +811,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2, self.type_manager.extend_network_dict_provider(context, updated_network) - updated_network[api.MTU] = self._get_network_mtu(updated_network) + updated_network = self.get_network(context, id) # TODO(QoS): Move out to the extension framework somehow. need_network_update_notify = ( @@ -1033,6 +1033,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2, context, id, subnet) self.extension_manager.process_update_subnet( context, subnet[attributes.SUBNET], updated_subnet) + updated_subnet = self.get_subnet(context, id) network = self.get_network(context, updated_subnet['network_id']) mech_context = driver_context.SubnetContext( self, context, updated_subnet, network, diff --git a/neutron/tests/tempest/api/test_revisions.py b/neutron/tests/tempest/api/test_revisions.py index 78fcea4093a..a70b995e3cb 100644 --- a/neutron/tests/tempest/api/test_revisions.py +++ b/neutron/tests/tempest/api/test_revisions.py @@ -148,9 +148,7 @@ class TestRevisions(base.BaseAdminNetworkTest, bsg.BaseSecGroupTest): @test.requires_ext(extension="dns-integration", service="network") def test_update_dns_domain_bumps_revision(self): net = self.create_network(dns_domain='example.test.') - self.client.update_network(net['id'], dns_domain='exa.test.') - # TODO(kevinbenton): use update result after bug/1627628 is fixed - updated = self.client.show_network(net['id']) + updated = self.client.update_network(net['id'], dns_domain='exa.test.') self.assertGreater(updated['network']['revision_number'], net['revision_number']) port = self.create_port(net) @@ -198,13 +196,12 @@ class TestRevisions(base.BaseAdminNetworkTest, bsg.BaseSecGroupTest): @test.requires_ext(extension="port-security", service="network") def test_update_port_security_bumps_revisions(self): net = self.create_network(port_security_enabled=False) - self.client.update_network(net['id'], port_security_enabled=True) - # TODO(kevinbenton): use update result after bug/1627628 is fixed - updated = self.client.show_network(net['id']) + updated = self.client.update_network(net['id'], + port_security_enabled=True) self.assertGreater(updated['network']['revision_number'], net['revision_number']) - self.client.update_network(net['id'], port_security_enabled=False) - updated2 = self.client.show_network(net['id']) + updated2 = self.client.update_network(net['id'], + port_security_enabled=False) self.assertGreater(updated2['network']['revision_number'], updated['network']['revision_number']) port = self.create_port(net, port_security_enabled=False)