Move retry decorator in auto allocate
No longer necessary on cleanup since individual plugin operations are protected but it should be on _ensure_network_default_value callback since it can happen outside of a transaction. Partial-Bug: #1612798 Change-Id: Iab4f2216e6b138296e8245eb0b1e3e6b5e46561b
This commit is contained in:
parent
ad13bdfa27
commit
a4ccc0ce1c
|
@ -50,6 +50,7 @@ def _extend_external_network_default(core_plugin, net_res, net_db):
|
|||
return net_res
|
||||
|
||||
|
||||
@db_api.retry_if_session_inactive()
|
||||
def _ensure_external_network_default_value_callback(
|
||||
resource, event, trigger, context, request, network):
|
||||
"""Ensure the is_default db field matches the create/update request."""
|
||||
|
@ -360,8 +361,6 @@ class AutoAllocatedTopologyMixin(common_db_mixin.CommonDbMixin):
|
|||
router_id=router_id, subnets=subnets)
|
||||
return network_id
|
||||
|
||||
# FIXME(kevinbenton): get rid of the retry once bug/1612798 is resolved
|
||||
@db_api.retry_db_errors
|
||||
def _cleanup(self, context, network_id=None, router_id=None, subnets=None):
|
||||
"""Clean up auto allocated resources."""
|
||||
# Concurrent attempts to delete the topology may interleave and
|
||||
|
|
|
@ -212,15 +212,12 @@ class AutoAllocateTestCase(testlib_api.SqlTestCaseLight):
|
|||
self.assertEqual(expected, result)
|
||||
|
||||
def test__cleanup_handles_failures(self):
|
||||
retry_then_notfound = (
|
||||
[db_exc.RetryRequest(ValueError())] +
|
||||
[n_exc.NotFound()] * 10
|
||||
)
|
||||
notfound = n_exc.NotFound
|
||||
self.mixin._l3_plugin.remove_router_interface.side_effect = (
|
||||
retry_then_notfound)
|
||||
notfound)
|
||||
self.mixin._l3_plugin.delete_router.side_effect = (
|
||||
retry_then_notfound)
|
||||
notfound)
|
||||
self.mixin._core_plugin.delete_network.side_effect = (
|
||||
retry_then_notfound)
|
||||
notfound)
|
||||
self.mixin._cleanup(self.ctx, network_id=44, router_id=45,
|
||||
subnets=[{'id': 46}])
|
||||
|
|
Loading…
Reference in New Issue