Add search index out of sync exception

Search actions will retry on this exception.

Change-Id: I967f140b45e43d5aa64d5a9a2148e6a9e84f100f
This commit is contained in:
asarfaty 2019-12-01 10:58:55 +02:00 committed by Adit Sarfaty
parent 65c3513d28
commit e2d38173ce
3 changed files with 8 additions and 3 deletions

View File

@ -37,6 +37,7 @@ def http_error_to_exception(status_code, error_code):
requests.codes.BAD_REQUEST:
{'60508': exceptions.NsxIndexingInProgress,
'60514': exceptions.NsxSearchTimeout,
'60515': exceptions.NsxSearchOutOfSync,
'8327': exceptions.NsxOverlapVlan,
'500045': exceptions.NsxPendingDelete,
'500030': exceptions.ResourceInUse,

View File

@ -197,6 +197,10 @@ class NsxSearchTimeout(NsxSearchError):
"or running low on resources")
class NsxSearchOutOfSync(NsxSearchError):
message = _("Index is currently out of sync")
class NsxPendingDelete(NsxLibException):
message = _("An object with the same name is marked for deletion. Either "
"use another path or wait for the purge cycle to permanently "

View File

@ -152,7 +152,7 @@ class NsxLibBase(object):
url = self._add_pagination_parameters("search?query=%s" % query,
cursor, page_size)
# Retry the search on case of error
# Retry the search in case of error
@utils.retry_upon_exception(exceptions.NsxSearchError,
max_attempts=self.client.max_attempts)
def do_search(url):
@ -189,8 +189,8 @@ class NsxLibBase(object):
url = self._add_pagination_parameters("search?query=%s" % query,
cursor, page_size)
# Retry the search on case of error
@utils.retry_upon_exception(exceptions.NsxIndexingInProgress,
# Retry the search in case of error
@utils.retry_upon_exception(exceptions.NsxSearchError,
max_attempts=self.client.max_attempts)
def do_search(url):
return self.client.url_get(url)