Hi Vijay
I had to copy some of the code to make the comments possible to understand
See comments tagged [Lennart]
--------------------------------------
while (adminOpTimer.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));
rc = false;
break;
} else {
// Done
break;
}
[Lennart] Both break; above and the last else can be replaced by a break; here
}
if (adminOpTimer.is_timeout() == true && ais_rc != SA_AIS_OK) {
LOG_WA("%s: SmfCampaignWrapup::executeCampComplete() timeout Fail '%s'",
__FUNCTION__,
saf_error(ais_rc));
[Lennart] rc = false; is missing
}
[Lennart] Execute the following for loop only if the previous call succeeded
for (auto& elem : m_campCompleteAction) {
base::Timer adminOpTimer(60000);
while (adminOpTimer.is_timeout() == false) {
ais_rc = (*elem).execute(SmfCampaignThread::instance()->getImmHandle(),
&completeRollbackDn);
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;
} else {
// Done
break;
}
[Lennart] Both break; above and the last else can be replaced by a break; here
(same as above)
}
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));
[Lennart] rc = false; is missing
}
[Lennart] Also break this for loop if the execute call fail (if (rc == false)
break;)
}
[Lennart] Log this message only if the campaign complete is successful
otherwise log an error message
LOG_NO("CAMP: Campaign complete actions completed");
TRACE_LEAVE();
return rc;
-----------------------------------------------
Thanks
Lennart
> -----Original Message-----
> From: Vijay Roy [mailto:[email protected]]
> Sent: den 9 oktober 2017 11:50
> To: Lennart Lund <[email protected]>
> Cc: [email protected]; Vijay Roy <[email protected]>
> 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.
>
> This issue is a by-product of the fix/patch provided at commit
> 44d113c4fa669065afe78d70bc81c5297d79ec0e.
> ---
> src/smf/smfd/SmfCampaignWrapup.cc | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/src/smf/smfd/SmfCampaignWrapup.cc
> b/src/smf/smfd/SmfCampaignWrapup.cc
> index 199ee19..4ead11a 100644
> --- a/src/smf/smfd/SmfCampaignWrapup.cc
> +++ b/src/smf/smfd/SmfCampaignWrapup.cc
> @@ -232,6 +232,9 @@ bool SmfCampaignWrapup::executeCampComplete()
> {
> saf_error(ais_rc));
> rc = false;
> break;
> + } else {
> + // Done
> + break;
> }
> }
> if (adminOpTimer.is_timeout() == true && ais_rc != SA_AIS_OK) {
> @@ -252,6 +255,9 @@ bool SmfCampaignWrapup::executeCampComplete()
> {
> saf_error(ais_rc));
> rc = false;
> break;
> + } else {
> + // Done
> + break;
> }
> }
> if (adminOpTimer.is_timeout() == true && ais_rc != SA_AIS_OK) {
> --
> 1.9.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel