Add retry logic when deleting logical port and logical switch
When deleting a logical port or logical switch, the backend may
have transient inconsistency due to split internal update transactions.
For now, adding the retry logical at the plugin side to solve
this problem.
Change-Id: I008d5759d490bbd364731f94b916c179af50491b
(cherry picked from commit 28ac8ed890
)
This commit is contained in:
parent
66a2716e2c
commit
59853cfd7e
@ -91,6 +91,8 @@ def create_logical_switch(display_name, transport_zone_id, tags,
|
|||||||
return client.create_resource(resource, body)
|
return client.create_resource(resource, body)
|
||||||
|
|
||||||
|
|
||||||
|
@utils.retry_upon_exception_nsxv3(nsx_exc.StaleRevision,
|
||||||
|
max_attempts=cfg.CONF.nsx_v3.retries)
|
||||||
def delete_logical_switch(lswitch_id):
|
def delete_logical_switch(lswitch_id):
|
||||||
resource = 'logical-switches/%s?detach=true&cascade=true' % lswitch_id
|
resource = 'logical-switches/%s?detach=true&cascade=true' % lswitch_id
|
||||||
client.delete_resource(resource)
|
client.delete_resource(resource)
|
||||||
|
@ -258,6 +258,9 @@ class LogicalPort(AbstractRESTResource):
|
|||||||
attachment=attachment))
|
attachment=attachment))
|
||||||
return self._client.create(body=body)
|
return self._client.create(body=body)
|
||||||
|
|
||||||
|
@utils.retry_upon_exception_nsxv3(
|
||||||
|
nsx_exc.StaleRevision,
|
||||||
|
max_attempts=cfg.CONF.nsx_v3.retries)
|
||||||
def delete(self, lport_id):
|
def delete(self, lport_id):
|
||||||
return self._client.url_delete('%s?detach=true' % lport_id)
|
return self._client.url_delete('%s?detach=true' % lport_id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user