Add in a retry decoractor to loadbalancer updates
If we get a stale resource from the NSX then we need to make sure that we have a retry Change-Id: Iada00101db8ed317ddb4da1e53b3863da25bb220
This commit is contained in:
parent
e94c16d48e
commit
9a937475d4
@ -126,11 +126,17 @@ class LoadBalancerBase(utils.NsxLibApiBase):
|
||||
|
||||
def update(self, object_id, display_name=None, description=None,
|
||||
tags=None, resource_type=None, **kwargs):
|
||||
object_url = self.resource + '/' + object_id
|
||||
orig_body = self.client.get(object_url)
|
||||
body = self._build_args(orig_body, display_name, description, tags,
|
||||
resource_type, **kwargs)
|
||||
return self.client.update(object_url, body)
|
||||
# Using internal method so we can access max_attempts in the decorator
|
||||
@utils.retry_upon_exception(
|
||||
nsxlib_exc.StaleRevision,
|
||||
max_attempts=self.client.max_attempts)
|
||||
def do_update():
|
||||
object_url = self.resource + '/' + object_id
|
||||
orig_body = self.client.get(object_url)
|
||||
body = self._build_args(orig_body, display_name, description, tags,
|
||||
resource_type, **kwargs)
|
||||
return self.client.update(object_url, body)
|
||||
return do_update()
|
||||
|
||||
def delete(self, object_id):
|
||||
object_url = self.resource + '/' + object_id
|
||||
|
Loading…
x
Reference in New Issue
Block a user