Re: [devel] [PATCH 1/1] pyosaf: decorate function does not handle version struct in initialize functions [#2524]
Just remind, Hi Anders, Hans and Zoran, Do you have any comments for my patch? I hope you spend a little time to quick look this patch. It's related to MR HL Python Interface [MR54015], will be first demo on this Friday (13th Oct). Also, ticket #1410 Thanks, Hieu -Original Message- From: Hieu Nguyen [mailto:hieu.t.ngu...@dektech.com.au] Sent: Thursday, October 5, 2017 5:27 PM To: hans.nordeb...@ericsson.com; anders.wid...@ericsson.com; zoran.milinko...@ericsson.com Cc: opensaf-devel@lists.sourceforge.net; Hieu NguyenSubject: [PATCH 1/1] pyosaf: decorate function does not handle version struct in initialize functions [#2524] --- python/pyosaf/utils/__init__.py | 38 +++ python/pyosaf/utils/clm/__init__.py | 18 - python/pyosaf/utils/immoi/__init__.py | 12 +-- python/pyosaf/utils/immom/__init__.py | 11 +- python/pyosaf/utils/log/__init__.py | 4 ++-- python/pyosaf/utils/ntf/__init__.py | 17 6 files changed, 69 insertions(+), 31 deletions(-) diff --git a/python/pyosaf/utils/__init__.py b/python/pyosaf/utils/__init__.py index 0d4b648..17a1408 100644 --- a/python/pyosaf/utils/__init__.py +++ b/python/pyosaf/utils/__init__.py @@ -16,6 +16,7 @@ import time +from copy import deepcopy from pyosaf.saAis import eSaAisErrorT @@ -70,3 +71,40 @@ def decorate(function): return error return inner + + +def initialize_decorate(function, current_version): +''' Decorate the given SAF initialize() with current version so that it +retries a fixed number of times if needed and raises an exception +if it encounters any fault other than SA_AIS_ERR_TRY_AGAIN. +''' +# Backup current version +backup_version = deepcopy(current_version) + +def inner(*args): +''' Calls "function" in the lexical scope in a retry loop and raises +an exception if it encounters any other faults. +''' +one_sec_sleeps = 0 +error = function(*args) + +while error == eSaAisErrorT.SA_AIS_ERR_TRY_AGAIN: +if one_sec_sleeps == TRY_AGAIN_COUNT: +break + +time.sleep(1) +one_sec_sleeps += 1 + +# If SAF initialize() returns ERR_TRY_AGAIN, the version will be +# updated to the latest version +# Set current version in this case +current_version = deepcopy(backup_version) +args = args[:2] + (current_version,) +error = function(*args) + +if error != eSaAisErrorT.SA_AIS_OK: +raise_saf_exception(function, error) + +return error + +return inner diff --git a/python/pyosaf/utils/clm/__init__.py b/python/pyosaf/utils/clm/__init__.py index 9b9e11f..926e2f4 100644 --- a/python/pyosaf/utils/clm/__init__.py +++ b/python/pyosaf/utils/clm/__init__.py @@ -20,12 +20,15 @@ from pyosaf import saClm, saAis -from pyosaf.utils import decorate +from pyosaf.utils import decorate, initialize_decorate + +# Define CLM version +CLM_VER = saAis.SaVersionT('B', 4, 1) # Decorate the raw saClm* functions with retry and raising exceptions -saClmInitialize= decorate(saClm.saClmInitialize) -saClmInitialize_3 = decorate(saClm.saClmInitialize_3) -saClmInitialize_4 = decorate(saClm.saClmInitialize_4) +saClmInitialize = initialize_decorate(saClm.saClmInitialize, CLM_VER) +saClmInitialize_3 = initialize_decorate(saClm.saClmInitialize_3, +CLM_VER) +saClmInitialize_4 = initialize_decorate(saClm.saClmInitialize_4, +CLM_VER) saClmSelectionObjectGet= decorate(saClm.saClmSelectionObjectGet) saClmDispatch = decorate(saClm.saClmDispatch) saClmFinalize = decorate(saClm.saClmFinalize) @@ -119,11 +122,8 @@ def initialize(track_fn=None): callbacks.saClmClusterNodeGetCallback = saClm.SaClmClusterNodeGetCallbackT_4(node_get_callback) callbacks.saClmClusterTrackCallback = saClm.SaClmClusterTrackCallbackT_4(track_callback) -# Define which version to use of the CLM API -version = saAis.SaVersionT('B', 4, 1) - # Initialize the CLM API -saClmInitialize_4(HANDLE, callbacks, version) +saClmInitialize_4(HANDLE, callbacks, CLM_VER) def track(flags=saAis.saAis.SA_TRACK_CHANGES_ONLY): saClmClusterTrack_4(HANDLE, flags, None) @@ -131,7 +131,7 @@ def track(flags=saAis.saAis.SA_TRACK_CHANGES_ONLY): def get_members(): notification_buffer = saClm.SaClmClusterNotificationBufferT_4() -saClmClusterTrack_4(HANDLE, saAis.saAis.SA_TRACK_CURRENT, +saClmClusterTrack_4(HANDLE, saAis.saAis.SA_TRACK_CURRENT, notification_buffer) cluster_nodes = [] diff --git a/python/pyosaf/utils/immoi/__init__.py b/python/pyosaf/utils/immoi/__init__.py index 02ad89b..ecfeb7e 100644 ---
Re: [devel] [PATCH 0/1] Review Request for smf: Upgrade failed due to CCB aborted by imm sync request [#2584]
ACK On 10/11/2017 08:08 AM, Vijay Roy wrote: Summary: smf: Upgrade failed due to CCB aborted by imm sync request [#2584] Review request for Ticket(s): 2584 Peer Reviewer(s): lennart.l...@ericsson.com,rafael.odza...@ericsson.com Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-2584 Base revision: 39b6568271fb6291cd654c8edf5b9104968bf3c4 Personal repository: git://git.code.sf.net/u/vijayroy/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesy OpenSAF servicesn Core libraries n Samples n Tests n Other n NOTE: Patch(es) contain lines longer than 80 characers Comments (indicate scope for each "y" above): - *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision 968aa78226d827142b344518f37782e3abe1489f Author: Vijay RoyDate: Wed, 11 Oct 2017 10:27:59 +0530 smf: Upgrade failed due to CCB aborted by imm sync request [#2584] The Patch provides the fix where smfCreateRollbackElement return OK to avoid failed/ERR_EXIST situation. Also fixed the logging of messages correctly. * This issue is a by-product of the fix/patch provided at commit 44d113c4fa669065afe78d70bc81c5297d79ec0e. Complete diffstat: -- src/smf/smfd/SmfCampaignWrapup.cc | 67 +++ 1 file changed, 40 insertions(+), 27 deletions(-) Testing Commands: - *** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES *** 1. Trigger SMF MW upgrade with more then 10 objects to get hold of IMM sync. 2. Set current MW as 5.1 version 3. Configure SC-1, SC-2, PL-3 4. Initiate SMF MW upgrade from 5.1 to 5.2 5. During upgrade add the node PL-4. (To Trigger the IMM Sync as listed at point 1) Testing, Expected Results: -- *** PASTE COMMAND OUTPUTS / TEST RESULTS *** 1. Upgrade Campaign Wrapup should successfully retry during IMM sync instead of failed. Conditions of Submission: - *** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC *** Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain
Re: [devel] [PATCH 1/1] smf: Upgrade failed due to CCB aborted by imm sync request [#2584]
Hi Vijay Ack Thanks Lennart > -Original Message- > From: Vijay Roy [mailto:vijay@oracle.com] > Sent: den 11 oktober 2017 08:09 > To: Lennart Lund> Cc: opensaf-devel@lists.sourceforge.net; Vijay Roy > Subject: [PATCH 1/1] smf: Upgrade failed due to CCB aborted by imm sync > request [#2584] > > The Patch provides the fix where smfCreateRollbackElement return OK to > avoid failed/ERR_EXIST situation. > Also fixed the logging of messages correctly. > > * This issue is a by-product of the fix/patch provided at commit > 44d113c4fa669065afe78d70bc81c5297d79ec0e. > --- > src/smf/smfd/SmfCampaignWrapup.cc | 67 +++--- > - > 1 file changed, 40 insertions(+), 27 deletions(-) > > diff --git a/src/smf/smfd/SmfCampaignWrapup.cc > b/src/smf/smfd/SmfCampaignWrapup.cc > index 199ee19..934f2f2 100644 > --- a/src/smf/smfd/SmfCampaignWrapup.cc > +++ b/src/smf/smfd/SmfCampaignWrapup.cc > @@ -214,53 +214,66 @@ bool > SmfCampaignWrapup::executeCampComplete() { >// Campaign wrapup complete actions >LOG_NO("CAMP: Start campaign complete actions (%zu)", > m_campCompleteAction.size()); > - base::Timer adminOpTimer(6); > + base::Timer doImmOpTimer(6); >SaAisErrorT ais_rc = SA_AIS_OK; >bool rc = true; >std::string completeRollbackDn; >completeRollbackDn = "smfRollbackElement=CampComplete,"; >completeRollbackDn += SmfCampaignThread::instance()->campaign()- > >getDn(); > > - while (adminOpTimer.is_timeout() == false) { > + while (doImmOpTimer.is_timeout() == false) { > ais_rc = smfCreateRollbackElement(completeRollbackDn, >SmfCampaignThread::instance()->getImmHandle()); > if (ais_rc == SA_AIS_ERR_TRY_AGAIN) { > base::Sleep(base::kFiveHundredMilliseconds); > continue; > } else if (ais_rc != SA_AIS_OK) { > -LOG_WA("%s: SmfCampaignWrapup::executeCampComplete Fail '%s'", > __FUNCTION__, > - saf_error(ais_rc)); > +LOG_WA("%s: SmfCampaignWrapup::executeCampComplete Fail '%s'", > + __FUNCTION__, saf_error(ais_rc)); > rc = false; > -break; > } > + break; >} > - if (adminOpTimer.is_timeout() == true && ais_rc != SA_AIS_OK) { > -LOG_WA("%s: SmfCampaignWrapup::executeCampComplete() timeout > Fail '%s'", __FUNCTION__, > - saf_error(ais_rc)); > + > + if (doImmOpTimer.is_timeout() == true && ais_rc != SA_AIS_OK) { > + LOG_WA("%s: SmfCampaignWrapup::executeCampComplete() timeout > Fail '%s'", > +__FUNCTION__, saf_error(ais_rc)); > + rc = false; >} > > - for (auto& elem : m_campCompleteAction) { > -base::Timer adminOpTimer(6); > -while (adminOpTimer.is_timeout() == false) { > - ais_rc = (*elem).execute(SmfCampaignThread::instance()- > >getImmHandle(), > + if (rc == true) > + { > + for (auto& elem : m_campCompleteAction) { > + doImmOpTimer.set_timeout_time(6); > + while (doImmOpTimer.is_timeout() == false) { > + ais_rc = (*elem).execute(SmfCampaignThread::instance()- > >getImmHandle(), >); > - if (ais_rc == SA_AIS_ERR_TRY_AGAIN) { > - base::Sleep(base::kFiveHundredMilliseconds); > - continue; > - } else if (ais_rc != SA_AIS_OK) { > - LOG_WA("%s: SmfCampaignWrapup::executeCampComplete Fail '%s'", > __FUNCTION__, > - saf_error(ais_rc)); > - rc = false; > - break; > - } > -} > -if (adminOpTimer.is_timeout() == true && ais_rc != SA_AIS_OK) { > - LOG_WA("%s: SmfCampaignWrapup::executeCampComplete(): > m_campCompleteAction timeout Fail '%s'" > - , __FUNCTION__, saf_error(ais_rc)); > -} > + if (ais_rc == SA_AIS_ERR_TRY_AGAIN) { > + base::Sleep(base::kFiveHundredMilliseconds); > + continue; > + } else if (ais_rc != SA_AIS_OK) { > + LOG_WA("%s: SmfCampaignWrapup::executeCampComplete Fail > '%s'", > + __FUNCTION__, saf_error(ais_rc)); > + rc = false; > + } > + break; > + } > + if (doImmOpTimer.is_timeout() == true && ais_rc != SA_AIS_OK) { > + LOG_WA("%s: SmfCampaignWrapup::executeCampComplete(): " > + " m_campCompleteAction timeout Fail '%s'", > + __FUNCTION__, saf_error(ais_rc)); > + rc = false; > + } > + if (rc == false) > + break; > + } >} > > - LOG_NO("CAMP: Campaign complete actions completed"); > + if (rc == true) > + LOG_NO("CAMP: Campaign complete actions completed"); > + else > + LOG_NO("CAMP: Campaign complete actions Failed"); > + >TRACE_LEAVE(); > >return rc; > -- > 1.9.1 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org!
[devel] [PATCH 0/1] Review Request for smf: Upgrade failed due to CCB aborted by imm sync request [#2584]
Summary: smf: Upgrade failed due to CCB aborted by imm sync request [#2584] Review request for Ticket(s): 2584 Peer Reviewer(s): lennart.l...@ericsson.com,rafael.odza...@ericsson.com Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-2584 Base revision: 39b6568271fb6291cd654c8edf5b9104968bf3c4 Personal repository: git://git.code.sf.net/u/vijayroy/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesy OpenSAF servicesn Core libraries n Samples n Tests n Other n NOTE: Patch(es) contain lines longer than 80 characers Comments (indicate scope for each "y" above): - *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision 968aa78226d827142b344518f37782e3abe1489f Author: Vijay RoyDate: Wed, 11 Oct 2017 10:27:59 +0530 smf: Upgrade failed due to CCB aborted by imm sync request [#2584] The Patch provides the fix where smfCreateRollbackElement return OK to avoid failed/ERR_EXIST situation. Also fixed the logging of messages correctly. * This issue is a by-product of the fix/patch provided at commit 44d113c4fa669065afe78d70bc81c5297d79ec0e. Complete diffstat: -- src/smf/smfd/SmfCampaignWrapup.cc | 67 +++ 1 file changed, 40 insertions(+), 27 deletions(-) Testing Commands: - *** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES *** 1. Trigger SMF MW upgrade with more then 10 objects to get hold of IMM sync. 2. Set current MW as 5.1 version 3. Configure SC-1, SC-2, PL-3 4. Initiate SMF MW upgrade from 5.1 to 5.2 5. During upgrade add the node PL-4. (To Trigger the IMM Sync as listed at point 1) Testing, Expected Results: -- *** PASTE COMMAND OUTPUTS / TEST RESULTS *** 1. Upgrade Campaign Wrapup should successfully retry during IMM sync instead of failed. Conditions of Submission: - *** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC *** Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual.