Retry upon None error code when wait_until_realized
There is a short gap between NSX-T provider updating the realization
entity with Error state, and attaching with actual alarms. This would
result in nsxlib returning 'Unknown' RealizationErrorStateError
exception, while the real error is something else.
Upon getting a None error code, the get_info funtion should be retried
as well.
Change-Id: Ica3051b4858991738992022df1dd62b47dd9178d
(cherry picked from commit 1a07d7aa97
)
This commit is contained in:
parent
daddb21ae7
commit
6a8f1292bc
|
@ -5677,7 +5677,9 @@ class TestPolicyTier1SegmentPort(NsxPolicyLibTestCase):
|
|||
port_id = 'port-111'
|
||||
segment_id = 'seg-111'
|
||||
info = {'state': constants.STATE_ERROR,
|
||||
'alarms': [{'message': 'dummy'}],
|
||||
'alarms': [{'message': 'dummy',
|
||||
'error_details': {
|
||||
'error_code': 5109}}],
|
||||
'entity_type': 'RealizedLogicalPort'}
|
||||
with mock.patch.object(self.resourceApi, "_get_realization_info",
|
||||
return_value=info):
|
||||
|
|
|
@ -263,6 +263,13 @@ class NsxPolicyResourceBase(object):
|
|||
if info['state'] == constants.STATE_ERROR:
|
||||
error_msg, error_code, related_error_codes = \
|
||||
self._get_realization_error_message_and_code(info)
|
||||
# There could be a delay between setting NSX-T
|
||||
# Error realization state and updating the realization
|
||||
# entity with alarms. Retry should be perform upon None
|
||||
# error code to avoid 'Unknown' RealizationErrorStateError
|
||||
# exception
|
||||
if error_code is None:
|
||||
return
|
||||
raise exceptions.RealizationErrorStateError(
|
||||
resource_type=resource_def.resource_type(),
|
||||
resource_id=resource_def.get_id(),
|
||||
|
|
Loading…
Reference in New Issue