Use realization ID if not found by search api

In case the search api fails to find the realization id after few
tries, it checks the realization info api.
If the state is realized and the id was found - return this id with
a warning, as this shouldn't happen normally.

Change-Id: I292bf5e50583376bb742f7a342b92a58efb2fede
This commit is contained in:
Adit Sarfaty 2019-10-02 11:13:07 +03:00
parent ea2f4ea568
commit ea7ff3a093
1 changed files with 6 additions and 0 deletions

View File

@ -307,6 +307,12 @@ class NsxPolicyResourceBase(object):
resource_type=resource_def.resource_type(),
resource_id=resource_def.get_id(),
error=error_msg)
if (info and info['state'] == constants.STATE_REALIZED and
info.get('realization_specific_identifier')):
LOG.warning("Realization ID for %s was not found via "
"search api although it was realized",
policy_resource_path)
return info['realization_specific_identifier']
eventlet.sleep(sleep)
test_num += 1