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
This commit is contained in:
parent
dd23782b57
commit
1a07d7aa97
|
@ -5734,7 +5734,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):
|
||||
|
|
|
@ -261,6 +261,13 @@ class NsxPolicyResourceBase(object, metaclass=abc.ABCMeta):
|
|||
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