"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "python/pyosaf/utils/__init__.py" between
opensaf-5.21.06.tar.gz and opensaf-5.21.09.tar.gz

About: OpenSAF is a project focused on Service Availability (SA) that develops middleware based on open and industry standard interfaces for applications requiring uninterrupted 24x7 service.

__init__.py  (opensaf-5.21.06):__init__.py  (opensaf-5.21.09)
skipping to change at line 78 skipping to change at line 78
saImmOmCcbGetErrorStrings = decorate(saImmOm.saImmOmCcbGetErrorStrings) saImmOmCcbGetErrorStrings = decorate(saImmOm.saImmOmCcbGetErrorStrings)
# Get error strings # Get error strings
# As soon as the ccb_handle is finalized, the strings are freed # As soon as the ccb_handle is finalized, the strings are freed
rc = saImmOmCcbGetErrorStrings(ccb_handle, c_error_strings) rc = saImmOmCcbGetErrorStrings(ccb_handle, c_error_strings)
if rc == eSaAisErrorT.SA_AIS_OK: if rc == eSaAisErrorT.SA_AIS_OK:
if c_error_strings: if c_error_strings:
list_err_strings = unmarshalNullArray(c_error_strings) list_err_strings = unmarshalNullArray(c_error_strings)
for c_error_string in list_err_strings: for c_error_string in list_err_strings:
if c_error_string.startswith("IMM: Resource abort: "): if c_error_string.startswith("IMM: Resource abort: "):
return True if "CCB is in an error state" not in c_error_string:
return True
return False return False
def decorate(func): def decorate(func):
""" Decorate the given SAF function so that it retries a fixed number of """ Decorate the given SAF function so that it retries a fixed number of
times for certain returned error codes during execution times for certain returned error codes during execution
Args: Args:
func (function): The decorated SAF function func (function): The decorated SAF function
skipping to change at line 116 skipping to change at line 117
break break
if rc == eSaAisErrorT.SA_AIS_ERR_TRY_AGAIN: if rc == eSaAisErrorT.SA_AIS_ERR_TRY_AGAIN:
sleep_time_interval = RETRY_INTERVAL sleep_time_interval = RETRY_INTERVAL
elif rc == eSaAisErrorT.SA_AIS_ERR_NO_RESOURCES: elif rc == eSaAisErrorT.SA_AIS_ERR_NO_RESOURCES:
sleep_time_interval = RETRY_INTERVAL sleep_time_interval = RETRY_INTERVAL
elif rc == eSaAisErrorT.SA_AIS_ERR_BUSY: elif rc == eSaAisErrorT.SA_AIS_ERR_BUSY:
sleep_time_interval = 3 * RETRY_INTERVAL sleep_time_interval = 3 * RETRY_INTERVAL
elif rc == eSaAisErrorT.SA_AIS_ERR_FAILED_OPERATION: elif rc == eSaAisErrorT.SA_AIS_ERR_FAILED_OPERATION:
# Retry on getting FAILED_OPERATION only applies to IMM # Retry on getting FAILED_OPERATION only applies to IMM
# CCB-related operations in case of a resource abort; # CCB-related operations in case of a resource abort
# and CCB not in error state.
ccb_handle = args[0] ccb_handle = args[0]
resource_abort = check_resource_abort(ccb_handle) resource_abort = check_resource_abort(ccb_handle)
if not resource_abort: if not resource_abort:
break break
sleep_time_interval = RETRY_INTERVAL sleep_time_interval = RETRY_INTERVAL
else: else:
break # Break out of the retry loop break # Break out of the retry loop
# Check sleep_time_interval to sleep and retry the function # Check sleep_time_interval to sleep and retry the function
time.sleep(sleep_time_interval) time.sleep(sleep_time_interval)
 End of changes. 2 change blocks. 
2 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)