Retrieve fresh network DB data before getting it in ml2
The DB objects that have join relationship with network, will be acquired once during a DB transaction. However, if they are updated after the first acquisition, the network DB model object maintains the older value, and doesnt update it. Aftercd7d63bde9
, the updated network is retrieved from the db causing this bug. This patch retrieves the latest data for these DB objects so that updated information can be used. In order to pass functional tests, get_network is still called instead of _make_network_dict as in original change. Change-Id: Ic8935008515bed687ad3abd00c8ccaf656a30452 Closes-Bug: #1649503 (cherry-pick from commite5ad765484
)
This commit is contained in:
parent
af363f521b
commit
7534c00663
|
@ -809,6 +809,11 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
|||
self.type_manager.extend_network_dict_provider(context,
|
||||
updated_network)
|
||||
|
||||
# ToDO(QoS): This would change once EngineFacade moves out
|
||||
db_network = self._get_network(context, id)
|
||||
# Expire the db_network in current transaction, so that the join
|
||||
# relationship can be updated.
|
||||
context.session.expire(db_network)
|
||||
updated_network = self.get_network(context, id)
|
||||
|
||||
# TODO(QoS): Move out to the extension framework somehow.
|
||||
|
|
|
@ -176,8 +176,8 @@ class QosTestJSON(base.BaseAdminNetworkTest):
|
|||
self.assertIn(rule, actual_rule_types)
|
||||
|
||||
def _disassociate_network(self, client, network_id):
|
||||
client.update_network(network_id, qos_policy_id=None)
|
||||
updated_network = self.admin_client.show_network(network_id)
|
||||
updated_network = client.update_network(network_id,
|
||||
qos_policy_id=None)
|
||||
self.assertIsNone(updated_network['network']['qos_policy_id'])
|
||||
|
||||
@test.idempotent_id('65b9ef75-1911-406a-bbdb-ca1d68d528b0')
|
||||
|
|
Loading…
Reference in New Issue