From ea7ff3a0937c8766f66aea82d4c22c7b5f782824 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Wed, 2 Oct 2019 11:13:07 +0300 Subject: [PATCH] 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 --- vmware_nsxlib/v3/policy/core_resources.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vmware_nsxlib/v3/policy/core_resources.py b/vmware_nsxlib/v3/policy/core_resources.py index a94175c7..aaff4ed9 100644 --- a/vmware_nsxlib/v3/policy/core_resources.py +++ b/vmware_nsxlib/v3/policy/core_resources.py @@ -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