Re: [devel] [PATCH 1 of 1] amfd: fix SHUTTING_DOWN state validation during standby AMFD initialization [#1560]

2015-11-17 Thread Hans Nordebäck
ack, code review only. Minor comments below. /Thanks HansN

On 11/17/2015 09:56 AM, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/app.cc |  2 +-
>   osaf/services/saf/amf/amfd/cluster.cc |  2 +-
>   osaf/services/saf/amf/amfd/include/util.h |  3 ++-
>   osaf/services/saf/amf/amfd/node.cc|  2 +-
>   osaf/services/saf/amf/amfd/nodegroup.cc   |  2 +-
>   osaf/services/saf/amf/amfd/sg.cc  |  2 +-
>   osaf/services/saf/amf/amfd/si.cc  |  2 +-
>   osaf/services/saf/amf/amfd/su.cc  |  2 +-
>   osaf/services/saf/amf/amfd/util.cc|  7 +--
>   9 files changed, 14 insertions(+), 10 deletions(-)
>
>
> AMFD intialization fails for standby controller if any AMF entities is in 
> SHUTTING_DOWN state.
>
> In the pushed patch for #1560, AMF does not allow creation of AMF entities in 
> SHUTTING_DOWN
> state. Function avd_admin_state_is_valid() must handle both the cases
> 1)When controller joins the cluster.
> 2)When a new AMF having admin state entity is configured.
> Currently it is handling case 2) only.
>
> Patch fixes the problem for case 1).
>
> diff --git a/osaf/services/saf/amf/amfd/app.cc 
> b/osaf/services/saf/amf/amfd/app.cc
> --- a/osaf/services/saf/amf/amfd/app.cc
> +++ b/osaf/services/saf/amf/amfd/app.cc
> @@ -190,7 +190,7 @@ static int is_config_valid(const SaNameT
>   }
>   
>   if 
> ((immutil_getAttr(const_cast("saAmfApplicationAdminState"), 
> attributes, 0, ) == SA_AIS_OK) &&
> - !avd_admin_state_is_valid(admstate)) {
> + !avd_admin_state_is_valid(admstate, opdata)) {
>   report_ccb_validation_error(opdata, "Invalid 
> saAmfApplicationAdminState %u for '%s'", admstate, dn->value);
>   return 0;
>   }
> diff --git a/osaf/services/saf/amf/amfd/cluster.cc 
> b/osaf/services/saf/amf/amfd/cluster.cc
> --- a/osaf/services/saf/amf/amfd/cluster.cc
> +++ b/osaf/services/saf/amf/amfd/cluster.cc
> @@ -243,7 +243,7 @@ SaAisErrorT avd_cluster_config_get(void)
>   avd_cluster->saAmfClusterAdminState = SA_AMF_ADMIN_UNLOCKED;
>   }
>   
> - if (!avd_admin_state_is_valid(avd_cluster->saAmfClusterAdminState)) {
> + if (!avd_admin_state_is_valid(avd_cluster->saAmfClusterAdminState, 
> nullptr)) {
>   LOG_ER("Invalid saAmfClusterAdminState %u", 
> avd_cluster->saAmfClusterAdminState);
>   return static_cast(-1);
>   }
> diff --git a/osaf/services/saf/amf/amfd/include/util.h 
> b/osaf/services/saf/amf/amfd/include/util.h
> --- a/osaf/services/saf/amf/amfd/include/util.h
> +++ b/osaf/services/saf/amf/amfd/include/util.h
> @@ -39,6 +39,7 @@
>   #include 
>   #include 
>   #include 
> +#include 
>   
>   class AVD_SU;
>   
> @@ -133,7 +134,7 @@ uint32_t avd_d2d_msg_snd(struct cl_cb_ta
>   
>   std::string to_string(const SaNameT );
>   
> -extern int avd_admin_state_is_valid(SaAmfAdminStateT state);
> +extern int avd_admin_state_is_valid(SaAmfAdminStateT state, const 
> CcbUtilOperationData_t *opdata);
>   extern SaAisErrorT avd_object_name_create(SaNameT *rdn_attr_value, SaNameT 
> *parentName, SaNameT *object_name);
>   int amfd_file_dump(const char* filename);
>   
> diff --git a/osaf/services/saf/amf/amfd/node.cc 
> b/osaf/services/saf/amf/amfd/node.cc
> --- a/osaf/services/saf/amf/amfd/node.cc
> +++ b/osaf/services/saf/amf/amfd/node.cc
> @@ -253,7 +253,7 @@ static int is_config_valid(const SaNameT
>   }
>   
>   if ((immutil_getAttr(const_cast("saAmfNodeAdminState"), 
> attributes, 0, ) == SA_AIS_OK) &&
> - !avd_admin_state_is_valid(admstate)) {
> + !avd_admin_state_is_valid(admstate, opdata)) {
>   report_ccb_validation_error(opdata, "Invalid 
> saAmfNodeAdminState %u for '%s'", admstate, dn->value);
>   return 0;
>   }
> diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
> b/osaf/services/saf/amf/amfd/nodegroup.cc
> --- a/osaf/services/saf/amf/amfd/nodegroup.cc
> +++ b/osaf/services/saf/amf/amfd/nodegroup.cc
> @@ -106,7 +106,7 @@ static int is_config_valid(const SaNameT
>   return 0;
>   }
>   //Check if admin state is valid or not.
> - if (!avd_admin_state_is_valid(tmp_ng->saAmfNGAdminState)) {
> + if (!avd_admin_state_is_valid(tmp_ng->saAmfNGAdminState, opdata)) {
>   LOG_ER("Incorrect saAmfNGAdminState:'%u' for 
> '%s'",tmp_ng->saAmfNGAdminState,
>   tmp_ng->name.value);
>   delete tmp_ng;
> diff --git a/osaf/services/saf/amf/amfd/sg.cc 
> b/osaf/services/saf/amf/amfd/sg.cc
> --- a/osaf/services/saf/amf/amfd/sg.cc
> +++ b/osaf/services/saf/amf/amfd/sg.cc
> @@ -242,7 +242,7 @@ static int is_config_valid(const SaNameT
>   }
>   
>   if ((immutil_getAttr(const_cast("saAmfSGAdminState"), 
> attributes, 0, ) == SA_AIS_OK) &&
> - !avd_admin_state_is_valid(admstate)) {
> + !avd_admin_state_is_valid(admstate, opdata)) {
>   report_ccb_validation_error(opdata, "Invalid 

Re: [devel] [PATCH 1 of 1] amfd: remove duplicate code in node_fail_sg_relgn [#1520]

2015-11-12 Thread Hans Nordebäck
ack, code review only. /Thanks HansN

On 11/12/2015 06:31 AM, Gary Lee wrote:
>   osaf/services/saf/amf/amfd/include/sg.h  |2 +
>   osaf/services/saf/amf/amfd/sg_npm_fsm.cc |  230 
> --
>   2 files changed, 39 insertions(+), 193 deletions(-)
>
>
> diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
> b/osaf/services/saf/amf/amfd/include/sg.h
> --- a/osaf/services/saf/amf/amfd/include/sg.h
> +++ b/osaf/services/saf/amf/amfd/include/sg.h
> @@ -510,6 +510,8 @@
>   uint32_t su_fault_sg_relgn(AVD_CL_CB *cb, AVD_SU *su);
>   uint32_t susi_sucss_sg_reln(AVD_CL_CB *cb, AVD_SU *su, struct 
> avd_su_si_rel_tag *susi,
>  AVSV_SUSI_ACT act, SaAmfHAStateT state);
> +bool sg_stable(AVD_CL_CB* cb, AVD_SU* su);
> +void node_fail_sg_relgn(AVD_CL_CB* cb, AVD_SU* su);
>   };
>   
>   /**
> diff --git a/osaf/services/saf/amf/amfd/sg_npm_fsm.cc 
> b/osaf/services/saf/amf/amfd/sg_npm_fsm.cc
> --- a/osaf/services/saf/amf/amfd/sg_npm_fsm.cc
> +++ b/osaf/services/saf/amf/amfd/sg_npm_fsm.cc
> @@ -3213,7 +3213,7 @@
>*
>**/
>   
> -static void avd_sg_npm_node_fail_sg_relgn(AVD_CL_CB *cb, AVD_SU *su)
> +void SG_NPM::node_fail_sg_relgn(AVD_CL_CB *cb, AVD_SU *su)
>   {
>   AVD_SU_SI_REL *l_susi, *o_susi, *ot_susi;
>   bool l_flag = false;
> @@ -3329,26 +3329,7 @@
>   
> su->sg_of_su->admin_si->set_si_switch(cb, AVSV_SI_TOGGLE_STABLE);
>   m_AVD_CLEAR_SG_ADMIN_SI(cb, 
> (su->sg_of_su));
>   
> - if (su->sg_of_su->su_oper_list.empty() 
> == true) {
> - /* both the SI admin pointer 
> and SU oper list are empty.
> -  * Do the functionality as in 
> stable state to verify if
> -  * new assignments can be done. 
> If yes stay in the same state.
> -  * If no new assignments change 
> state to stable.
> -  */
> - if 
> (avd_sg_npm_su_chose_asgn(cb, su->sg_of_su) == NULL) {
> - /* all the assignments 
> have already been done in the SG. */
> - m_AVD_SET_SG_FSM(cb, 
> (su->sg_of_su), AVD_SG_FSM_STABLE);
> - 
> avd_sidep_sg_take_action(su->sg_of_su);
> - if ((AVD_SG_FSM_STABLE 
> == su->sg_of_su->sg_fsm_state) &&
> - (true 
> == su->sg_of_su->equal_ranked_su) &&
> - 
> (SA_TRUE == su->sg_of_su->saAmfSGAutoAdjust)) {
> - /* SG fsm is 
> stable, screen for possibility of
> -
> redistributing SI to achieve equal distribution */
> - 
> avd_sg_npm_screening_for_si_redistr(su->sg_of_su);
> - }
> - }
> - }
> -
> + sg_stable(cb, su);
>   }   /* if ((l_susi->state == 
> SA_AMF_HA_QUIESCED) &&
>  (l_susi->fsm == 
> AVD_SU_SI_STATE_MODIFY)) */
>   else if ((l_susi->state == SA_AMF_HA_QUIESCED) 
> &&
> @@ -3367,25 +3348,7 @@
>   /* Free all the SI assignments to this 
> SU. */
>   su->delete_all_susis();
>   
> - if (su->sg_of_su->su_oper_list.empty() 
> == true) {
> - /* both the SI admin pointer 
> and SU oper list are empty.
> -  * Do the functionality as in 
> stable state to verify if
> -  * new assignments can be done. 
> If yes stay in the same state.
> -  * If no new assignments change 
> state to stable.
> -  */
> - if 
> (avd_sg_npm_su_chose_asgn(cb, su->sg_of_su) == NULL) {
> - /* all the assignments 
> have already been done in the SG. */
> - m_AVD_SET_SG_FSM(cb, 
> (su->sg_of_su), AVD_SG_FSM_STABLE);
> - 
> 

Re: [devel] [PATCH 1 of 1] amfd: adjust NPI app configuration during unlock-in op [#1564]

2015-11-12 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 28 oktober 2015 13:33
To: Hans Nordebäck; nagendr...@oracle.com; Gary Lee
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: adjust NPI app configuration during unlock-in op 
[#1564]

 osaf/services/saf/amf/amfd/node.cc  |  3 ++-
 osaf/services/saf/amf/amfd/nodegroup.cc |  1 +
 osaf/services/saf/amf/amfd/sg.cc|  1 +
 3 files changed, 4 insertions(+), 1 deletions(-)


SG went to unstable for unlock operation on locked SG.

This issue is applicable for NPI apps only.
For a NPI SU, only one SI can be assigned to the whole SU. Remaining SIs if 
configured will remain unassigned. Earliar creating a SU in the system was 
allowed only in LOCK_IN state. So in typical steps, a user used to configure a 
SU in the system in LOCK_IN state and after this user performs unlock-in 
operation on the SU. During this UNLOCK_IN opearation, AMF adjusts SG 
configuration attributes for example for NPI application it adjusts the value 
of saAmfSGMaxActiveSIsperSU and saAmfSGMaxStandbySIsperSU. So issue will not be 
reproducible in this way.
Now from 4.5 release creation of SU is allowed if either node or sg is in 
LOCK_IN state. In this reported issue SUs are created by keeping SG in LOCK_IN 
state.

Patch fixes the problem by adjusting the SG attributes during unlock-in 
operation on SG, Node or NG.

diff --git a/osaf/services/saf/amf/amfd/node.cc 
b/osaf/services/saf/amf/amfd/node.cc
--- a/osaf/services/saf/amf/amfd/node.cc
+++ b/osaf/services/saf/amf/amfd/node.cc
@@ -892,7 +892,8 @@ uint32_t node_admin_unlock_instantiation
LOG_WA("Failed Instantiation 
'%s'", su->name.value);
}
}
-   } 
+   } else
+   avd_sg_adjust_config(su->sg_of_su);
}
}
 
diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -940,6 +940,7 @@ static void ng_admin_unlock_inst(AVD_AMF
continue;
 
su_try_inst = 0;
+   avd_sg_adjust_config(sg);
for (const auto& su : sg->list_of_su) {
//Continue if this SU is not hosted on the Node 
of NG.
if 
(node_in_nodegroup(Amf::to_string(>su_on_node->name), ng) == false) diff 
--git a/osaf/services/saf/amf/amfd/sg.cc b/osaf/services/saf/amf/amfd/sg.cc
--- a/osaf/services/saf/amf/amfd/sg.cc
+++ b/osaf/services/saf/amf/amfd/sg.cc
@@ -1382,6 +1382,7 @@ static void sg_admin_op_cb(SaImmOiHandle
avd_sg_admin_state_set(sg, SA_AMF_ADMIN_LOCKED);
 
if ((sg->list_of_su.empty() == false) && 
(sg->first_su()->saAmfSUPreInstantiable == false)) {
+   avd_sg_adjust_config(sg);
avd_saImmOiAdminOperationResult(immOiHandle, 
invocation, SA_AIS_OK);
goto done;
}

--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: check for admin state for all nodegroup [#1563]

2015-11-12 Thread Hans Nordebäck
ack, code review only. Minor comment below/Thanks HansN

On 10/30/2015 01:54 PM, nagendr...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/node.cc  |  6 --
>   osaf/services/saf/amf/amfd/nodegroup.cc |  4 
>   2 files changed, 8 insertions(+), 2 deletions(-)
>
>
> Amf is not checking admin state for all the node groups to
> which a node belongs to during nodegroup unlock-in.
> Ideally, if one of the nodegroup of a node is in locked-in, Amf
> shouldn't instantiate the SUs on that node if another nodegroup
> of that node is being unlocked-in.
>
> diff --git a/osaf/services/saf/amf/amfd/node.cc 
> b/osaf/services/saf/amf/amfd/node.cc
> --- a/osaf/services/saf/amf/amfd/node.cc
> +++ b/osaf/services/saf/amf/amfd/node.cc
> @@ -1479,8 +1479,10 @@ bool any_ng_in_locked_in_state(const AVD
>   it != nodegroup_db->end(); it++) {
>   AVD_AMF_NG *ng = it->second;
>   if ((node_in_nodegroup(Amf::to_string(>name), ng) == 
> true) &&
> -(ng->saAmfNGAdminState == 
> SA_AMF_ADMIN_LOCKED_INSTANTIATION))
> -return true;
[HansN]
There is a mix of tabs and spaces below.
> + (ng->saAmfNGAdminState == 
> SA_AMF_ADMIN_LOCKED_INSTANTIATION)) {
> + TRACE("Nodegroup '%s' is in locked-in", ng->name.value);
> + return true;
> + }
>   }
>   return false;
>   }
> diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
> b/osaf/services/saf/amf/amfd/nodegroup.cc
> --- a/osaf/services/saf/amf/amfd/nodegroup.cc
> +++ b/osaf/services/saf/amf/amfd/nodegroup.cc
> @@ -892,6 +892,10 @@ static void ng_admin_unlock_inst(AVD_AMF
>   LOG_NO("'%s' UNLOCK_INSTANTIATION: AMF node oper state 
> disabled", node->name.value);
>   continue;
>   }
> + if (any_ng_in_locked_in_state(node) == true) {
> + LOG_NO("One of the node group of '%s' is in locked-in", 
> node->name.value);
> + continue;
> + }
>   for (const auto& node_su : node->list_of_su) {
>   /*Instantiate only those SUs in this SG which are 
> hosted on the Nodes of NG.
>  Also honor saAmfSURank while instantating.


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 00 of 48] Review Request for amfd: convert NULL to nullptr V2 [#1547]

2015-11-12 Thread Hans Nordebäck
Hi Long, patch is now pushed/Thanks HansN

On 11/12/2015 01:29 PM, Long Nguyen wrote:
> Hi Hans,
>
> You and Praveen ack'ed for this series. Can you please help to push 
> the code to the repository? I have zip'ed the patches for AMFD in the 
> attachment.
> Because many files have been changed, it would be good if you can push 
> it before someone else apply their patches. Thanks so much.
>
> Best regards,
> Long Nguyen.
>
> On 10/27/2015 7:08 PM, Hans Nordebäck wrote:
>> Ack for the series, code review only/Thanks HansN
>>
>> -Original Message-
>> From: Long Buu Nguyen H
>> Sent: den 19 oktober 2015 13:18
>> To: Hans Nordebäck; Gary Lee; praveen.malv...@oracle.com; 
>> nagendr...@oracle.com
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: [PATCH 00 of 48] Review Request for amfd: convert NULL to 
>> nullptr V2 [#1547]
>>
>> Summary: amfd: convert NULL to nullptr V2 [#1547] Review request for 
>> Trac Ticket(s): [#1547] Peer Reviewer(s): Hans, Gary, Praveen, Nagu 
>> Pull request to: Hans Affected branch(es): default Development 
>> branch: default
>>
>> 
>> 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
>>
>>
>> Comments (indicate scope for each "y" above):
>> -
>> In this Version 2:
>>
>> changeset c5187539b22b3ece04e72f68c1e5430d06d088d2
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for app.cc [#1547]
>>
>> changeset 046710d2e6e739b67c317d01350c6a5566fda3fa
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for apptype.cc [#1547]
>>
>> changeset 58e81ef6a0e7af8edb4dbced7325180d11d8d291
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for chkop.cc [#1547]
>>
>> changeset 555a485e21501fbfce91cc15d0ebd6833aed93d2
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for ckpt_dec.cc [#1547]
>>
>> changeset 1e8ebe3388af55e1d64c3ab56193f30965d1faa1
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for ckpt_edu.cc [#1547]
>>
>> changeset db7407ddfe2234a3e0e287ebb9ee0d7a8f9d17aa
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for ckpt_enc.cc [#1547]
>>
>> changeset c41b2a3d0081450ceddae17aadb2632046d35d74
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for ckpt_updt.cc [#1547]
>>
>> changeset fa79edb33b37c99282c7fb2f94a4f96224f558fa
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for clm.cc [#1547]
>>
>> changeset dcc4bb199d8af85845a7e3b64863c856c869d617
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for cluster.cc [#1547]
>>
>> changeset beb1263225472b3c0910a7a2c1530cd82fb5146e
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for comp.cc [#1547]
>>
>> changeset 3e80fd0be4fe99f86d4164a16e85ee2e813dd011
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 19 Oct 2015 15:37:29 +0700
>>
>> amfd: convert NULL to nullptr for compcstype.cc [#1547]
>>
>> changeset 825d548b07e2f475206087e4894f3614a2ae7ce7
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Mon, 1

Re: [devel] [PATCH 00 of 30] Review Request for amfnd: convert NULL to nullptr [#1551]

2015-11-12 Thread Hans Nordebäck
Hi Long, patch is now pushed/Thanks HansN

On 11/12/2015 01:30 PM, Long Nguyen wrote:
> Hi Hans,
>
> Can you please also push the code for AMFND? Thanks so much.
>
> Best regards,
> Long Nguyen.
>
> On 10/27/2015 7:09 PM, Hans Nordebäck wrote:
>> Ack for the series, code review only/Thanks HansN
>>
>> -Original Message-
>> From: Long HB Nguyen [mailto:long.hb.ngu...@dektech.com.au]
>> Sent: den 20 oktober 2015 11:58
>> To: Hans Nordebäck; Gary Lee; praveen.malv...@oracle.com; 
>> nagendr...@oracle.com
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: [PATCH 00 of 30] Review Request for amfnd: convert NULL to 
>> nullptr [#1551]
>>
>> Summary: amfnd: convert NULL to nullptr [#1551] Review request for 
>> Trac Ticket(s): [#1551] Peer Reviewer(s): Hans, Gary, Praveen, Nagu 
>> Pull request to: Hans Affected branch(es): default Development 
>> branch: default
>>
>> 
>> 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
>>
>>
>> Comments (indicate scope for each "y" above):
>> -
>>
>> changeset d9e5204b9cd64449385835be326c4635993233ca
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:08:29 +0700
>>
>> amfnd: convert NULL to nullptr for amfnd.cc [#1551]
>>
>> changeset 4aa0c0e69ea683b655e5ce95a48bd46668bb1947
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:13:52 +0700
>>
>> amfnd: convert NULL to nullptr for cbq.cc [#1551]
>>
>> changeset 8565a4b0f13090e2a248d4dc030107fe872c46e3
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:16:24 +0700
>>
>> amfnd: convert NULL to nullptr for chc.cc [#1551]
>>
>> changeset 61e799adaa100457d5da11741daab89abb312342
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:20:01 +0700
>>
>> amfnd: convert NULL to nullptr for ckpt_dec.cc [#1551]
>>
>> changeset 6146e7b22e233213be199892f03f8f2b87e7733a
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:22:03 +0700
>>
>> amfnd: convert NULL to nullptr for ckpt_edu.cc [#1551]
>>
>> changeset 3010ccff64a8b80f0b0ba2abeee3c3f569c06a36
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:23:20 +0700
>>
>> amfnd: convert NULL to nullptr for ckpt_enc.cc [#1551]
>>
>> changeset 19fff7f26c302b0a252c537979c5be117a96b8ab
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:24:52 +0700
>>
>> amfnd: convert NULL to nullptr for ckpt_updt.cc [#1551]
>>
>> changeset 58263076e522c0494bd91480001a68369818b0c9
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:26:02 +0700
>>
>> amfnd: convert NULL to nullptr for clc.cc [#1551]
>>
>> changeset ec0d86a8fcac950de12157c90406e1c60a688cc0
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:27:11 +0700
>>
>> amfnd: convert NULL to nullptr for clm.cc [#1551]
>>
>> changeset 6f24ab6b30da4a901bff37e3c65f628e478505d9
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:28:06 +0700
>>
>> amfnd: convert NULL to nullptr for comp.cc [#1551]
>>
>> changeset 114de32db084f1987a80fa450509619455702054
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:29:43 +0700
>>
>> amfnd: convert NULL to nullptr for compdb.cc [#1551]
>>
>> changeset 1351acca1f39d71e0d084a7bdb156d8168b73b16
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>
>> Date:Tue, 20 Oct 2015 14:42:44 +0700
>>
>> amfnd: convert NULL to nullptr for cpm.cc [#1551]
>>
>> changeset e850274601d9d382839c2538381c98b8151f08a2
>> Author:Long HB Nguyen<long.hb.ngu...@dektech.com.au>

Re: [devel] [PATCH 1 of 1] amfd: validate NG admin state at the time of creation [#1560]

2015-10-29 Thread Hans Nordebäck
ack, code review only/Thanks Hans

On 10/29/2015 06:24 AM, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/nodegroup.cc |  10 --
>   osaf/services/saf/amf/amfd/util.cc  |   2 +-
>   2 files changed, 9 insertions(+), 3 deletions(-)
>
>
> AMF allows creation of NG with invalid admin state.
>
> Check is missing in CCB completed callback.
>
> Patch adds the required check.
>
> diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
> b/osaf/services/saf/amf/amfd/nodegroup.cc
> --- a/osaf/services/saf/amf/amfd/nodegroup.cc
> +++ b/osaf/services/saf/amf/amfd/nodegroup.cc
> @@ -105,6 +105,13 @@ static int is_config_valid(const SaNameT
>   delete tmp_ng;
>   return 0;
>   }
> + //Check if admin state is valid or not.
> + if (!avd_admin_state_is_valid(tmp_ng->saAmfNGAdminState)) {
> + LOG_ER("Incorrect saAmfNGAdminState:'%u' for 
> '%s'",tmp_ng->saAmfNGAdminState,
> + tmp_ng->name.value);
> + delete tmp_ng;
> + return 0;
> + }
>   delete tmp_ng;
>   return 1;
>   }
> @@ -159,9 +166,8 @@ static AVD_AMF_NG *ng_create(SaNameT *dn
>   if (immutil_getAttr(const_cast("saAmfNGAdminState"),
>   attributes, 0, >saAmfNGAdminState) != 
> SA_AIS_OK) {
>   ng->saAmfNGAdminState = SA_AMF_ADMIN_UNLOCKED;
> - LOG_NO("Setting saAmfNGAdminState to 
> :'%u'",ng->saAmfNGAdminState);
> + TRACE("Setting saAmfNGAdminState to 
> :'%u'",ng->saAmfNGAdminState);
>   }
> - //TODO_NG: Add protection against shutting down state and lock-in state.
>   rc = 0;
>   done:
>   if (rc != 0) {
> diff --git a/osaf/services/saf/amf/amfd/util.cc 
> b/osaf/services/saf/amf/amfd/util.cc
> --- a/osaf/services/saf/amf/amfd/util.cc
> +++ b/osaf/services/saf/amf/amfd/util.cc
> @@ -1285,7 +1285,7 @@ uint32_t avd_snd_comp_validation_resp(AV
>   
>   int avd_admin_state_is_valid(SaAmfAdminStateT state)
>   {
> - return ((state >= SA_AMF_ADMIN_UNLOCKED) && (state <= 
> SA_AMF_ADMIN_SHUTTING_DOWN));
> + return ((state >= SA_AMF_ADMIN_UNLOCKED) && (state < 
> SA_AMF_ADMIN_SHUTTING_DOWN));
>   }
>   
>   
> /*


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: reject si-swap if SI will remain with only active state (NWAY)[#1516]

2015-10-29 Thread Hans Nordebäck
Hi Praveen,

I agreee, ack from me, code review only/Thanks HansN

On 10/29/2015 05:17 AM, praveen malviya wrote:
>
>
> On 29-Oct-15 4:22 AM, Hans Nordebäck wrote:
>> Hi Praveen,
>>
>> trying to understand the problem below, if N-way and
>> saAmfSGMaxStandbySIsperSU = 1,
>> and say there are 2 SUs and 2 SIs with the following assignments:
>> SU1   SU2
>> Active Standby  Standby Active
>> ^^   ^   ^
>> |  || |
>> SI1  SI2   SI1 SI2
>>
>> wouldn't si-swap of any si would lead to paritally assigned due to
>> saAmfSGMaxStandbySIsperSU = 1?
>> If so amf is performing according to spec, and to correct this,
>> saAmfSGMaxStandbySIsperSU has to be increased?
>
>
> In the above example if si-swap is performed on any SI then it will 
> lead to removal of quiesced state for the SI. From spec perspective, 
> it is fine. But this SI is now without standby assignment (without 
> redundancy) and any fault can lead to complete service outage.
> In this way rejection of operation is forcing the user to 
> reconfigure/modify saAmfSGMaxStandbySIsperSU.
>
> If multiple standby are present for an SI, then si-swap will not be 
> rejected as there are standbys to take the active role.
>
> Thanks
> Praveen
>>
>> /Thanks HansN
>>
>> On 10/13/2015 11:29 AM, praveen.malv...@oracle.com wrote:
>>> osaf/services/saf/amf/amfd/sg_nway_fsm.cc |  13 +
>>>   1 files changed, 13 insertions(+), 0 deletions(-)
>>>
>>> In the given configuration, swapped SI2 was fully assigned in the
>>> beginning
>>> but it had only one standby assignment. When SI-SWAP operation was
>>> performed
>>> on the SI, it caused removal of quiesced state after standby took the
>>> active
>>> role.
>>>
>>> In N-Way model a SI will have multiple standby assignments, so even if
>>> swap leads
>>> to removal of one standby there would be other standby SUs to take
>>> over the active role.
>>> So, I think, a general check for checking saAmfSGMaxStandbySIsperSU
>>> count for
>>> highest ranked SU is not needed and operation should be allowed if
>>> there are
>>> more than two standbys SUs exist for the SI and it will lead to
>>> removal of
>>> assignment after swap. A check can be added in a case where SI got
>>> reduced
>>> (by configuration or due to degraded state of the system) to 2N type
>>> of redundancy
>>> and operation will leave SI with only active state by removing the
>>> quiesced state.
>>>
>>> Patch rejects si-swap if there is only one standby assignment for SI 
>>> and
>>> si-swap will lead to removal of quiesced assignment becuase of
>>> saAmfSGMaxStandbySIsperSU constraint.
>>>
>>> diff --git a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
>>> b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
>>> --- a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
>>> +++ b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
>>> @@ -3589,6 +3589,19 @@ SaAisErrorT SG_NWAY::si_swap(AVD_SI *si,
>>>   rc = SA_AIS_ERR_BAD_OPERATION;
>>>   goto done;
>>>   }
>>> +/*
>>> +   Reject si-swap if there is only one standby assignment for 
>>> SI and
>>> +   si-swap will lead to removal of quiesced assignment becuase of
>>> +   saAmfSGMaxStandbySIsperSU constraint.
>>> + */
>>> +if ((si->curr_standby_assignments() == 1) &&
>>> +(si->sg_of_si->saAmfSGMaxStandbySIsperSU <
>>> +
>>> static_cast(actv_susi->su->hastate_assignments_count(SA_AMF_HA_STANDBY)+1)))
>>>  
>>>
>>> {
>>> +LOG_NO("%s SWAP not allowed as it will leave SI without
>>> standby assignment.",
>>> +si->name.value);
>>> +rc = SA_AIS_ERR_BAD_OPERATION;
>>> +goto done;
>>> +}
>>>   if ((avd_sg_nway_siswitch_func(avd_cb, si)) == 
>>> NCSCC_RC_FAILURE) {
>>>   rc = SA_AIS_ERR_BAD_OPERATION;
>>>   goto done;
>>



--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 2 of 2] amfd: add member function for accessing surestart [#1518]

2015-10-28 Thread Hans Nordebäck
ack, code review only. Minor comments inlined/Thanks HansN

On 10/21/2015 02:38 PM, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/comp.cc  |   8 +++-
>   osaf/services/saf/amf/amfd/include/su.h |   4 +++-
>   osaf/services/saf/amf/amfd/sgproc.cc|   6 ++
>   osaf/services/saf/amf/amfd/su.cc|  16 +++-
>   4 files changed, 19 insertions(+), 15 deletions(-)
>
>
> This patch adds member functions to access su->surestart.This was
> a minor comment on #315 (for amfd code) given by Hans N.
> It will be pushed only in default branch.
>
> diff --git a/osaf/services/saf/amf/amfd/comp.cc 
> b/osaf/services/saf/amf/amfd/comp.cc
> --- a/osaf/services/saf/amf/amfd/comp.cc
> +++ b/osaf/services/saf/amf/amfd/comp.cc
> @@ -188,7 +188,7 @@ void avd_comp_readiness_state_set(AVD_CO
>   comp->comp_info.name.value,
>   avd_readiness_state_name[comp->saAmfCompReadinessState], 
> avd_readiness_state_name[readiness_state]);
>   comp->saAmfCompReadinessState = readiness_state;
> - if (comp->su->surestart == false)
> + if (comp->su->get_surestart() == false)
>   avd_saImmOiRtObjectUpdate(>comp_info.name, 
> "saAmfCompReadinessState",
>   SA_IMM_ATTR_SAUINT32T, 
> >saAmfCompReadinessState);
>   m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, comp, 
> AVSV_CKPT_COMP_READINESS_STATE);
> @@ -820,10 +820,8 @@ static void comp_admin_op_cb(SaImmOiHand
>  Thus PI applications modeled on NWay and 
> Nway Active model
>  this is spec deviation.
>*/
> - if (comp->su->saAmfSUPreInstantiable == true) {
> - TRACE("surestart flag in '%s' is set to 
> true",comp->su->name.value);
> - comp->su->surestart = true;
> - }
> + if (comp->su->saAmfSUPreInstantiable == true)
> + comp->su->set_surestart(true);
>   
> comp->su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE);
>   comp->su->sg_of_su->su_fault(avd_cb, comp->su);
>   } else {
> diff --git a/osaf/services/saf/amf/amfd/include/su.h 
> b/osaf/services/saf/amf/amfd/include/su.h
> --- a/osaf/services/saf/amf/amfd/include/su.h
> +++ b/osaf/services/saf/amf/amfd/include/su.h
> @@ -87,7 +87,6 @@ class AVD_SU {
>   int su_act_state; // not used, kept for EDU, remove later
>   
>   AVD_SG *sg_of_su;   /* the service group of this SU */
> - bool surestart; /* used during surestart recovery and restart op on non 
> restartable comp*/
>   AVD_AVND *su_on_node;   /*  the node on which this SU resides */
>   struct avd_su_si_rel_tag *list_of_susi; /* the list of su si 
> relationship elements */
>   
> @@ -147,9 +146,12 @@ class AVD_SU {
>   bool all_pi_comps_nonrestartable();
>   SaAmfAdminOperationIdT get_admin_op_id();
>   bool all_comps_in_presence_state(SaAmfPresenceStateT pres);
> + void set_surestart(bool state);
[HansN] use const, bool get_surestart() const;
> + bool get_surestart();
>   
>private:
>   void initialize();
> + bool surestart; /* used during surestart recovery and restart op on non 
> restartable comp*/
>   void send_attribute_update(AVSV_AMF_SU_ATTR_ID attrib_id);
>   void set_saAmfSUPreInstantiable(bool value);
>   
> diff --git a/osaf/services/saf/amf/amfd/sgproc.cc 
> b/osaf/services/saf/amf/amfd/sgproc.cc
> --- a/osaf/services/saf/amf/amfd/sgproc.cc
> +++ b/osaf/services/saf/amf/amfd/sgproc.cc
> @@ -715,8 +715,7 @@ void avd_su_oper_state_evh(AVD_CL_CB *cb
>*/
>   if (n2d_msg->msg_info.n2d_opr_state.rec_rcvr.raw == 
> AVSV_ERR_RCVR_SU_RESTART) {
>   TRACE("surestart recovery request for '%s'", su->name.value);
> - su->surestart = true;
> - TRACE("surestart flag is set true");
> + su->set_surestart(true);
>   /*Readiness is temporarliy kept OOS so as to reuse sg_fsm.
> It will not be updated to IMM and thus not visible to user.
>*/
> @@ -941,8 +940,7 @@ void process_su_si_response_for_comp(AVD
>   there will be instantiation only when assignments 
> are given.
> */
>   comp_complete_admin_op(comp, SA_AIS_OK);
> - TRACE("surestart flag is set falsefor 
> '%s'",comp->su->name.value);
> - comp->su->surestart = false;
> + comp->su->set_surestart(false); 
>   comp->su->set_readiness_state(SA_AMF_READINESS_IN_SERVICE);
>   comp->su->sg_of_su->su_insvc(avd_cb, su);
>   TRACE_LEAVE();
> diff --git a/osaf/services/saf/amf/amfd/su.cc 
> b/osaf/services/saf/amf/amfd/su.cc
> --- 

Re: [devel] [PATCH 1 of 1] amfd: reject si-swap if SI will remain with only active state (NWAY)[#1516]

2015-10-28 Thread Hans Nordebäck
Hi Praveen,

trying to understand the problem below, if N-way and 
saAmfSGMaxStandbySIsperSU = 1,
and say there are 2 SUs and 2 SIs with the following assignments:
SU1   SU2
Active Standby  Standby Active
^^   ^   ^
|  || |
SI1  SI2   SI1 SI2

wouldn't si-swap of any si would lead to paritally assigned due to 
saAmfSGMaxStandbySIsperSU = 1?
If so amf is performing according to spec, and to correct this, 
saAmfSGMaxStandbySIsperSU has to be increased?

/Thanks HansN

On 10/13/2015 11:29 AM, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/sg_nway_fsm.cc |  13 +
>   1 files changed, 13 insertions(+), 0 deletions(-)
>   
>
> In the given configuration, swapped SI2 was fully assigned in the beginning
> but it had only one standby assignment. When SI-SWAP operation was performed
> on the SI, it caused removal of quiesced state after standby took the active
> role.
>
> In N-Way model a SI will have multiple standby assignments, so even if swap 
> leads
> to removal of one standby there would be other standby SUs to take over the 
> active role.
> So, I think, a general check for checking saAmfSGMaxStandbySIsperSU count for
> highest ranked SU is not needed and operation should be allowed if there are
> more than two standbys SUs exist for the SI and it will lead to removal of
> assignment after swap. A check can be added in a case where SI got reduced
> (by configuration or due to degraded state of the system) to 2N type of 
> redundancy
> and operation will leave SI with only active state by removing the quiesced 
> state.
>
> Patch rejects si-swap if there is only one standby assignment for SI and
> si-swap will lead to removal of quiesced assignment becuase of
> saAmfSGMaxStandbySIsperSU constraint.
>
> diff --git a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc 
> b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
> --- a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
> +++ b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
> @@ -3589,6 +3589,19 @@ SaAisErrorT SG_NWAY::si_swap(AVD_SI *si,
>   rc = SA_AIS_ERR_BAD_OPERATION;
>   goto done;
>   }
> + /*
> +Reject si-swap if there is only one standby assignment for SI and
> +si-swap will lead to removal of quiesced assignment becuase of
> +saAmfSGMaxStandbySIsperSU constraint.
> +  */
> + if ((si->curr_standby_assignments() == 1) &&
> + (si->sg_of_si->saAmfSGMaxStandbySIsperSU <
> +  
> static_cast(actv_susi->su->hastate_assignments_count(SA_AMF_HA_STANDBY)+1)))
>  {
> + LOG_NO("%s SWAP not allowed as it will leave SI without standby 
> assignment.",
> + si->name.value);
> + rc = SA_AIS_ERR_BAD_OPERATION;
> + goto done;
> + }
>   if ((avd_sg_nway_siswitch_func(avd_cb, si)) == NCSCC_RC_FAILURE) {
>   rc = SA_AIS_ERR_BAD_OPERATION;
>   goto done;


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: allow SA_AIS_ERR_BAD_OPERATION to be returned to caller of nodegroup op [#1559]

2015-10-27 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: Gary Lee [mailto:gary@dektech.com.au] 
Sent: den 23 oktober 2015 07:18
To: Hans Nordebäck; nagendr...@oracle.com; praveen.malv...@oracle.com; Minh 
Chau H; Gary Lee
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: allow SA_AIS_ERR_BAD_OPERATION to be returned to 
caller of nodegroup op [#1559]

 osaf/services/saf/amf/amfd/nodegroup.cc |  10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Assume an SU is in SA_AMF_PRESENCE_INSTANTIATION_FAILED or 
SA_AMF_PRESENCE_TERMINATION_FAILED state.
If an admin operation is issued on a nodegroup hosting this SU, currently 
TRY_AGAIN is returned to the caller. This may result in unnecessary retries. It 
would be more appropriate to proprogate SA_AIS_ERR_BAD_OPERATION from 
AVD_SU::check_su_stability() to the caller.

diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -960,7 +960,7 @@
rc = check_ng_stability(ng);
if (rc != SA_AIS_OK) {
report_admin_op_error(avd_cb->immOiHandle, invocation,
- SA_AIS_ERR_TRY_AGAIN, NULL,
+ rc, NULL,
  "Some entity is unstable, 
Operation cannot "
  "be performed on '%s'"
  "Check syslog for entity 
details", ng_name->value); @@ -1030,7 +1030,7 @@
rc = check_ng_stability(ng);
if (rc != SA_AIS_OK) {
report_admin_op_error(avd_cb->immOiHandle, invocation,
- SA_AIS_ERR_TRY_AGAIN, NULL,
+ rc, NULL,
  "Some entity is unstable, 
Operation cannot "
  "be performed on '%s'"
  "Check syslog for entity 
details", ng_name->value); @@ -1080,7 +1080,7 @@
rc = check_ng_stability(ng);
if (rc != SA_AIS_OK) {
report_admin_op_error(avd_cb->immOiHandle, invocation, 
-   SA_AIS_ERR_TRY_AGAIN, NULL,
+   rc, NULL,
"Some entity is unstable, Operation 
cannot "
"be performed on '%s'"
"Check syslog for entity details", 
ng_name->value); @@ -1133,7 +1133,7 @@
rc = check_ng_stability(ng);
if (rc != SA_AIS_OK) {
report_admin_op_error(avd_cb->immOiHandle, invocation, 
-   SA_AIS_ERR_TRY_AGAIN, NULL,
+   rc, NULL,
"Some entity is unstable, Operation 
cannot "
"be performed on '%s'"
"Check syslog for entity details", 
ng_name->value); @@ -1197,7 +1197,7 @@
rc = check_ng_stability(ng);
if (rc != SA_AIS_OK) {
report_admin_op_error(avd_cb->immOiHandle, invocation,
-   SA_AIS_ERR_TRY_AGAIN, NULL,
+   rc, NULL,
"Some entity is unstable, Operation 
cannot "
"be performed on '%s'"
"Check syslog for entity details", 
ng_name->value);

--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 00 of 30] Review Request for amfnd: convert NULL to nullptr [#1551]

2015-10-27 Thread Hans Nordebäck
Ack for the series, code review only/Thanks HansN

-Original Message-
From: Long HB Nguyen [mailto:long.hb.ngu...@dektech.com.au] 
Sent: den 20 oktober 2015 11:58
To: Hans Nordebäck; Gary Lee; praveen.malv...@oracle.com; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 00 of 30] Review Request for amfnd: convert NULL to nullptr 
[#1551]

Summary: amfnd: convert NULL to nullptr [#1551] Review request for Trac 
Ticket(s): [#1551] Peer Reviewer(s): Hans, Gary, Praveen, Nagu Pull request to: 
Hans Affected branch(es): default Development branch: default


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


Comments (indicate scope for each "y" above):
-

changeset d9e5204b9cd64449385835be326c4635993233ca
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:08:29 +0700

amfnd: convert NULL to nullptr for amfnd.cc [#1551]

changeset 4aa0c0e69ea683b655e5ce95a48bd46668bb1947
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:13:52 +0700

amfnd: convert NULL to nullptr for cbq.cc [#1551]

changeset 8565a4b0f13090e2a248d4dc030107fe872c46e3
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:16:24 +0700

amfnd: convert NULL to nullptr for chc.cc [#1551]

changeset 61e799adaa100457d5da11741daab89abb312342
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:20:01 +0700

amfnd: convert NULL to nullptr for ckpt_dec.cc [#1551]

changeset 6146e7b22e233213be199892f03f8f2b87e7733a
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:22:03 +0700

amfnd: convert NULL to nullptr for ckpt_edu.cc [#1551]

changeset 3010ccff64a8b80f0b0ba2abeee3c3f569c06a36
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:23:20 +0700

amfnd: convert NULL to nullptr for ckpt_enc.cc [#1551]

changeset 19fff7f26c302b0a252c537979c5be117a96b8ab
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:24:52 +0700

amfnd: convert NULL to nullptr for ckpt_updt.cc [#1551]

changeset 58263076e522c0494bd91480001a68369818b0c9
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:26:02 +0700

amfnd: convert NULL to nullptr for clc.cc [#1551]

changeset ec0d86a8fcac950de12157c90406e1c60a688cc0
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:27:11 +0700

amfnd: convert NULL to nullptr for clm.cc [#1551]

changeset 6f24ab6b30da4a901bff37e3c65f628e478505d9
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:28:06 +0700

amfnd: convert NULL to nullptr for comp.cc [#1551]

changeset 114de32db084f1987a80fa450509619455702054
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:29:43 +0700

amfnd: convert NULL to nullptr for compdb.cc [#1551]

changeset 1351acca1f39d71e0d084a7bdb156d8168b73b16
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:42:44 +0700

amfnd: convert NULL to nullptr for cpm.cc [#1551]

changeset e850274601d9d382839c2538381c98b8151f08a2
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:43:26 +0700

amfnd: convert NULL to nullptr for di.cc [#1551]

changeset 6f75b3025f9d26fee62aa3e1e92750e86a9e596c
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:45:17 +0700

amfnd: convert NULL to nullptr for err.cc [#1551]

changeset 92a13233ca950df369ca41ab9d5241c815fe3bc3
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:46:49 +0700

amfnd: convert NULL to nullptr for evt.cc [#1551]

changeset 913ca62cb17743d241dda8672bcfc22773c3aae3
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:47:43 +0700

amfnd: convert NULL to nullptr for hcdb.cc [#1551]

changeset d18406ea8012bd153f83550b3a1c893996fe2d54
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:48:39 +0700

amfnd: convert NULL to nullptr for main.cc [#1551]

changeset 228c017ee533cc9a3d8aae0badc7a748b7f42584
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Tue, 20 Oct 2015 14:50:13 +0700

amfnd: convert NULL to nullptr for mbcsv.cc [#1551]

changeset d6d3d5b4aa2a9c4ac41d9cfb6953ac2c6428200e
Author: Long HB Nguyen<

Re: [devel] [PATCH 00 of 48] Review Request for amfd: convert NULL to nullptr V2 [#1547]

2015-10-27 Thread Hans Nordebäck
Ack for the series, code review only/Thanks HansN

-Original Message-
From: Long Buu Nguyen H 
Sent: den 19 oktober 2015 13:18
To: Hans Nordebäck; Gary Lee; praveen.malv...@oracle.com; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 00 of 48] Review Request for amfd: convert NULL to nullptr V2 
[#1547]

Summary: amfd: convert NULL to nullptr V2 [#1547] Review request for Trac 
Ticket(s): [#1547] Peer Reviewer(s): Hans, Gary, Praveen, Nagu Pull request to: 
Hans Affected branch(es): default Development branch: default


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


Comments (indicate scope for each "y" above):
-
In this Version 2: 

changeset c5187539b22b3ece04e72f68c1e5430d06d088d2
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for app.cc [#1547]

changeset 046710d2e6e739b67c317d01350c6a5566fda3fa
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for apptype.cc [#1547]

changeset 58e81ef6a0e7af8edb4dbced7325180d11d8d291
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for chkop.cc [#1547]

changeset 555a485e21501fbfce91cc15d0ebd6833aed93d2
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for ckpt_dec.cc [#1547]

changeset 1e8ebe3388af55e1d64c3ab56193f30965d1faa1
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for ckpt_edu.cc [#1547]

changeset db7407ddfe2234a3e0e287ebb9ee0d7a8f9d17aa
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for ckpt_enc.cc [#1547]

changeset c41b2a3d0081450ceddae17aadb2632046d35d74
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for ckpt_updt.cc [#1547]

changeset fa79edb33b37c99282c7fb2f94a4f96224f558fa
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for clm.cc [#1547]

changeset dcc4bb199d8af85845a7e3b64863c856c869d617
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for cluster.cc [#1547]

changeset beb1263225472b3c0910a7a2c1530cd82fb5146e
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for comp.cc [#1547]

changeset 3e80fd0be4fe99f86d4164a16e85ee2e813dd011
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for compcstype.cc [#1547]

changeset 825d548b07e2f475206087e4894f3614a2ae7ce7
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for comptype.cc [#1547]

changeset 50ab0756779cd98485e888ecbeb7afad622b5f00
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for csi.cc [#1547]

changeset 1dc8d75ec1908ff1ca3a425940dfa74022c6be86
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for csiattr.cc [#1547]

changeset 5d7b22e83a1dc2bbb6d6ab635aff96d1d6e92b2a
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for cstype.cc [#1547]

changeset 6851f9b8b07b46ab5a5921baca0f95810956645c
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for ctcstype.cc [#1547]

changeset 6cc6ad0b98a3c5d6fa75636ffcb866284f53c214
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for dmsg.cc [#1547]

changeset 6a0ad0242288a50b6436cc277a96bf097959245d
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Mon, 19 Oct 2015 15:37:29 +0700

amfd: convert NULL to nullptr for hlt.cc [#1547]

changeset 16756ef5d2059e96ed3900bc7d91e20b592b65ed
Author: Long HB Nguyen<lon

Re: [devel] [PATCH 0 of 1] Review Request for amfd: convert NULL to nullptr [#1547]

2015-10-27 Thread Hans Nordebäck
Ack for the series, code review only/Thanks HansN

-Original Message-
From: Long HB Nguyen [mailto:long.hb.ngu...@dektech.com.au] 
Sent: den 16 oktober 2015 04:38
To: Hans Nordebäck; Gary Lee; Quyen Dao Q; Minh Chau H; 
praveen.malv...@oracle.com; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 0 of 1] Review Request for amfd: convert NULL to nullptr [#1547]

Summary: amfd: convert NULL to nullptr
Review request for Trac Ticket(s): #1547 Peer Reviewer(s): Hans, Gary, Minh, 
Quyen, Nagu, Praveen Pull request to: Hans Affected branch(es): default 
Development branch: default


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


Comments (indicate scope for each "y" above):
-

changeset 5bb7f07db5484091aad45c941decc33cf56f8c84
Author: Long HB Nguyen<long.hb.ngu...@dektech.com.au>
Date:   Thu, 15 Oct 2015 19:06:38 +0700

amfd: convert NULL to nullptr [#1547]


Complete diffstat:
--
 osaf/services/saf/amf/amfd/app.cc|   84 
+++---
 osaf/services/saf/amf/amfd/apptype.cc|   52 
+-
 osaf/services/saf/amf/amfd/chkop.cc  |   16 +-
 osaf/services/saf/amf/amfd/ckpt_dec.cc   |   84 
+++---
 osaf/services/saf/amf/amfd/ckpt_edu.cc   |  182 

 osaf/services/saf/amf/amfd/ckpt_enc.cc   |   14 
 osaf/services/saf/amf/amfd/ckpt_updt.cc  |   74 

 osaf/services/saf/amf/amfd/clm.cc|   20 ++--
 osaf/services/saf/amf/amfd/cluster.cc|   14 
 osaf/services/saf/amf/amfd/comp.cc   |  118 
+++---
 osaf/services/saf/amf/amfd/compcstype.cc |   44 
++--
 osaf/services/saf/amf/amfd/comptype.cc   |   92 
++--
 osaf/services/saf/amf/amfd/csi.cc|  180 
+++---
 osaf/services/saf/amf/amfd/csiattr.cc|   62 

 osaf/services/saf/amf/amfd/cstype.cc |   42 +-
 osaf/services/saf/amf/amfd/ctcstype.cc   |   28 +-
 osaf/services/saf/amf/amfd/dmsg.cc   |4 +-
 osaf/services/saf/amf/amfd/hlt.cc|8 ++--
 osaf/services/saf/amf/amfd/hlttype.cc|8 ++--
 osaf/services/saf/amf/amfd/imm.cc|  110 

 osaf/services/saf/amf/amfd/main.cc   |   30 +-
 osaf/services/saf/amf/amfd/ndfsm.cc  |   36 +++---
 osaf/services/saf/amf/amfd/ndmsg.cc  |   12 +++---
 osaf/services/saf/amf/amfd/ndproc.cc |   62 

 osaf/services/saf/amf/amfd/node.cc   |   94 
+++---
 osaf/services/saf/amf/amfd/nodegroup.cc  |   88 
+-
 osaf/services/saf/amf/amfd/nodeswbundle.cc   |4 +-
 osaf/services/saf/amf/amfd/ntf.cc|   18 +-
 osaf/services/saf/amf/amfd/pg.cc |6 +-
 osaf/services/saf/amf/amfd/role.cc   |   36 +++---
 osaf/services/saf/amf/amfd/sg.cc |  162 
+-
 osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |  248 
++--
 osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   46 
+++---
 osaf/services/saf/amf/amfd/sg_npm_fsm.cc |  272 
++--
 osaf/services/saf/amf/amfd/sg_nway_fsm.cc|  188 
++--
 osaf/services/saf/amf/amfd/sg_nwaya

Re: [devel] [PATCH 1 of 2] amfd: fix SU presence state transition during restart admin op [#1518]

2015-10-27 Thread Hans Nordebäck
Hi Praveen,

One correction related to the condition below:

/**
  * @brief  Checks if all comps of SU are in a given presence state.
  * @return true/false
  */
bool AVD_SU::all_comps_in_presence_state(SaAmfPresenceStateT pres) {
   if (std::all_of(list_of_comp.begin(), list_of_comp.end(), [&](AVD_COMP 
*comp) -> bool {return comp->saAmfCompPresenceState ==
pres;})) {
 return true;
   } else {
 return false;
   }
}

/Thanks HansN

-Original Message-----
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] 
Sent: den 27 oktober 2015 15:28
To: praveen.malv...@oracle.com; nagendr...@oracle.com; Quyen Quoc Dao
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [devel] [PATCH 1 of 2] amfd: fix SU presence state transition 
during restart admin op [#1518]

ack, code review only. Some comments below. /Thanks HansN

On 10/21/2015 02:38 PM, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/comp.cc|   10 +
>   osaf/services/saf/amf/amfd/include/comp.h |1 +
>   osaf/services/saf/amf/amfd/include/su.h   |4 +-
>   osaf/services/saf/amf/amfd/ndproc.cc  |   24 ++-
>   osaf/services/saf/amf/amfd/su.cc  |   18 ++
>   osaf/services/saf/amf/amfnd/clc.cc|5 +-
>   osaf/services/saf/amf/amfnd/include/avnd_su.h |2 +
>   osaf/services/saf/amf/amfnd/su.cc |   11 +
>   osaf/services/saf/amf/amfnd/susm.cc   |  165 
> +++--
>   9 files changed, 186 insertions(+), 54 deletions(-)
>
>
> Note:Issue is valid for a restartable SU only.
>
> When RESTART operation is invoked on a restartable SU, its presence state 
> transtions:
> INSTANTIATED => RESTARTING => INSTANTIATING => INSTANTIATED.
> which is incorrect as per  AIS-AMF-B.04.01-Table 5 Page 74.
>
> At present, when all the components are in RESTARTING state, SU is marked as 
> RESTARTING.
> As soon as AMF starts instantiating first comp by keeping it in 
> RESTARTING state, AMF is marking SU INSTANTIATING. Here AMF must wait 
> for the instantiation of component and should not mark SU 
> INSTANTIATING. When first comp gets successfully instantiated, AMF 
> imust mark first comp INSTANTIATED and SU will also be marked INSTANTIATED as 
> per AIS-AMF-B.04.01-Table 5 Page 74.
>
> Patch fixes the problem by marking the SU INSTANTIATED as soons as 
> first component enters into INSTANTIATED state. During the 
> instantiation of other components, SU will remain in INSTANTIATED 
> state. AMF will reply to IMM for the operation when all the components enters 
> into INSTATANTIATED state.
>
> diff --git a/osaf/services/saf/amf/amfd/comp.cc 
> b/osaf/services/saf/amf/amfd/comp.cc
> --- a/osaf/services/saf/amf/amfd/comp.cc
> +++ b/osaf/services/saf/amf/amfd/comp.cc
> @@ -1711,3 +1711,13 @@ SaAisErrorT check_comp_stability(const A
>   }
>   return SA_AIS_OK;
>   }
> +/**
> + * @brief  CHeck if component is SA_AWARE.
> + * @Return true/false.
> + */
> +bool AVD_COMP::saaware()
> +{
> +AVD_COMP_TYPE *comptype = 
> comptype_db->find(Amf::to_string());
> +return (IS_COMP_SAAWARE(comptype->saAmfCtCompCategory));
> +}
> +
> diff --git a/osaf/services/saf/amf/amfd/include/comp.h 
> b/osaf/services/saf/amf/amfd/include/comp.h
> --- a/osaf/services/saf/amf/amfd/include/comp.h
> +++ b/osaf/services/saf/amf/amfd/include/comp.h
> @@ -125,6 +125,7 @@ class AVD_COMP {
>   
> void set_assigned(bool assigned) {assign_flag = assigned;}
> bool assigned() const {return assign_flag;}
[HansN] use bool saaware() const;
> +  bool saaware();
>private:
> void initialize();
> // disallow copy and assign
> diff --git a/osaf/services/saf/amf/amfd/include/su.h 
> b/osaf/services/saf/amf/amfd/include/su.h
> --- a/osaf/services/saf/amf/amfd/include/su.h
> +++ b/osaf/services/saf/amf/amfd/include/su.h
> @@ -145,7 +145,9 @@ class AVD_SU {
>   bool is_any_non_restartable_comp_assigned();
>   bool all_pi_comps_restartable();
>   bool all_pi_comps_nonrestartable();
> - 
[HansN] use

SaAmfAdminOperationIdT get_admin_op_id() const;

> + SaAmfAdminOperationIdT get_admin_op_id();
[HansN] use

bool all_comps_in_presence_state(SaAmfPresenceStateT pres) const;

> + bool all_comps_in_presence_state(SaAmfPresenceStateT pres);
> +
>private:
>   void initialize();
>   void send_attribute_update(AVSV_AMF_SU_ATTR_ID attrib_id); diff 
> --git a/osaf/services/saf/amf/amfd/ndproc.cc 
> b/osaf/services/saf/amf/amfd/ndproc.cc
> --- a/osaf/services/saf/amf/amfd/ndproc.cc
> +++ b/osaf/services/saf/amf/amfd/ndproc.cc
> @@ -369,20 +369,18 @@ static void surestart_admin_op_report_to
>   if ((su->saAmfSUPresenceState 

Re: [devel] [PATCH 1 of 1] amfd: mark NG locked if controller failovers during shutdown op on NG [#1513]

2015-10-09 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 10/05/2015 12:47 PM, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/sgproc.cc |  21 +
>   1 files changed, 21 insertions(+), 0 deletions(-)
>
>
> NG gets stuck in SHUTTING_DOWN state during shutdown op and controller 
> failover.
>
> During SHUTDOWN admin operation on NG, initial admin state is set to 
> SHUTTING_DOWN and
> it is checkpointed to standby AMFD. On decoding it, standby AMFD sets 
> node->admin_ng
> and it clears it when active AMFD checkpoints the LOCKED state. Now after 
> fail-over when
> AMFD gets quiescing success response from AMFND it clears this pointer in
> process_su_si_response_for_ng() assuming there is only one SU hosted on that 
> node.
> After this when response for second SU comes, this response is not processed 
> from NG
> perspective as AMFD has already cleared node->admin_ng. Issue does not occur 
> when node hosts
> only one application SU.
>
> Patch fixes the problem by avoiding clearing of node->admin_ng when NG is in 
> SHUTTING_DOWN state.
>
> diff --git a/osaf/services/saf/amf/amfd/sgproc.cc 
> b/osaf/services/saf/amf/amfd/sgproc.cc
> --- a/osaf/services/saf/amf/amfd/sgproc.cc
> +++ b/osaf/services/saf/amf/amfd/sgproc.cc
> @@ -400,6 +400,27 @@ void process_su_si_response_for_ng(AVD_S
>   ng->node_oper_list.erase(Amf::to_string(>name));
>   TRACE("node_oper_list size:%u",ng->oper_list_size());
>   }
> +
> + /*Handling for the case: There are pending assignments on more than one 
> SUs
> +   on same node of nodegroup with atleast one quiescing assignment and 
> controller
> +   failover occured.
> +   Below if block will be hit only when assignments for quiescing state 
> are still pending
> +   on atleast one SU and on atleast one node of NG.
> + */
> + if ((ng->saAmfNGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) &&
> + (ng->admin_ng_pend_cbk.admin_oper == 0) &&
> + (ng->admin_ng_pend_cbk.invocation == 0)) {
> + /*During SHUTDOWN admin operation on NG, initial admin state is 
> set to SHUTTING_DOWN
> +   and it is checkpointed to standby AMFD. On decoding it, 
> standby AMFD sets
> +   node->admin_ng and it clears it when active AMFD checkpoints 
> the LOCKED state.
> +   In case active AMFD sends quiescing state and reboots after 
> checkpointing only
> +   SHUTTING_DOWN state, standby AMFD will be able to mark NG 
> LOCKED by processing
> +   response of assignments as it has set node->admin_ng. So this 
> pointer should be
> +   cleared only when NG is marked LOCKED. And in that case we 
> will not be in this if block.
> +  */
> + TRACE_1("'%s' in shutting_down state after 
> failover.",ng->name.value);
> + goto done;
> + }
>   /*If assignment changes are done on all the SUs on each node of 
> nodegroup
> then reply to IMM for status of admin operation.*/
>   if (ng->node_oper_list.empty())


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 3] amf: fix spec deviation of surestart escalation [#315]

2015-10-01 Thread Hans Nordebäck
ack, code review only. Minor comments inlined.

/Thanks HansN

On 09/10/2015 04:03 PM, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/comp.cc |5 +-
>   osaf/services/saf/amf/amfd/include/su.h|1 +
>   osaf/services/saf/amf/amfd/sgproc.cc   |   18 +
>   osaf/services/saf/amf/amfd/su.cc   |   10 +-
>   osaf/services/saf/amf/amfnd/clc.cc |  223 +-
>   osaf/services/saf/amf/amfnd/comp.cc|   58 +-
>   osaf/services/saf/amf/amfnd/compdb.cc  |1 +
>   osaf/services/saf/amf/amfnd/err.cc |  148 +++-
>   osaf/services/saf/amf/amfnd/include/avnd_err.h |1 +
>   osaf/services/saf/amf/amfnd/include/avnd_su.h  |8 +-
>   osaf/services/saf/amf/amfnd/su.cc  |   58 +-
>   osaf/services/saf/amf/amfnd/susm.cc|  915 
> 
>   12 files changed, 1192 insertions(+), 254 deletions(-)
>
>
> During surestart recovery, currently AMF is not spec compliant in two
> ways:
> 1)Individual component is terminated/cleaned up and then instantiated.
>Iinstead all componenets should be abruplty terminated and then 
> instantiated
>honoring the instantiation level.
> 2)During termination/cleanup of individual component, saAmfDisableRestart 
> flag is
>not honoured.
> Ticket is updated with relevent spec sections for reference.
>
> Patch solves the problem by cleaning up the component in the reverse order of
> instantiation level and instantiation of compoment in the forward order. Also
> before terminating a non-restartable component (saAmfDisableRestart=true),
> assignments are switchover to another SU.
>
> This patch contains the common code to be used by #334 and #1455.
>
> diff --git a/osaf/services/saf/amf/amfd/comp.cc 
> b/osaf/services/saf/amf/amfd/comp.cc
> --- a/osaf/services/saf/amf/amfd/comp.cc
> +++ b/osaf/services/saf/amf/amfd/comp.cc
> @@ -189,8 +189,9 @@ void avd_comp_readiness_state_set(AVD_CO
>   comp->comp_info.name.value,
>   avd_readiness_state_name[comp->saAmfCompReadinessState], 
> avd_readiness_state_name[readiness_state]);
>   comp->saAmfCompReadinessState = readiness_state;
> - avd_saImmOiRtObjectUpdate(>comp_info.name, 
> "saAmfCompReadinessState",
> - SA_IMM_ATTR_SAUINT32T, >saAmfCompReadinessState);
> + if (comp->su->surestart == false)
> + avd_saImmOiRtObjectUpdate(>comp_info.name, 
> "saAmfCompReadinessState",
> + SA_IMM_ATTR_SAUINT32T, 
> >saAmfCompReadinessState);
>   m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, comp, 
> AVSV_CKPT_COMP_READINESS_STATE);
>   TRACE_LEAVE();
>   }
> diff --git a/osaf/services/saf/amf/amfd/include/su.h 
> b/osaf/services/saf/amf/amfd/include/su.h
> --- a/osaf/services/saf/amf/amfd/include/su.h
> +++ b/osaf/services/saf/amf/amfd/include/su.h
> @@ -87,6 +87,7 @@ class AVD_SU {
>   int su_act_state; // not used, kept for EDU, remove later
>   
>   AVD_SG *sg_of_su;   /* the service group of this SU */
> + bool surestart; /* used during surestart recovery and restart op on non 
> restartable comp*/
[HansN] surestart can be private, and functions to set, void 
set_surestart(bool restart) and to check bool surestart() void.
>   AVD_AVND *su_on_node;   /*  the node on which this SU resides */
>   struct avd_su_si_rel_tag *list_of_susi; /* the list of su si 
> relationship elements */
>   
> diff --git a/osaf/services/saf/amf/amfd/sgproc.cc 
> b/osaf/services/saf/amf/amfd/sgproc.cc
> --- a/osaf/services/saf/amf/amfd/sgproc.cc
> +++ b/osaf/services/saf/amf/amfd/sgproc.cc
> @@ -689,6 +689,24 @@ void avd_su_oper_state_evh(AVD_CL_CB *cb
>   cluster_startup_expiry_event_generate(cb);
>   }
>   
> + /* Atleast one non-restartable healthy comp is assigned and recovery got
> +escalated to surestart. Before cleaning up any healthy 
> non-restartable comp,
> +gracefully reassigned their assignments to comp in other SU. At 
> present
> +assignment of whole SU will be gracefully reassigned instead of only 
> this comp.
> +Thus PI applications modeled on  NWay and Nway Active modelthis is 
> spec deviation.
> +  */
> + if (n2d_msg->msg_info.n2d_opr_state.rec_rcvr.raw == 
> AVSV_ERR_RCVR_SU_RESTART) {
> + TRACE("surestart recovery request for '%s'", su->name.value);
> + su->surestart = true;
> + TRACE("surestart flag is set true");
> + /*Readiness is temporarliy kept OOS so as to reuse sg_fsm.
> +   It will not be updated to IMM and thus not visible to user.
> +  */
> + su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE);
> + /*Initiate graceful removal of assignment from this su.*/
> + su->sg_of_su->su_fault(cb, su);
> + goto done;
> + }
>   /* Verify that the SU operation state is disable and do the processing. 
> */
>

Re: [devel] [PATCH 07 of 12] amfd: convert list_of_su to std::vector [#1142]

2015-09-18 Thread Hans Nordebäck
Hi Gary,

ack, one question, please see inline.

  /Thanks HansN

  /Thanks Hans

On 09/17/2015 07:22 AM, Gary Lee wrote:
>   osaf/services/saf/amf/amfd/sg.cc |  179 
> +++---
>   1 files changed, 90 insertions(+), 89 deletions(-)
>
>
> diff --git a/osaf/services/saf/amf/amfd/sg.cc 
> b/osaf/services/saf/amf/amfd/sg.cc
> --- a/osaf/services/saf/amf/amfd/sg.cc
> +++ b/osaf/services/saf/amf/amfd/sg.cc
> @@ -117,7 +117,6 @@
>   sg_fsm_state(AVD_SG_FSM_STABLE),
>   admin_si(NULL),
>   sg_redundancy_model(SA_AMF_NO_REDUNDANCY_MODEL),
> - list_of_su(NULL),
>   list_of_si(NULL),
>   sg_type(NULL),
>   sg_list_app_next(NULL),
> @@ -164,7 +163,7 @@
>   void avd_sg_delete(AVD_SG *sg)
>   {
>   /* by now SU and SI should have been deleted */
> - osafassert(sg->list_of_su == NULL);
> + osafassert(sg->list_of_su.empty() == true);
>   osafassert(sg->list_of_si == NULL);
>   sg_remove_from_model(sg);
>   delete sg;
> @@ -757,7 +756,6 @@
>*/
>   static void sg_nd_attribute_update(AVD_SG *sg, uint32_t attrib_id)
>   {
> - AVD_SU *su = NULL;
>   AVD_AVND *su_node_ptr = NULL;
>   AVSV_PARAM_INFO param;
>   memset(((uint8_t *)), '\0', sizeof(AVSV_PARAM_INFO));
> @@ -809,8 +807,7 @@
>   }
>   
>   /* This value has to be updated on each SU on this SG */
> - su = sg->list_of_su;
> - while (su) {
> + for (const auto& su : sg->list_of_su) {
>   su_node_ptr = su->get_node_ptr();
>   
>   if ((su_node_ptr) && (su_node_ptr->node_state == 
> AVD_AVND_STATE_PRESENT)) {
> @@ -820,7 +817,6 @@
>   LOG_ER("%s::failed for %s",__FUNCTION__, 
> su_node_ptr->name.value);
>   }
>   }
> - su = su->sg_list_su_next;
>   }
>   TRACE_LEAVE();
>   }
> @@ -1103,29 +1099,36 @@
>   
>   /**
>* Terminate SU in reverse order
> - * @param su
>* @return NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.
>*/
> -static uint32_t avd_sg_su_term_in_reverse(AVD_SU *su)
> +uint32_t AVD_SG::term_su_list_in_reverse()
>   {
> -  uint32_t rc = NCSCC_RC_SUCCESS;
> -  TRACE_ENTER2("su:'%s'", su ? su->name.value : NULL);
> -  if (su->sg_list_su_next != NULL)
> - rc = avd_sg_su_term_in_reverse(su->sg_list_su_next);
> -  if ((su->saAmfSUPreInstantiable == true) &&
> -   (su->saAmfSUPresenceState != SA_AMF_PRESENCE_UNINSTANTIATED) 
> &&
> -   (su->saAmfSUPresenceState != 
> SA_AMF_PRESENCE_INSTANTIATION_FAILED) &&
> -   (su->saAmfSUPresenceState != 
> SA_AMF_PRESENCE_TERMINATION_FAILED)) {
> + uint32_t rc = NCSCC_RC_SUCCESS;
> + std::vector::const_reverse_iterator iter;
> + AVD_SU *su;
>   
> -   if (avd_snd_presence_msg(avd_cb, su, true) == NCSCC_RC_SUCCESS) {
> -   su->set_term_state(true);
> -   } else {
> -   rc = NCSCC_RC_FAILURE;
> -   LOG_WA("Failed Termination '%s'", su->name.value);
> -   }
> -  }
> -  TRACE_LEAVE();
> -  return rc ;
> + TRACE_ENTER2("sg: %s", this->name.value);
> + for (iter = list_of_su.rbegin(); iter != list_of_su.rend(); ++iter) {

[HansN] Is there a reason not to use, for (auto iter = .. and skip 
const_reverse_iter declaration above?

> + su = *iter;
> + TRACE("terminate su:'%s'", su ? su->name.value : NULL);
> +
> + if ((su->saAmfSUPreInstantiable == true) &&
> + (su->saAmfSUPresenceState != 
> SA_AMF_PRESENCE_UNINSTANTIATED) &&
> + (su->saAmfSUPresenceState != 
> SA_AMF_PRESENCE_INSTANTIATION_FAILED) &&
> + (su->saAmfSUPresenceState != 
> SA_AMF_PRESENCE_TERMINATION_FAILED)) {
> +
> + if (avd_snd_presence_msg(avd_cb, su, true) == 
> NCSCC_RC_SUCCESS) {
> + su->set_term_state(true);
> + } else {
> + rc = NCSCC_RC_FAILURE;
> + LOG_WA("Failed Termination '%s'", 
> su->name.value);
> + }
> + }
> + }
> +
> + TRACE_LEAVE();
> +
> + return rc ;
>   }
>   /**
>* perform lock-instantiation on a given SG
> @@ -1139,8 +1142,8 @@
>   TRACE_ENTER2("%s", sg->name.value);
>   
>   /* terminate all the SUs on this Node */
> - if (sg->list_of_su != NULL)
> - rc = avd_sg_su_term_in_reverse(sg->list_of_su);
> + if (sg->list_of_su.empty() == false)
> + rc = sg->term_su_list_in_reverse();
>   
>   TRACE_LEAVE2("%u", rc);
>   return rc;
> @@ -1154,13 +1157,14 @@
>*/
>   static void sg_app_sg_admin_unlock_inst(AVD_CL_CB *cb, AVD_SG *sg)
>   {
> - AVD_SU *su;
>   uint32_t su_try_inst;
>   
>   TRACE_ENTER2("%s", sg->name.value);
>   
>   /* Instantiate the SUs in this SG */
> - for (su = sg->list_of_su, su_try_inst = 0; su != NULL; su = 
> 

Re: [devel] [PATCH 1 of 1] amfd: support si-swap admin op for Nway model [#78]

2015-09-17 Thread Hans Nordebäck
ack, code review and tested with AmfDemo configured n-way with 3 SU's 1 
SI,  saAmfSIPrefStandbyAssignments=2,
(SaAmfSIRankedSU configured).

before si-swap:

safSi=AmfDemo1A,safApp=AmfDemo2 ACTIVE on SC-1
safSi=AmfDemo1A,safApp=AmfDemo2 STANDBY on SC-2
safSi=AmfDemo1A,safApp=AmfDemo2 STANDBY on PL-3


# amf-adm si-swap safSi=AmfDemo1A,safApp=AmfDemo2

safSi=AmfDemo1A,safApp=AmfDemo2 STANDBY on SC-1
safSi=AmfDemo1A,safApp=AmfDemo2 ACTIVE on SC-2
safSi=AmfDemo1A,safApp=AmfDemo2 STANDBY on PL-3

looks good.

/Thanks HansN

On 09/16/2015 12:50 PM, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/include/sg.h   |1 +
>   osaf/services/saf/amf/amfd/include/su.h   |2 +
>   osaf/services/saf/amf/amfd/sg.cc  |2 +
>   osaf/services/saf/amf/amfd/sg_nway_fsm.cc |  101 
> -
>   osaf/services/saf/amf/amfd/si.cc  |2 +-
>   osaf/services/saf/amf/amfd/su.cc  |   32 +
>   6 files changed, 135 insertions(+), 5 deletions(-)
>
>
> Currently si-swap is allowed on a SI that is protected by a 2N SG.
> As per spec, operation is valid for NWAY and NPM model also.
> This patch supports si-swap admin op for Nway model with following 
> restrictions:
> 1)Operation will be rejected if Equal distribution feature is enabled.
> 2)operation will be rejected if SIRankedSU is configured and AutoAdjust flag 
> is
> enabled. However it will be allowed if AutoAdjust is disabled.
>
> Reason for rejecting the operation in above two cases:
> In both of these cases AutoAdjust flag is eanbled and is used to partially
> adjust the SG. At the same time, autoadjust feature is used without
> using autoadjustprob timer. In the equal distribution cases both active
> assignments and standby assignments are equally distributed among the
> available SUs without waiting for any autoadjustprob timer expiry.
> Thus if si-swap is supported in this case, SG will be adjusted to
> same configuration.
> Same explanation is valid for other case also.
>
> diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
> b/osaf/services/saf/amf/amfd/include/sg.h
> --- a/osaf/services/saf/amf/amfd/include/sg.h
> +++ b/osaf/services/saf/amf/amfd/include/sg.h
> @@ -546,6 +546,7 @@ public:
>   uint32_t susi_failed(AVD_CL_CB *cb, AVD_SU *su,
>   struct avd_su_si_rel_tag *susi, AVSV_SUSI_ACT act, 
> SaAmfHAStateT state);
>   void node_fail_si_oper(AVD_SU *su);
> + SaAisErrorT si_swap(AVD_SI *si, SaInvocationT invocation);
>   
>   private:
>   uint32_t susi_success_su_oper(AVD_CL_CB *cb, AVD_SU *su, struct 
> avd_su_si_rel_tag *susi,
> diff --git a/osaf/services/saf/amf/amfd/include/su.h 
> b/osaf/services/saf/amf/amfd/include/su.h
> --- a/osaf/services/saf/amf/amfd/include/su.h
> +++ b/osaf/services/saf/amf/amfd/include/su.h
> @@ -137,6 +137,8 @@ class AVD_SU {
>   bool any_susi_fsm_in_unasgn();
>   bool any_susi_fsm_in_modify();
>   SaAisErrorT check_su_stability();
> + uint32_t curr_num_standby_sis();
> + uint32_t curr_num_active_sis();
>private:
>   void initialize();
>   void send_attribute_update(AVSV_AMF_SU_ATTR_ID attrib_id);
> diff --git a/osaf/services/saf/amf/amfd/sg.cc 
> b/osaf/services/saf/amf/amfd/sg.cc
> --- a/osaf/services/saf/amf/amfd/sg.cc
> +++ b/osaf/services/saf/amf/amfd/sg.cc
> @@ -1675,12 +1675,14 @@ void AVD_SG::set_fsm_state(AVD_SG_FSM_ST
>   if (state == AVD_SG_FSM_STABLE) {
>   osafassert(su_oper_list.empty() == true);
>   if (adminOp_invocationId != 0) {
> + TRACE("Admin operation finishes on SG:'%s'",name.value);
>   avd_saImmOiAdminOperationResult(avd_cb->immOiHandle, 
> adminOp_invocationId, SA_AIS_OK);
>   adminOp_invocationId = 0;
>   adminOp = static_cast(0);
>   }
>   for (AVD_SI* si = list_of_si; si != NULL; si = 
> si->sg_list_of_si_next) {
>   if (si->invocation != 0) {
> + TRACE("Admin operation finishes on 
> SI:'%s'",si->name.value);
>   
> avd_saImmOiAdminOperationResult(avd_cb->immOiHandle,
>   si->invocation, SA_AIS_OK);
>   si->invocation = 0;
> diff --git a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc 
> b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
> --- a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
> +++ b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
> @@ -2764,8 +2764,7 @@ uint32_t avd_sg_nway_susi_succ_si_oper(A
>   } else if (AVSV_SI_TOGGLE_SWITCH == susi->si->si_switch) {
>   /* si switch semantics in progress..
>  identify the most preferred standby su & assign it 
> active */
> - for (curr_susi = susi->si->list_of_sisu;
> -  curr_susi && (SA_AMF_HA_STANDBY != 
> curr_susi->state); curr_susi = curr_susi->si_next) ;
> + 

Re: [devel] [PATCH 00 of 17] Review Request for pyosaf: [Round 6] Add Python imm oi utils module and sample applications [#1406]

2015-09-16 Thread Hans Nordebäck
Hi,

A general comment, there is a ticket 
https://sourceforge.net/p/opensaf/tickets/751/  pyosaf: fix bad pylint rating. 
Have you run pylint after these changes? /Thanks HansN

-Original Message-
From: Johan Mårtensson O 
Sent: den 15 september 2015 14:34
To: Hans Nordebäck; mathi.naic...@oracle.com; Hung Nguyen D; 
srikanth.revan...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 00 of 17] Review Request for pyosaf: [Round 6] Add Python imm 
oi utils module and sample applications [#1406]

Summary: pyosaf: [Round 6] Add Python imm oi utils module and sample 
applications [#1406] Review request for Trac Ticket(s): #1406 Peer Reviewer(s): 
hans.nordeb...@ericsson.com, mathi.naic...@oracle.com, 
hung.d.ngu...@dektech.com.au, srikanth.revan...@oracle.com Pull request to: 
srikanth.revan...@oracle.com Affected branch(es): 4.7.x Development branch: 
opensaf-staging


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesn
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   y


Comments (indicate scope for each "y" above):
-
Updated after review comments from Hung Nguyen. The main changes are:

 - Change admin op upcall to include parameter name and type
 - Fix DN handling and class lookup in the cardinality validation
 - Minor fixes to the sample OIs


changeset 763aff55586eb30e5397e992da65b1c4581f475a
Author: Johan Mårtensson <johan.o.martens...@ericsson.com>
Date:   Thu, 20 Aug 2015 13:13:41 +0200

pyosaf: Add Python imm oi utils module and sample applications [#1406]

Add high-level imm oi utils module on top of the direct imm oi Python
bindings. Also add sample applications demonstrating usage both as
subclassing and with direct callbacks.

changeset 4175ba199c25cdba2d67815e555d074c7f782188
Author: Johan Mårtensson <johan.o.martens...@ericsson.com>
Date:   Thu, 27 Aug 2015 15:23:53 +0200

pyosaf: Fix handling of attribute updates and associated sample 
applications
[#1406]

Fix the handling of updates of runtime attributes on request from IMM. 
Add
sample application to demonstrate this, both for direct callbacks and by
using a subclass.

Verify by executing the sample applications:

./users &

immlist usersId=1

or

./users-inheritance-impl &

immlist usersId=2

changeset 1a95fca3d08330a9fbf2accd3365fae6ccf394b4
Author: Johan Mårtensson <johan.o.martens...@ericsson.com>
Date:   Fri, 28 Aug 2015 11:31:48 +0200

pyosaf: Make the users attribute in the UsersSampleClass multivalued 
[#1406]

Make the users attribute in the UsersSampleClass multivalued.

changeset aa808e57b2504b12d13905561ff78b9ae25e9c0e
Author: Johan Mårtensson <johan.o.martens...@ericsson.com>
Date:   Fri, 28 Aug 2015 11:33:03 +0200

pyosaf: Correct the users inheritance sample OI to use the right IMM 
object
[#1406]

Correct the inheritance implementation of the users sample OI to use the
right IMM object.

changeset da46babee9d83691553d4b6b872664c822bdbd91
Author: Johan Mårtensson <johan.o.martens...@ericsson.com>
Date:   Fri, 28 Aug 2015 11:33:33 +0200

pyosaf: Add the users sample OI to the README [#1406]

Add the users sample OI to the README

changeset 6da0d9897c710f5035056571c7ea1e55cf5ac3f2
Author: Johan Mårtensson <johan.o.martens...@ericsson.com>
Date:   Fri, 28 Aug 2015 15:20:32 +0200

pyosaf: Define DN before using it to filter [#1406]

When building the full content of the CCB on completed, a dn variable of
create was used without defining it. This patch fixes it.

changeset 4d076b5d92002076f84aa9376205c6f0205bf756
Author: Johan Mårtensson <johan.o.martens...@ericsson.com>
Date:   Thu, 03 Sep 2015 16:39:41 +0200

pyosaf: Make 'deleted' contain objects and fix containment code [#1406]

Fix the 'deleted' list passed in validate and apply callbacks to contain
proper instances of ImmObject instead of just DNs. Also fix the 
containment
validation.

changeset 6f764adb745cf67c3ed87e3e75b4aed99d3e7859
Author: Johan Mårtensson <johan.o.martens...@ericsson.com>
Date:   Thu, 03 Sep 2015 17:07:07 +0200

pyosaf: Move sample OIs to the correct directory and merge READMEs 
[#1406]

Move the sample OIs to the same directory as the existing samples. Also
merge the separate OI README with the existing README for samples.

changeset 74ed5e02d006cee62dfd7a9d44dce34305f91a05
Author: Johan Mårtensson <johan.o.martens...@ericsson.com>
Date:   Thu, 03 Sep 2015 17:13:29 +

Re: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has no current active assignments if node is locked V3 [#1465]

2015-09-16 Thread Hans Nordebäck
Hi Nagu,

yes, I'll change that, but one problem is the application SI's getting 
the SI unassigned alarm
when doing shutdown on a node, this is not wanted, so the check for M/W 
should be removed.

/Thanks HansN

On 09/16/2015 08:44 AM, Nagendra Kumar wrote:
> Hi Hans N,
> Two comments:
>
> 1. This patch removes the check of ' sg_of_si->sg_ncs_spec == true ' in 
> si.cc. I thought this check was fine.
> 2. The changes in siass.cc should be like:
> +if (sg_of_si->sg_ncs_spec == true &&
> + (sg_of_si->sg_type->saAmfSgtRedundancyModel == 
> SA_AMF_NO_REDUNDANCY_MODEL)) {
> + si->si_on_node = su->su_on_node;
> + si->curr_su = su;
> + }
>
> Thanks
> -Nagu
>
>> -Original Message-
>> From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
>> Sent: 15 September 2015 18:51
>> To: Praveen Malviya; Nagendra Kumar; gary@dektech.com.au
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: [PATCH 1 of 1] amfd: Don't send alarm SI has no current active
>> assignments if node is locked V3 [#1465]
>>
>>   osaf/services/saf/amf/amfd/include/si.h |   2 ++
>>   osaf/services/saf/amf/amfd/si.cc|  22 ++
>>   osaf/services/saf/amf/amfd/siass.cc |   3 +++
>>   3 files changed, 23 insertions(+), 4 deletions(-)
>>
>>
>> To perform scalein, shutdown is performed on a nodegroup. No-red
>> application SI's are
>> receiving alarm "SI has no current active assignments" which is not wanted at
>> scalein.
>> Thereafter OpenSAF is stopped via opensafd stop, the M/W No-red SI's are
>> receiving
>> "SI has no current active assignments" which is not wanted at scalein.
>>
>> diff --git a/osaf/services/saf/amf/amfd/include/si.h
>> b/osaf/services/saf/amf/amfd/include/si.h
>> --- a/osaf/services/saf/amf/amfd/include/si.h
>> +++ b/osaf/services/saf/amf/amfd/include/si.h
>> @@ -108,6 +108,8 @@ public:
>>
>>  bool alarm_sent; /* SI unassigned alarm has been sent */
>>
>> +AVD_AVND *si_on_node; /* the node on which this SI resides */
>> +AVD_SU *curr_su; /* the SU with the latest assignment*/
>>  void inc_curr_act_ass();
>>  void dec_curr_act_ass();
>>  void inc_curr_stdby_ass();
>> diff --git a/osaf/services/saf/amf/amfd/si.cc
>> b/osaf/services/saf/amf/amfd/si.cc
>> --- a/osaf/services/saf/amf/amfd/si.cc
>> +++ b/osaf/services/saf/amf/amfd/si.cc
>> @@ -26,6 +26,7 @@
>>   #include 
>>   #include 
>>   #include 
>> +#include 
>>
>>   AmfDb *si_db = NULL;
>>
>> @@ -319,7 +320,9 @@ AVD_SI::AVD_SI() :
>>  list_of_sus_per_si_rank(NULL),
>>  rankedsu_list_head(NULL),
>>  invocation(0),
>> -alarm_sent(false)
>> +alarm_sent(false),
>> +si_on_node{nullptr},
>> +curr_su{nullptr}
>>   {
>>  memset(, 0, sizeof(SaNameT));
>>  memset(, 0, sizeof(SaNameT));
>> @@ -1314,9 +1317,20 @@ void AVD_SI::update_ass_state()
>>
>>  /* alarm & notifications */
>>  if (saAmfSIAssignmentState ==
>> SA_AMF_ASSIGNMENT_UNASSIGNED) {
>> -avd_send_si_unassigned_alarm();
>> -alarm_sent = true;
>> -m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb,
>> this, AVSV_CKPT_SI_ALARM_SENT);
>> +osafassert(si_on_node != nullptr);
>> +osafassert(curr_su != nullptr);
>> +if ((sg_of_si->sg_type->saAmfSgtRedundancyModel ==
>> SA_AMF_NO_REDUNDANCY_MODEL) &&
>> +(curr_su->saAmfSUPresenceState !=
>> SA_AMF_PRESENCE_INSTANTIATION_FAILED) &&
>> +(curr_su->saAmfSUPresenceState !=
>> SA_AMF_PRESENCE_TERMINATION_FAILED) &&
>> +((si_on_node->saAmfNodeAdminState ==
>> SA_AMF_ADMIN_SHUTTING_DOWN) ||
>> + (si_on_node->saAmfNodeAdminState ==
>> SA_AMF_ADMIN_LOCKED) ||
>> + (si_on_node->saAmfNodeAdminState ==
>> SA_AMF_ADMIN_LOCKED_INSTANTIATION))) {
>> +LOG_NO("Node is locked, no SI unassigned
>> alarm will be sent");
>> +} else {
>> +avd_send_si_unassigned_alarm();
>> +alarm_sent = true;
>> +
>>  m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, this,
>> AVSV_CKPT_SI_ALARM_SENT);
>> +}
>>  }
>>  else {
>>  avd_send_si_assigned_ntf(, oldState,
>> saAmfSIAssignmentState);
>> diff --git a/osaf/services/saf/amf/amfd/siass.cc
>> b/osaf/services/saf/amf/amfd/siass.cc
>> --- a/osaf/services/saf/amf/amfd/siass.cc
>> +++ b/osaf/services/saf/amf/amfd/siass.cc
>> @@ -166,6 +166,9 @@ AVD_SU_SI_REL *avd_susi_create(AVD_CL_CB
>>  su_si->si = si;
>>  su_si->su = su;
>>
>> +si->si_on_node = su->su_on_node;
>> +si->curr_su = su;
>> +
>>  /*
>>   * Add the susi rel rec to the ordered si-list
>>   */


--
Monitor Your Dynamic 

Re: [devel] [PATCH 1 of 1] amfd: Range based for loop not correct in map_su_to_node [#1478]

2015-09-15 Thread Hans Nordebäck
Hi Gary,

Yes it was wrong before refactoring,  I'll correct this before pushing./Thanks 
HansN

-Original Message-
From: Gary Lee [mailto:gary@dektech.com.au] 
Sent: den 15 september 2015 05:43
To: Hans Nordebäck; praveen.malv...@oracle.com; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1 of 1] amfd: Range based for loop not correct in 
map_su_to_node [#1478]

Hi Hans

Please refer to one comment marked with [GL].

On 14/09/15 22:23, Hans Nordeback wrote:
>   osaf/services/saf/amf/amfd/ckpt_dec.cc |   4 +++-
>   osaf/services/saf/amf/amfd/node.cc |   2 +-
>   osaf/services/saf/amf/amfd/sgproc.cc   |   4 +++-
>   osaf/services/saf/amf/amfd/su.cc   |  20 ++--
>   4 files changed, 17 insertions(+), 13 deletions(-)
>
>
> diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
> b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
> +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> @@ -3043,9 +3043,11 @@ static uint32_t dec_ng_admin_state(AVD_C
>   AVD_AVND *node = avd_node_get(*iter);
>   AVD_SU *su = NULL;
>   //If this node has any susi on it.
> - for (const auto& su : node->list_of_su)
> + for (const auto& tmp : node->list_of_su) {
> + su = tmp;
>   if (su->list_of_susi != NULL)
>   break;
> + }
>   if ((ng->saAmfNGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) && 
> (su != NULL))
>   /* Still some assignments are not removed on the node.
>  if ng in SHUTTING_DOWN state and contoller role 
> changes then 
> diff --git a/osaf/services/saf/amf/amfd/node.cc 
> b/osaf/services/saf/amf/amfd/node.cc
> --- a/osaf/services/saf/amf/amfd/node.cc
> +++ b/osaf/services/saf/amf/amfd/node.cc
> @@ -88,7 +88,7 @@ bool AVD_AVND::is_node_lock() {
> for (curr_susi = su->list_of_susi;
>  (curr_susi) && ((SA_AMF_HA_QUIESCING != curr_susi->state) ||
>  ((AVD_SU_SI_STATE_UNASGN == curr_susi->fsm)));
> -   curr_susi = curr_susi->su_next); \
> +   curr_susi = curr_susi->su_next);
> if (curr_susi)
>   return false;
>   }
> diff --git a/osaf/services/saf/amf/amfd/sgproc.cc 
> b/osaf/services/saf/amf/amfd/sgproc.cc
> --- a/osaf/services/saf/amf/amfd/sgproc.cc
> +++ b/osaf/services/saf/amf/amfd/sgproc.cc
> @@ -712,7 +712,9 @@ void avd_su_oper_state_evh(AVD_CL_CB *cb
>*/
>   avd_node_oper_state_set(node, 
> SA_AMF_OPERATIONAL_DISABLED);
>   node->recvr_fail_sw = true;
> - for (const auto& su : node->list_of_su) {
> + // TODO (uabhano) is the below code correct?
> + for (const auto& i_su : node->list_of_su) {
> + TRACE("Is this for loop correct with 
> regard to i_su and su 
> +below? %s", i_su->name.value);
[GL] As you suspect, looks like below should be i_su->set_readiness_state? 
Looks like it was wrong even before refactoring.
>   
> su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE);
>   }
>   }   /* if 
> (n2d_msg->msg_info.n2d_opr_state.node_oper_state == 
> SA_AMF_OPERATIONAL_DISABLED) */
> diff --git a/osaf/services/saf/amf/amfd/su.cc 
> b/osaf/services/saf/amf/amfd/su.cc
> --- a/osaf/services/saf/amf/amfd/su.cc
> +++ b/osaf/services/saf/amf/amfd/su.cc
> @@ -489,6 +489,8 @@ static AVD_AVND *map_su_to_node(AVD_SU *
>   AVD_SU *su_temp = NULL;
>   AVD_AVND *node = NULL;
>   std::set::const_iterator node_iter;
> + std::vector<AVD_SU*>::const_iterator su_iter;
> + std::vector<AVD_SU*> *su_list = nullptr;
>   
>   TRACE_ENTER2("'%s'", su->name.value);
>   
> @@ -517,20 +519,18 @@ static AVD_AVND *map_su_to_node(AVD_SU *
>   osafassert(node);
>   
>   if (su->sg_of_su->sg_ncs_spec == true) {
> - for (const auto& su_temp : node->list_of_ncs_su) {
> - if (su_temp->sg_of_su == su->sg_of_su)
> - break;
> - }
> + su_list = >list_of_ncs_su;
> + } else {
> + su_list = >list_of_su;
>   }
>   
> - if (su->sg_of_su->sg_ncs_spec == false) {
> 

Re: [devel] [PATCH 1 of 1] amfd: Range based for loop not correct in map_su_to_node [#1478]

2015-09-15 Thread Hans Nordebäck
good, I'll update the patch and then I'll  push it/Thanks HansN

On 09/15/2015 01:22 PM, praveen malviya wrote:
> Ack with one minor comment, code review only.
>
> Thanks,
> Praveen
>
> On 14-Sep-15 5:53 PM, Hans Nordeback wrote:
>>   osaf/services/saf/amf/amfd/ckpt_dec.cc |   4 +++-
>>   osaf/services/saf/amf/amfd/node.cc |   2 +-
>>   osaf/services/saf/amf/amfd/sgproc.cc   |   4 +++-
>>   osaf/services/saf/amf/amfd/su.cc   |  20 ++--
>>   4 files changed, 17 insertions(+), 13 deletions(-)
>>
>>
>> diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
>> b/osaf/services/saf/amf/amfd/ckpt_dec.cc
>> --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
>> +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
>> @@ -3043,9 +3043,11 @@ static uint32_t dec_ng_admin_state(AVD_C
>>   AVD_AVND *node = avd_node_get(*iter);
>>   AVD_SU *su = NULL;
>>   //If this node has any susi on it.
>> -for (const auto& su : node->list_of_su)
>> +for (const auto& tmp : node->list_of_su) {
>> +su = tmp;
>>   if (su->list_of_susi != NULL)
>>   break;
>> +}
>>   if ((ng->saAmfNGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) 
>> && (su != NULL))
>>   /* Still some assignments are not removed on the node.
>>  if ng in SHUTTING_DOWN state and contoller role 
>> changes then
>> diff --git a/osaf/services/saf/amf/amfd/node.cc 
>> b/osaf/services/saf/amf/amfd/node.cc
>> --- a/osaf/services/saf/amf/amfd/node.cc
>> +++ b/osaf/services/saf/amf/amfd/node.cc
>> @@ -88,7 +88,7 @@ bool AVD_AVND::is_node_lock() {
>> for (curr_susi = su->list_of_susi;
>>  (curr_susi) && ((SA_AMF_HA_QUIESCING != 
>> curr_susi->state) ||
>>  ((AVD_SU_SI_STATE_UNASGN == 
>> curr_susi->fsm)));
>> -   curr_susi = curr_susi->su_next); \
>> +   curr_susi = curr_susi->su_next);
>> if (curr_susi)
>>   return false;
>>   }
>> diff --git a/osaf/services/saf/amf/amfd/sgproc.cc 
>> b/osaf/services/saf/amf/amfd/sgproc.cc
>> --- a/osaf/services/saf/amf/amfd/sgproc.cc
>> +++ b/osaf/services/saf/amf/amfd/sgproc.cc
>> @@ -712,7 +712,9 @@ void avd_su_oper_state_evh(AVD_CL_CB *cb
>>*/
>>   avd_node_oper_state_set(node, 
>> SA_AMF_OPERATIONAL_DISABLED);
>>   node->recvr_fail_sw = true;
>> -for (const auto& su : node->list_of_su) {
>> +// TODO (uabhano) is the below code correct?
>> +for (const auto& i_su : node->list_of_su) {
>> +TRACE("Is this for loop correct with regard to 
>> i_su and su below? %s", i_su->name.value);
>> su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE);\
> As node operational state is disabled, readiness state of all the 
> application SUs on that node will be OOS. So mark all the SUs OOS.
>
> Thanks
> Praveen
>>   }
>>   }/* if 
>> (n2d_msg->msg_info.n2d_opr_state.node_oper_state == 
>> SA_AMF_OPERATIONAL_DISABLED) */
>> diff --git a/osaf/services/saf/amf/amfd/su.cc 
>> b/osaf/services/saf/amf/amfd/su.cc
>> --- a/osaf/services/saf/amf/amfd/su.cc
>> +++ b/osaf/services/saf/amf/amfd/su.cc
>> @@ -489,6 +489,8 @@ static AVD_AVND *map_su_to_node(AVD_SU *
>>   AVD_SU *su_temp = NULL;
>>   AVD_AVND *node = NULL;
>>   std::set::const_iterator node_iter;
>> +std::vector::const_iterator su_iter;
>> +std::vector *su_list = nullptr;
>>
>>   TRACE_ENTER2("'%s'", su->name.value);
>>
>> @@ -517,20 +519,18 @@ static AVD_AVND *map_su_to_node(AVD_SU *
>>   osafassert(node);
>>
>>   if (su->sg_of_su->sg_ncs_spec == true) {
>> -for (const auto& su_temp : node->list_of_ncs_su) {
>> -if (su_temp->sg_of_su == su->sg_of_su)
>> -break;
>> -}
>> +su_list = >list_of_ncs_su;
>> +} else {
>> +su_list = >list_of_su;
>>   }
>>
>> -if (su->sg_of_su->sg_ncs_spec == false) {
>> -for (const auto& su_temp : node->list_of_su) {
>> -if (su_temp->sg_of_su == su->sg_of_su)
>> -break;
>> -}
>> +for (su_iter = su_list->begin(); su_iter != su_list->end(); 
>> ++su_iter) {
>> +su_temp = *su_iter;
>> +if (su_temp->sg_of_su == su->sg_of_su)
>> +break;
>>   }
>>
>> -if (su_temp == NULL)
>> +if (su_iter == su_list->end())
>>   goto done;
>>   }
>>
>>


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: remove unused variables [#1142]

2015-09-15 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: Gary Lee [mailto:gary@dektech.com.au] 
Sent: den 15 september 2015 09:29
To: Hans Nordebäck; nagendr...@oracle.com; Gary Lee
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: remove unused variables [#1142]

 osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |  2 --
 osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |  2 --
 2 files changed, 0 insertions(+), 4 deletions(-)


This fixes unused variable warnings if both 'convert list_of_su to std::set V2' 
and 'convert AVD_SG_OPER to std::list V2' refactoring patches are applied.

diff --git a/osaf/services/saf/amf/amfd/sg_nored_fsm.cc 
b/osaf/services/saf/amf/amfd/sg_nored_fsm.cc
--- a/osaf/services/saf/amf/amfd/sg_nored_fsm.cc
+++ b/osaf/services/saf/amf/amfd/sg_nored_fsm.cc
@@ -1067,8 +1067,6 @@ uint32_t SG_NORED::si_admin_down(AVD_CL_  }
 
 uint32_t SG_NORED::sg_admin_down(AVD_CL_CB *cb, AVD_SG *sg) {
-   AVD_SU *i_su;
-
TRACE_ENTER2("%u", sg->sg_fsm_state);
 
if ((cb->init_state != AVD_APP_STATE) && (sg->sg_ncs_spec == false)) { 
diff --git a/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc 
b/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
--- a/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
+++ b/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
@@ -1659,8 +1659,6 @@ uint32_t SG_NACV::si_admin_down(AVD_CL_C  }
 
 uint32_t SG_NACV::sg_admin_down(AVD_CL_CB *cb, AVD_SG *sg) {
-   AVD_SU *i_su;
-
TRACE_ENTER2("%u", sg->sg_fsm_state);
 
if ((cb->init_state != AVD_APP_STATE) && (sg->sg_ncs_spec == false)) {

--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfa: return NOT_SUPPORTED for PM_ABNORMAL_END [#181]

2015-09-14 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 08/26/2015 07:21 AM, nagendr...@oracle.com wrote:
>   osaf/libs/agents/saf/amfa/ava_api.c |  28 ++--
>   1 files changed, 22 insertions(+), 6 deletions(-)
>
>
> Amf is returning SA_AIS_ERR_INVALID_PARAM for SA_AMF_PM_ABNORMAL_END and its
> combination with other SaAmfPmErrorsT flags. This is incorrect behaviour
> because SA_AMF_PM_ABNORMAL_END and its combination with other SaAmfPmErrorsT
> flags are valid input to APIs saAmfPmStart and saAmfPmStop.
> Since these combinations feature is not supported in Amf as of now,
> so, Amf should return SA_AIS_ERR_NOT_SUPPORTED for such
> combinations.
> The fix provides the same.
>
> diff --git a/osaf/libs/agents/saf/amfa/ava_api.c 
> b/osaf/libs/agents/saf/amfa/ava_api.c
> --- a/osaf/libs/agents/saf/amfa/ava_api.c
> +++ b/osaf/libs/agents/saf/amfa/ava_api.c
> @@ -953,9 +953,17 @@ SaAisErrorT saAmfPmStart(SaAmfHandleT hd
>   
>   /* input validation of pmError */
>   if (pmErr != SA_AMF_PM_NON_ZERO_EXIT && pmErr != SA_AMF_PM_ZERO_EXIT &&
> - pmErr != (SA_AMF_PM_NON_ZERO_EXIT | SA_AMF_PM_ZERO_EXIT)) {
> - TRACE_LEAVE2("Incorrect argument specified for SaAmfPmErrorsT 
> ");
> - return SA_AIS_ERR_INVALID_PARAM;
> + pmErr != (SA_AMF_PM_NON_ZERO_EXIT | 
> SA_AMF_PM_ZERO_EXIT)) {
> + if ((pmErr == SA_AMF_PM_ABNORMAL_END) ||
> + (pmErr == (SA_AMF_PM_NON_ZERO_EXIT | 
> SA_AMF_PM_ABNORMAL_END)) ||
> + (pmErr == (SA_AMF_PM_ZERO_EXIT | 
> SA_AMF_PM_ABNORMAL_END)) ||
> + (pmErr == (SA_AMF_PM_ZERO_EXIT | 
> SA_AMF_PM_NON_ZERO_EXIT | SA_AMF_PM_ABNORMAL_END))) {
> + TRACE_LEAVE2("Unsupported argument specified for 
> SaAmfPmErrorsT ");
> + return SA_AIS_ERR_NOT_SUPPORTED;
> + } else {
> + TRACE_LEAVE2("Incorrect argument specified for 
> SaAmfPmErrorsT ");
> + return SA_AIS_ERR_INVALID_PARAM;
> + }
>   }
>   
>   /* input validation of Recomended recovery */
> @@ -1064,9 +1072,17 @@ SaAisErrorT saAmfPmStop(SaAmfHandleT hdl
>   
>   /* input validation of pmError */
>   if (pmErr != SA_AMF_PM_NON_ZERO_EXIT && pmErr != SA_AMF_PM_ZERO_EXIT &&
> - pmErr != (SA_AMF_PM_NON_ZERO_EXIT | SA_AMF_PM_ZERO_EXIT)) {
> - TRACE_LEAVE2("Incorrect argument specified for SaAmfPmErrorsT");
> - return SA_AIS_ERR_INVALID_PARAM;
> + pmErr != (SA_AMF_PM_NON_ZERO_EXIT | 
> SA_AMF_PM_ZERO_EXIT)) {
> + if ((pmErr == SA_AMF_PM_ABNORMAL_END) ||
> + (pmErr == (SA_AMF_PM_NON_ZERO_EXIT | 
> SA_AMF_PM_ABNORMAL_END)) ||
> + (pmErr == (SA_AMF_PM_ZERO_EXIT | 
> SA_AMF_PM_ABNORMAL_END)) ||
> + (pmErr == (SA_AMF_PM_ZERO_EXIT | 
> SA_AMF_PM_NON_ZERO_EXIT | SA_AMF_PM_ABNORMAL_END))) {
> + TRACE_LEAVE2("Unsupported argument specified for 
> SaAmfPmErrorsT ");
> + return SA_AIS_ERR_NOT_SUPPORTED;
> + } else {
> + TRACE_LEAVE2("Incorrect argument specified for 
> SaAmfPmErrorsT");
> + return SA_AIS_ERR_INVALID_PARAM;
> + }
>   }
>   
>   /* input validation of Process ID */


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: correct logic in si dep flow [#276]

2015-09-14 Thread Hans Nordebäck
Hi Nagu,

good, yes it is an ack.

/Thanks Hans

On 09/14/2015 08:41 AM, Nagendra Kumar wrote:
> Hi Hans N,
>   Thanks for your review, I will add it in function() and commit. 
> Is that Ack?
>
> Thanks
> -Nagu
>
>> -Original Message-----
>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
>> Sent: 26 August 2015 16:56
>> To: Nagendra Kumar; Praveen Malviya; minh.c...@dektech.com.au;
>> gary@dektech.com.au
>> Cc: opensaf-devel@lists.sourceforge.net; hans Nordebäck
>> Subject: Re: [PATCH 1 of 1] amfd: correct logic in si dep flow [#276]
>>
>> Hi,
>>
>> instead of the complex  if statements you can add member functions to
>> AVD_SI,
>> example, if (dep_si->is_tol_timer_running()  etc.
>>
>> /Thanks HansN
>>
>> On 08/26/2015 09:05 AM, Nagendra Kumar wrote:
>>> Hi Praveen,
>>> Thanks for your comment.
>>> I think we can have two approaches:
>>> 1.  Remove the code itself as suggested by you. OR
>>> 2.  Correct the logic in the intended way. For example, please check
>> below correction:
>>>> -  if((dep_si->si_dep_state !=
>> AVD_SI_TOL_TIMER_RUNNING) ||
>>>> -  (dep_si->si_dep_state !=
>> AVD_SI_READY_TO_UNASSIGN)) {
>>>> +  /* Don't start tol timer if dep state are either in
>> running or unassigned. */
>>>> +  if(!((dep_si->si_dep_state ==
>> AVD_SI_TOL_TIMER_RUNNING) ||
>>>> +  (dep_si->si_dep_state ==
>> AVD_SI_READY_TO_UNASSIGN))) {
>>  avd_sidep_start_tolerance_timer_for_dependant(dep_si, si);
>>> The intention looks that if si_dep_state is in either tol_running or
>> ready_to_unassigned, then don't start the timer, else start the timer.
>>> So, I corrected the logic in the intended way. Now, the code will have the
>> same sense as thought while coding.
>>> And if the logic written is wrong in the first place and since the check was
>> always passing, now after
>>> correction of code, the test case may fail. But then we can correct the 
>>> fault
>> in si dep flow and add logic on top.
>>> Let me know everybody opinion.
>>>
>>> Thanks
>>> -Nagu
>>>
>>>> -Original Message-
>>>> From: praveen malviya
>>>> Sent: 26 August 2015 12:15
>>>> To: Nagendra Kumar; hans.nordeb...@ericsson.com;
>>>> minh.c...@dektech.com.au; gary@dektech.com.au
>>>> Cc: opensaf-devel@lists.sourceforge.net
>>>> Subject: Re: [PATCH 1 of 1] amfd: correct logic in si dep flow [#276]
>>>>
>>>> Code inside the if block was always executing, which means if condition is
>> not
>>>> needed.
>>>> Why can't simply remove the if condition.
>>>>
>>>> Thanks,
>>>> Praveen
>>>> On 26-Aug-15 11:51 AM, nagendr...@oracle.com wrote:
>>>>> osaf/services/saf/amf/amfd/si_dep.cc |  25 -
>>>>> 1 files changed, 12 insertions(+), 13 deletions(-)
>>>>>
>>>>>
>>>>> At many places, there has been tautological errors in si dep flow.
>>>>> The fix corrects them
>>>>>
>>>>> diff --git a/osaf/services/saf/amf/amfd/si_dep.cc
>>>>> b/osaf/services/saf/amf/amfd/si_dep.cc
>>>>> --- a/osaf/services/saf/amf/amfd/si_dep.cc
>>>>> +++ b/osaf/services/saf/amf/amfd/si_dep.cc
>>>>> @@ -1468,10 +1468,10 @@ void avd_sidep_unassign_dependents(AVD_S
>>>>>   if (m_NCS_MDS_DEST_EQUAL(>su->su_on_node-
>>>>> adest,>su_on_node->adest)) {
>>>>>   avd_si_unassign(dep_si);
>>>>>   } else {
>>>>> - if((dep_si->si_dep_state !=
>>>> AVD_SI_TOL_TIMER_RUNNING) ||
>>>>> - (dep_si->si_dep_state !=
>>>> AVD_SI_READY_TO_UNASSIGN)) {
>>>>> + /* Don't start tol timer if dep state are either in
>>>> running or unassigned. */
>>>>> + if(!((dep_si->si_dep_state ==
>>>> AVD_SI_TOL_TIMER_RUNNING) ||
>>>>> + (dep_si->si_dep_state ==
>>>> AVD_SI_READY_TO_UNASSIGN))) {
>>>>avd_sidep_start_tole

Re: [devel] [PATCH 1 of 1] osaf: Create runtime call graph from OpenSAF trace files [#1142]

2015-09-10 Thread Hans Nordebäck

Hi Mathi,

I attach two pictures from the output of:

$./trace2dot -t osafamfd -f saClmDispatch -d amfd_trace.dot
$ dotty amfd_trace.dot

and

$./trace2dot -t osafamfd -d amfd_trace.dot
$ dotty amfd_trace.dot

/Thanks HansN

On 09/10/2015 10:59 AM, Mathivanan Naickan Palanivelu wrote:

Hi Hans,

I do appreciate the idea of suggesting dotty, good thought!
I did run dotty as mentioned in the patch. We could place the trace2dot with 
'execute'
permissions and place it under tools/devel/dot directory.

Also, the output i get after running dotty doesn't looks intuitive to me.
So, for comparison sakes,could you send a picture (snapshot) of how the graph
looks to you when you run it on osafamfd trace file?

BR,
Mathi.

- hans.nordeb...@ericsson.com wrote:


tools/devel/trace2dot |  169
++
  1 files changed, 169 insertions(+), 0 deletions(-)


Python script to create a runtime callgraph from OpenSAF trace files.
A dot file is created and can be viewed using e.g. dotty

diff --git a/tools/devel/trace2dot b/tools/devel/trace2dot
new file mode 100755
--- /dev/null
+++ b/tools/devel/trace2dot
@@ -0,0 +1,169 @@
+#!/usr/bin/env python
+#
+#
+# (C) Copyright 201t The OpenSAF Foundation
+#
+# This program is distributed in the hope that it will be useful,
but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are
licensed
+# under the GNU Lesser General Public License Version 2.1, February
1999.
+# The complete license can be accessed from the following location:
+# http://opensource.org/licenses/lgpl-license.php
+# See the Copying file included with the OpenSAF distribution for
full
+# licensing terms.
+#
+# Author(s): Ericsson
+#
+#
+"""
+ trace2dot creates a runtime call graph using an opensaf trace file
as input
+ and produces a dot file. The generated dot file can be  viewed
graphically using e.g. dotty.
+
+ Example:
+ Create a dot file, amfd_trace.dot from osafamfd trace file. Start
from function set_oper_state.
+ $ trace2dot -t osafamfd -f ssaClmDispatch -d amfd_trace.dot
+ $ dotty amfd_trace.dot
+
+"""
+import sys
+import os
+import argparse
+
+
+def run(trace_file, from_function, dot_file):
+''' TBD '''
+infile = open(trace_file)
+
+if dot_file:
+outfile = open(dot_file, 'w')
+else:
+outfile = sys.stdout
+
+outfile.write('strict digraph test {\n')
+outfile.write('node [shape=record, style=filled];\n')
+outfile.write('edge [shape=normal];\n')
+
+process_infile(infile, from_function, outfile)
+
+outfile.write('}\n')
+
+
+def check_infile(trace_file):
+'''  Rudimentary check for missing TRACE_ENTER/TRACE_LEAVE. Will
not
+ check for e.g. returns before TRACE_LEAVE.
+'''
+infile = open(trace_file)
+trace_enter = set()
+trace_leave = set()
+for line in infile:
+items = line.split()
+if items.__len__() > 6:
+if items[5] == '>>':
+name = items[6].rstrip(':')
+trace_enter.add(name)
+
+if items[5] == '<<':
+name = items[6].rstrip(':')
+trace_leave.add(name)
+
+for name in trace_enter:
+if name not in trace_leave:
+print '%s %s' % ('TRACE_LEAVE is missing for function: ',
name)
+
+for name in trace_leave:
+if name not in trace_enter:
+print '%s %s' % ('TRACE_ENTER is missing for function: ',
name)
+
+infile.close()
+
+
+def process_infile(infile, from_function, outfile):
+'''  TBD '''
+function_names = []
+from_func_found = False
+
+for line in infile:
+items = line.split()
+if items.__len__() > 6:
+if items[5] == '>>':
+func_enter = items[6].rstrip(':')
+if from_function and not from_func_found:
+if from_function != func_enter:
+continue
+else:
+from_func_found = True
+
+function_names.append(func_enter)
+
+if len(function_names) > 1:
+outfile.write(
+func_enter + ' [color=grey, shape=box,
label="' + func_enter + '"];\n')
+else:
+outfile.write(
+func_enter + ' [color=red, shape=box,
label="' + func_enter + '"];\n')
+
+if items[5] == '<<':
+func_leave = items[6].rstrip(':')
+if from_function:
+if from_function == func_leave:
+break
+
+if len(function_names) > 0:
+func_enter = function_names.pop()
+if func_enter != func_leave:
+print '%s %s %s' % (func_enter, ' has no
matching TRACE_LEAVE, found ', func_leave)
+outfile.write(func_leave + ' -> ' +
func_enter + '\n')
+

Re: [devel] [PATCH 1 of 1] osaf: Create runtime call graph from OpenSAF trace files [#1142]

2015-09-10 Thread Hans Nordebäck
Hi Mathi,

I use graphviz version 2.36.0. Can you send me your dot file(s), I can 
have a look to see if
something is wrong. Anyhow I'll push the patch. /Thanks HansN

On 09/10/2015 11:13 AM, Mathivanan Naickan Palanivelu wrote:
> Looks Good unlike what i see :-). It must be some problem with the dotty 
> version or something.
> My graphviz version is 2.26.3, what would be yours?
> Anyways, ACK from me.
>
> Cheers,
> Mathi.
>
> - hans.nordeb...@ericsson.com wrote:
>
>> Hi Mathi,
>>
>> I attach two pictures from the output of:
>>
>> $./trace2dot -t osafamfd -f saClmDispatch -d amfd_trace.dot
>> $ dotty amfd_trace.dot
>>
>> and
>>
>> $./trace2dot -t osafamfd -d amfd_trace.dot
>> $ dotty amfd_trace.dot
>>
>> /Thanks HansN
>>
>> On 09/10/2015 10:59 AM, Mathivanan Naickan Palanivelu wrote:
>>> Hi Hans,
>>>
>>> I do appreciate the idea of suggesting dotty, good thought!
>>> I did run dotty as mentioned in the patch. We could place the
>> trace2dot with 'execute'
>>> permissions and place it under tools/devel/dot directory.
>>>
>>> Also, the output i get after running dotty doesn't looks intuitive
>> to me.
>>> So, for comparison sakes,could you send a picture (snapshot) of how
>> the graph
>>> looks to you when you run it on osafamfd trace file?
>>>
>>> BR,
>>> Mathi.
>>>
>>> - hans.nordeb...@ericsson.com wrote:
>>>
 tools/devel/trace2dot |  169
 ++
1 files changed, 169 insertions(+), 0 deletions(-)


 Python script to create a runtime callgraph from OpenSAF trace
>> files.
 A dot file is created and can be viewed using e.g. dotty

 diff --git a/tools/devel/trace2dot b/tools/devel/trace2dot
 new file mode 100755
 --- /dev/null
 +++ b/tools/devel/trace2dot
 @@ -0,0 +1,169 @@
 +#!/usr/bin/env python
 +#
 +#
 +# (C) Copyright 201t The OpenSAF Foundation
 +#
 +# This program is distributed in the hope that it will be useful,
 but
 +# WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY
 +# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are
 licensed
 +# under the GNU Lesser General Public License Version 2.1,
>> February
 1999.
 +# The complete license can be accessed from the following
>> location:
 +# http://opensource.org/licenses/lgpl-license.php
 +# See the Copying file included with the OpenSAF distribution for
 full
 +# licensing terms.
 +#
 +# Author(s): Ericsson
 +#
 +#
 +"""
 + trace2dot creates a runtime call graph using an opensaf trace
>> file
 as input
 + and produces a dot file. The generated dot file can be  viewed
 graphically using e.g. dotty.
 +
 + Example:
 + Create a dot file, amfd_trace.dot from osafamfd trace file.
>> Start
 from function set_oper_state.
 + $ trace2dot -t osafamfd -f ssaClmDispatch -d amfd_trace.dot
 + $ dotty amfd_trace.dot
 +
 +"""
 +import sys
 +import os
 +import argparse
 +
 +
 +def run(trace_file, from_function, dot_file):
 +''' TBD '''
 +infile = open(trace_file)
 +
 +if dot_file:
 +outfile = open(dot_file, 'w')
 +else:
 +outfile = sys.stdout
 +
 +outfile.write('strict digraph test {\n')
 +outfile.write('node [shape=record, style=filled];\n')
 +outfile.write('edge [shape=normal];\n')
 +
 +process_infile(infile, from_function, outfile)
 +
 +outfile.write('}\n')
 +
 +
 +def check_infile(trace_file):
 +'''  Rudimentary check for missing TRACE_ENTER/TRACE_LEAVE.
>> Will
 not
 + check for e.g. returns before TRACE_LEAVE.
 +'''
 +infile = open(trace_file)
 +trace_enter = set()
 +trace_leave = set()
 +for line in infile:
 +items = line.split()
 +if items.__len__() > 6:
 +if items[5] == '>>':
 +name = items[6].rstrip(':')
 +trace_enter.add(name)
 +
 +if items[5] == '<<':
 +name = items[6].rstrip(':')
 +trace_leave.add(name)
 +
 +for name in trace_enter:
 +if name not in trace_leave:
 +print '%s %s' % ('TRACE_LEAVE is missing for function:
>> ',
 name)
 +
 +for name in trace_leave:
 +if name not in trace_enter:
 +print '%s %s' % ('TRACE_ENTER is missing for function:
>> ',
 name)
 +
 +infile.close()
 +
 +
 +def process_infile(infile, from_function, outfile):
 +'''  TBD '''
 +function_names = []
 +from_func_found = False
 +
 +for line in infile:
 +items = line.split()
 +if items.__len__() > 6:
 +if items[5] == '>>':
 +func_enter = 

Re: [devel] [PATCH 1 of 1] osaf: Create runtime call graph from OpenSAF trace files [#1142]

2015-09-10 Thread Hans Nordebäck
Hi Mathi,

It may also be the case that your trace file(s) includes some 
TRACE_ENTER without matching TRACE_LEAVE or vice versa.
The trace2dot can also be used to do "rudimentary" checks for missing 
TRACE_ENTER/TRACE_LEAVE by using -c as argument.
With this info the files with mismatched TRACE_ENTER/TRACE_LEAVE can be 
updated.
As we are using C++ in e.g. AMF we can adapt the TRACE_ENTER to the RAII 
idiom, then we don't have to
specify any TRACE_LEAVES.

/Thanks HansN

On 09/10/2015 12:10 PM, Hans Nordebäck wrote:
> Hi Mathi,
>
> I use graphviz version 2.36.0. Can you send me your dot file(s), I can 
> have a look to see if
> something is wrong. Anyhow I'll push the patch. /Thanks HansN
>
> On 09/10/2015 11:13 AM, Mathivanan Naickan Palanivelu wrote:
>> Looks Good unlike what i see :-). It must be some problem with the 
>> dotty version or something.
>> My graphviz version is 2.26.3, what would be yours?
>> Anyways, ACK from me.
>>
>> Cheers,
>> Mathi.
>>
>> - hans.nordeb...@ericsson.com wrote:
>>
>>> Hi Mathi,
>>>
>>> I attach two pictures from the output of:
>>>
>>> $./trace2dot -t osafamfd -f saClmDispatch -d amfd_trace.dot
>>> $ dotty amfd_trace.dot
>>>
>>> and
>>>
>>> $./trace2dot -t osafamfd -d amfd_trace.dot
>>> $ dotty amfd_trace.dot
>>>
>>> /Thanks HansN
>>>
>>> On 09/10/2015 10:59 AM, Mathivanan Naickan Palanivelu wrote:
>>>> Hi Hans,
>>>>
>>>> I do appreciate the idea of suggesting dotty, good thought!
>>>> I did run dotty as mentioned in the patch. We could place the
>>> trace2dot with 'execute'
>>>> permissions and place it under tools/devel/dot directory.
>>>>
>>>> Also, the output i get after running dotty doesn't looks intuitive
>>> to me.
>>>> So, for comparison sakes,could you send a picture (snapshot) of how
>>> the graph
>>>> looks to you when you run it on osafamfd trace file?
>>>>
>>>> BR,
>>>> Mathi.
>>>>
>>>> - hans.nordeb...@ericsson.com wrote:
>>>>
>>>>> tools/devel/trace2dot |  169
>>>>> ++
>>>>>1 files changed, 169 insertions(+), 0 deletions(-)
>>>>>
>>>>>
>>>>> Python script to create a runtime callgraph from OpenSAF trace
>>> files.
>>>>> A dot file is created and can be viewed using e.g. dotty
>>>>>
>>>>> diff --git a/tools/devel/trace2dot b/tools/devel/trace2dot
>>>>> new file mode 100755
>>>>> --- /dev/null
>>>>> +++ b/tools/devel/trace2dot
>>>>> @@ -0,0 +1,169 @@
>>>>> +#!/usr/bin/env python
>>>>> +#
>>>>> +#
>>>>> +# (C) Copyright 201t The OpenSAF Foundation
>>>>> +#
>>>>> +# This program is distributed in the hope that it will be useful,
>>>>> but
>>>>> +# WITHOUT ANY WARRANTY; without even the implied warranty of
>>>>> MERCHANTABILITY
>>>>> +# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are
>>>>> licensed
>>>>> +# under the GNU Lesser General Public License Version 2.1,
>>> February
>>>>> 1999.
>>>>> +# The complete license can be accessed from the following
>>> location:
>>>>> +# http://opensource.org/licenses/lgpl-license.php
>>>>> +# See the Copying file included with the OpenSAF distribution for
>>>>> full
>>>>> +# licensing terms.
>>>>> +#
>>>>> +# Author(s): Ericsson
>>>>> +#
>>>>> +#
>>>>> +"""
>>>>> + trace2dot creates a runtime call graph using an opensaf trace
>>> file
>>>>> as input
>>>>> + and produces a dot file. The generated dot file can be viewed
>>>>> graphically using e.g. dotty.
>>>>> +
>>>>> + Example:
>>>>> + Create a dot file, amfd_trace.dot from osafamfd trace file.
>>> Start
>>>>> from function set_oper_state.
>>>>> + $ trace2dot -t osafamfd -f ssaClmDispatch -d amfd_trace.dot
>>>>> + $ dotty amfd_trace.dot
>>>>> +
>>>>> +"""
>>>>> +import sys
>>>>> +import os
>>>>> +import argparse
>>>>> +
>>>&

Re: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has no current active assignments if node is locked V2 [#1465]

2015-09-10 Thread Hans Nordebäck
Hi Nagu,

please see comment below. /Thanks HansN

On 09/10/2015 12:30 PM, Nagendra Kumar wrote:
> Forgot to provide comments in the previous email. Please find comments 
> inlined with [Nagu].
>
> Thanks
> -Nagu
>> -Original Message-
>> From: Nagendra Kumar
>> Sent: 10 September 2015 15:58
>> To: Hans Nordeback; Praveen Malviya; gary@dektech.com.au
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has no current
>> active assignments if node is locked V2 [#1465]
>>
>> Hi Hans N,
>>
>> I tested with combination of SU/Node lock/locked-in with pres state inst
>> fail/term fail.
>> So, when node is locked/locked-in, even if su goes into term fail, the alarm 
>> is
>> not sent because the pres state becomes uninst before update_ass_state gets
>> called. Hope this is ok.
>>
>> Ack with the comments inlined with [Nagu] and the documentation need to
>> be updated as well.
>>
>>
>> Thanks
>> -Nagu
>>> -Original Message-
>>> From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
>>> Sent: 04 September 2015 19:20
>>> To: Praveen Malviya; Nagendra Kumar; gary@dektech.com.au
>>> Cc: opensaf-devel@lists.sourceforge.net
>>> Subject: [PATCH 1 of 1] amfd: Don't send alarm SI has no current
>>> active assignments if node is locked V2 [#1465]
>>>
>>>   osaf/services/saf/amf/amfd/include/si.h |   2 ++
>>>   osaf/services/saf/amf/amfd/si.cc|  23 +++
>>>   osaf/services/saf/amf/amfd/siass.cc |   3 +++
>>>   3 files changed, 24 insertions(+), 4 deletions(-)
>>>
>>>
>>> diff --git a/osaf/services/saf/amf/amfd/include/si.h
>>> b/osaf/services/saf/amf/amfd/include/si.h
>>> --- a/osaf/services/saf/amf/amfd/include/si.h
>>> +++ b/osaf/services/saf/amf/amfd/include/si.h
>>> @@ -109,6 +109,8 @@ public:
>>>
>>> bool alarm_sent; /* SI unassigned alarm has been sent */
>>>
>>> +struct avd_avnd_tag *si_on_node;   /*  the node on which this SI
>>> resides */
>>> +AVD_SU *curr_su;/* The SU with the latest
>> assignment*/
>>> void inc_curr_act_ass();
>>> void dec_curr_act_ass();
>>> void inc_curr_stdby_ass();
>>> diff --git a/osaf/services/saf/amf/amfd/si.cc
>>> b/osaf/services/saf/amf/amfd/si.cc
>>> --- a/osaf/services/saf/amf/amfd/si.cc
>>> +++ b/osaf/services/saf/amf/amfd/si.cc
>>> @@ -26,6 +26,7 @@
>>>   #include 
>>>   #include 
>>>   #include 
>>> +#include 
>>>
>>>   AmfDb *si_db = NULL;
>>>
>>> @@ -320,7 +321,9 @@ AVD_SI::AVD_SI() :
>>> list_of_sus_per_si_rank(NULL),
>>> rankedsu_list_head(NULL),
>>> invocation(0),
>>> -   alarm_sent(false)
>>> +   alarm_sent(false),
>>> +   si_on_node{nullptr},
>>> +   curr_su{nullptr}
>>>   {
>>> memset(, 0, sizeof(SaNameT));
>>> memset(, 0, sizeof(SaNameT)); @@ -1315,9 +1318,21
>> @@
>>> void AVD_SI::update_ass_state()
>>>
>>> /* alarm & notifications */
>>> if (saAmfSIAssignmentState ==
>>> SA_AMF_ASSIGNMENT_UNASSIGNED) {
>>> -   avd_send_si_unassigned_alarm();
>>> -   alarm_sent = true;
>>> -   m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb,
>>> this, AVSV_CKPT_SI_ALARM_SENT);
>>> +   osafassert(si_on_node != nullptr);
>>> +   osafassert(curr_su != nullptr);
>>> +   if ((sg_of_si->sg_ncs_spec == true) &&
>>> +   (sg_of_si->sg_type->saAmfSgtRedundancyModel ==
>>> SA_AMF_NO_REDUNDANCY_MODEL) &&
>>> +   (curr_su->saAmfSUPresenceState !=
>>> SA_AMF_PRESENCE_INSTANTIATION_FAILED) &&
>>> +   (curr_su->saAmfSUPresenceState !=
>>> SA_AMF_PRESENCE_TERMINATION_FAILED) &&
>>> +   ((si_on_node->saAmfNodeAdminState ==
>>> SA_AMF_ADMIN_SHUTTING_DOWN) ||
>>> +(si_on_node->saAmfNodeAdminState ==
>>> SA_AMF_ADMIN_LOCKED) ||
>>> +(si_on_node->saAmfNodeAdminState ==
>>> SA_AMF_ADMIN_LOCKED_INSTANTIATION))) {
>>> +   LOG_NO("Node is locked, no SI unassigned
>>> alarm will be sent");
>>> +   } else {
>>> +   avd_send_si_unassigned_alarm();
>>> +   alarm_sent = true;
>>> +
>>> m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, this,
>>> AVSV_CKPT_SI_ALARM_SENT);
>>> +   }
>>> }
>>> else {
>>> avd_send_si_assigned_ntf(, oldState,
>> saAmfSIAssignmentState);
>>> diff --git a/osaf/services/saf/amf/amfd/siass.cc
>>> b/osaf/services/saf/amf/amfd/siass.cc
>>> --- a/osaf/services/saf/amf/amfd/siass.cc
>>> +++ b/osaf/services/saf/amf/amfd/siass.cc
>>> @@ -166,6 +166,9 @@ AVD_SU_SI_REL *avd_susi_create(AVD_CL_CB
>>> su_si->si = si;
>>> su_si->su = su;
>>>
>>> +   si->si_on_node = su->su_on_node;
>>> +   si->curr_su = su;
> [Nagu]: This need to be reset when susi is deleted.
[HansN] The curr_su reflects the latest assigned su and it 

Re: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has no current active assignments if node is locked V2 [#1465]

2015-09-10 Thread Hans Nordebäck
Hi Nagu,

Please see comment inlined/Thanks HansN

-Original Message-
From: Nagendra Kumar [mailto:nagendr...@oracle.com] 
Sent: den 10 september 2015 13:04
To: Hans Nordebäck; Praveen Malviya; Gary Lee
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has no current 
active assignments if node is locked V2 [#1465]

Hi Hans N,
Please find comment inlined.

Thanks
-Nagu
> -Original Message-
> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
> Sent: 10 September 2015 16:17
> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has no 
> current active assignments if node is locked V2 [#1465]
> 
> Hi Nagu,
> 
> please see comment below. /Thanks HansN
> 
> On 09/10/2015 12:30 PM, Nagendra Kumar wrote:
> > Forgot to provide comments in the previous email. Please find 
> > comments
> inlined with [Nagu].
> >
> > Thanks
> > -Nagu
> >> -Original Message-
> >> From: Nagendra Kumar
> >> Sent: 10 September 2015 15:58
> >> To: Hans Nordeback; Praveen Malviya; gary@dektech.com.au
> >> Cc: opensaf-devel@lists.sourceforge.net
> >> Subject: Re: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has 
> >> no current active assignments if node is locked V2 [#1465]
> >>
> >> Hi Hans N,
> >>
> >> I tested with combination of SU/Node lock/locked-in with pres state 
> >> inst fail/term fail.
> >> So, when node is locked/locked-in, even if su goes into term fail, 
> >> the alarm
> is
> >> not sent because the pres state becomes uninst before 
> >> update_ass_state
> gets
> >> called. Hope this is ok.
> >>
> >> Ack with the comments inlined with [Nagu] and the documentation 
> >> need
> to
> >> be updated as well.
> >>
> >>
> >> Thanks
> >> -Nagu
> >>> -Original Message-
> >>> From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
> >>> Sent: 04 September 2015 19:20
> >>> To: Praveen Malviya; Nagendra Kumar; gary@dektech.com.au
> >>> Cc: opensaf-devel@lists.sourceforge.net
> >>> Subject: [PATCH 1 of 1] amfd: Don't send alarm SI has no current 
> >>> active assignments if node is locked V2 [#1465]
> >>>
> >>>   osaf/services/saf/amf/amfd/include/si.h |   2 ++
> >>>   osaf/services/saf/amf/amfd/si.cc|  23 +++
> >>>   osaf/services/saf/amf/amfd/siass.cc |   3 +++
> >>>   3 files changed, 24 insertions(+), 4 deletions(-)
> >>>
> >>>
> >>> diff --git a/osaf/services/saf/amf/amfd/include/si.h
> >>> b/osaf/services/saf/amf/amfd/include/si.h
> >>> --- a/osaf/services/saf/amf/amfd/include/si.h
> >>> +++ b/osaf/services/saf/amf/amfd/include/si.h
> >>> @@ -109,6 +109,8 @@ public:
> >>>
> >>>   bool alarm_sent; /* SI unassigned alarm has been sent */
> >>>
> >>> +struct avd_avnd_tag *si_on_node; /*  the node on which this SI
> >>> resides */
> >>> +AVD_SU *curr_su;/* The SU with the latest
> >> assignment*/
> >>>   void inc_curr_act_ass();
> >>>   void dec_curr_act_ass();
> >>>   void inc_curr_stdby_ass();
> >>> diff --git a/osaf/services/saf/amf/amfd/si.cc
> >>> b/osaf/services/saf/amf/amfd/si.cc
> >>> --- a/osaf/services/saf/amf/amfd/si.cc
> >>> +++ b/osaf/services/saf/amf/amfd/si.cc
> >>> @@ -26,6 +26,7 @@
> >>>   #include 
> >>>   #include 
> >>>   #include 
> >>> +#include 
> >>>
> >>>   AmfDb<std::string, AVD_SI> *si_db = NULL;
> >>>
> >>> @@ -320,7 +321,9 @@ AVD_SI::AVD_SI() :
> >>>   list_of_sus_per_si_rank(NULL),
> >>>   rankedsu_list_head(NULL),
> >>>   invocation(0),
> >>> - alarm_sent(false)
> >>> + alarm_sent(false),
> >>> + si_on_node{nullptr},
> >>> + curr_su{nullptr}
> >>>   {
> >>>   memset(, 0, sizeof(SaNameT));
> >>>   memset(, 0, sizeof(SaNameT)); @@ -1315,9 +1318,21
> >> @@
> >>> void AVD_SI::update_ass_state()
> >>>
> >>>   /* alarm & notifications */
> >&

Re: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has no current active assignments if node is locked V2 [#1465]

2015-09-10 Thread Hans Nordebäck
Hi Nagu,

you mean the patch is acked and it can be pushed?

  /Thanks HansN

On 09/10/2015 01:40 PM, Nagendra Kumar wrote:
> Hi Hans N,
>   Comments inlined.
>
> Thanks
> -Nagu
>
>> -Original Message-
>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
>> Sent: 10 September 2015 16:54
>> To: Nagendra Kumar; Praveen Malviya; Gary Lee
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: RE: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has no current
>> active assignments if node is locked V2 [#1465]
>>
>> Hi Nagu,
>>
>> Please see comment inlined/Thanks HansN
>>
>> -Original Message-
>> From: Nagendra Kumar [mailto:nagendr...@oracle.com]
>> Sent: den 10 september 2015 13:04
>> To: Hans Nordebäck; Praveen Malviya; Gary Lee
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: RE: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has no current
>> active assignments if node is locked V2 [#1465]
>>
>> Hi Hans N,
>>  Please find comment inlined.
>>
>> Thanks
>> -Nagu
>>> -Original Message-
>>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
>>> Sent: 10 September 2015 16:17
>>> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
>>> Cc: opensaf-devel@lists.sourceforge.net
>>> Subject: Re: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has no
>>> current active assignments if node is locked V2 [#1465]
>>>
>>> Hi Nagu,
>>>
>>> please see comment below. /Thanks HansN
>>>
>>> On 09/10/2015 12:30 PM, Nagendra Kumar wrote:
>>>> Forgot to provide comments in the previous email. Please find
>>>> comments
>>> inlined with [Nagu].
>>>> Thanks
>>>> -Nagu
>>>>> -Original Message-
>>>>> From: Nagendra Kumar
>>>>> Sent: 10 September 2015 15:58
>>>>> To: Hans Nordeback; Praveen Malviya; gary@dektech.com.au
>>>>> Cc: opensaf-devel@lists.sourceforge.net
>>>>> Subject: Re: [devel] [PATCH 1 of 1] amfd: Don't send alarm SI has
>>>>> no current active assignments if node is locked V2 [#1465]
>>>>>
>>>>> Hi Hans N,
>>>>>
>>>>> I tested with combination of SU/Node lock/locked-in with pres state
>>>>> inst fail/term fail.
>>>>> So, when node is locked/locked-in, even if su goes into term fail,
>>>>> the alarm
>>> is
>>>>> not sent because the pres state becomes uninst before
>>>>> update_ass_state
>>> gets
>>>>> called. Hope this is ok.
>>>>>
>>>>> Ack with the comments inlined with [Nagu] and the documentation
>>>>> need
>>> to
>>>>> be updated as well.
>>>>>
>>>>>
>>>>> Thanks
>>>>> -Nagu
>>>>>> -Original Message-
>>>>>> From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
>>>>>> Sent: 04 September 2015 19:20
>>>>>> To: Praveen Malviya; Nagendra Kumar; gary@dektech.com.au
>>>>>> Cc: opensaf-devel@lists.sourceforge.net
>>>>>> Subject: [PATCH 1 of 1] amfd: Don't send alarm SI has no current
>>>>>> active assignments if node is locked V2 [#1465]
>>>>>>
>>>>>>osaf/services/saf/amf/amfd/include/si.h |   2 ++
>>>>>>osaf/services/saf/amf/amfd/si.cc|  23 +++
>>>>>>osaf/services/saf/amf/amfd/siass.cc |   3 +++
>>>>>>3 files changed, 24 insertions(+), 4 deletions(-)
>>>>>>
>>>>>>
>>>>>> diff --git a/osaf/services/saf/amf/amfd/include/si.h
>>>>>> b/osaf/services/saf/amf/amfd/include/si.h
>>>>>> --- a/osaf/services/saf/amf/amfd/include/si.h
>>>>>> +++ b/osaf/services/saf/amf/amfd/include/si.h
>>>>>> @@ -109,6 +109,8 @@ public:
>>>>>>
>>>>>>  bool alarm_sent; /* SI unassigned alarm has been sent */
>>>>>>
>>>>>> +struct avd_avnd_tag *si_on_node;/*  the node on which 
>>>>>> this SI
>>>>>> resides */
>>>>>> +AVD_SU *curr_su;/* The SU with the 
>>>>>> latest
>>>>> assignment*/
>>>>>>  void inc_c

Re: [devel] [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]

2015-09-09 Thread Hans Nordebäck
see comment below/Thanks HansN

On 09/09/2015 01:53 PM, Nagendra Kumar wrote:
> Thanks for the clarification, few more needed, please check below.
>
>> -Original Message-----
>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
>> Sent: 09 September 2015 17:09
>> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
>>
>> Hi Nagu,
>>
>> please see my comment inlined with [HansN] /Thanks HansN
>>
>> On 09/09/2015 01:13 PM, Nagendra Kumar wrote:
>>> Please check my comment below
>>>
>>> Thanks
>>> -Nagu
>>>> -Original Message-
>>>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
>>>> Sent: 09 September 2015 15:59
>>>> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
>>>> Cc: opensaf-devel@lists.sourceforge.net
>>>> Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
>>>>
>>>> Hi Nagu,
>>>>
>>>> please see comment inlined with [HansN] /Thanks HansN
>>>>
>>>> On 09/09/2015 11:58 AM, Nagendra Kumar wrote:
>>>>> Please find comment inlined with [Nagu].
>>>>>
>>>>> Thanks
>>>>> -Nagu
>>>>>> -Original Message-
>>>>>> From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
>>>>>> Sent: 14 August 2015 20:20
>>>>>> To: Praveen Malviya; Nagendra Kumar; gary@dektech.com.au
>>>>>> Cc: opensaf-devel@lists.sourceforge.net
>>>>>> Subject: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
>>>>>>
>>>>>> osaf/services/saf/amf/amfd/include/su.h  |3 +-
>>>>>> osaf/services/saf/amf/amfd/include/sutcomptype.h |2 +-
>>>>>> osaf/services/saf/amf/amfd/include/sutype.h  |   24 +++-
>>>>>> osaf/services/saf/amf/amfd/sgtype.cc |2 +-
>>>>>> osaf/services/saf/amf/amfd/su.cc |6 +-
>>>>>> osaf/services/saf/amf/amfd/sutcomptype.cc|2 +-
>>>>>> osaf/services/saf/amf/amfd/sutype.cc |  108 
>>>>>> +---
>> --
>>>>>> 7 files changed, 70 insertions(+), 77 deletions(-)
>>>>>>
>>>>>>
>>>>>> diff --git a/osaf/services/saf/amf/amfd/include/su.h
>>>>>> b/osaf/services/saf/amf/amfd/include/su.h
>>>>>> --- a/osaf/services/saf/amf/amfd/include/su.h
>>>>>> +++ b/osaf/services/saf/amf/amfd/include/su.h
>>>>>> @@ -35,6 +35,7 @@
>>>>>> #include "include/db_template.h"
>>>>>>
>>>>>> class AVD_SG;
>>>>>> +class AVD_SUTYPE;
>>>>>>
>>>>>> /**
>>>>>>  * AMF director Service Unit representation.
>>>>>> @@ -94,7 +95,7 @@ class AVD_SU {
>>>>>>
>>>>>>  AVD_SU *sg_list_su_next;/* the next SU in the SG */
>>>>>>  AVD_SU *avnd_list_su_next;  /* the next SU in the AvND */
>>>>>> -struct avd_sutype *su_type;
>>>>>> +AVD_SUTYPE *su_type;
>>>>>>  AVD_SU *su_list_su_type_next;
>>>>>>
>>>>>>  void set_su_failover(bool value);
>>>>>> diff --git a/osaf/services/saf/amf/amfd/include/sutcomptype.h
>>>>>> b/osaf/services/saf/amf/amfd/include/sutcomptype.h
>>>>>> --- a/osaf/services/saf/amf/amfd/include/sutcomptype.h
>>>>>> +++ b/osaf/services/saf/amf/amfd/include/sutcomptype.h
>>>>>> @@ -36,7 +36,7 @@ typedef struct {
>>>>>> } AVD_SUTCOMP_TYPE;
>>>>>> extern AmfDb<std::string, AVD_SUTCOMP_TYPE> *sutcomptype_db;
>>>>>>
>>>>>> -SaAisErrorT avd_sutcomptype_config_get(SaNameT *sutype_name,
>> struct
>>>>>> avd_sutype *sut);
>>>>>> +SaAisErrorT avd_sutcomptype_config_get(SaNameT *sutype_name,
>>>>>> AVD_SUTYPE *sut);
>>>>>> void avd_sutcomptype_constructor(void);
>>>>>>
>>>>>> #endif
>>>>>> diff --git a/osaf/services/saf/amf/amfd/include/sutype.h
>>>>

Re: [devel] [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]

2015-09-09 Thread Hans Nordebäck
Hi Nagu,

please see my comment inlined with [HansN] /Thanks HansN

On 09/09/2015 01:13 PM, Nagendra Kumar wrote:
> Please check my comment below
>
> Thanks
> -Nagu
>> -Original Message-----
>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
>> Sent: 09 September 2015 15:59
>> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
>>
>> Hi Nagu,
>>
>> please see comment inlined with [HansN] /Thanks HansN
>>
>> On 09/09/2015 11:58 AM, Nagendra Kumar wrote:
>>> Please find comment inlined with [Nagu].
>>>
>>> Thanks
>>> -Nagu
>>>> -Original Message-
>>>> From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
>>>> Sent: 14 August 2015 20:20
>>>> To: Praveen Malviya; Nagendra Kumar; gary@dektech.com.au
>>>> Cc: opensaf-devel@lists.sourceforge.net
>>>> Subject: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
>>>>
>>>>osaf/services/saf/amf/amfd/include/su.h  |3 +-
>>>>osaf/services/saf/amf/amfd/include/sutcomptype.h |2 +-
>>>>osaf/services/saf/amf/amfd/include/sutype.h  |   24 +++-
>>>>osaf/services/saf/amf/amfd/sgtype.cc |2 +-
>>>>osaf/services/saf/amf/amfd/su.cc |6 +-
>>>>osaf/services/saf/amf/amfd/sutcomptype.cc|2 +-
>>>>osaf/services/saf/amf/amfd/sutype.cc |  108 
>>>> +-
>>>>7 files changed, 70 insertions(+), 77 deletions(-)
>>>>
>>>>
>>>> diff --git a/osaf/services/saf/amf/amfd/include/su.h
>>>> b/osaf/services/saf/amf/amfd/include/su.h
>>>> --- a/osaf/services/saf/amf/amfd/include/su.h
>>>> +++ b/osaf/services/saf/amf/amfd/include/su.h
>>>> @@ -35,6 +35,7 @@
>>>>#include "include/db_template.h"
>>>>
>>>>class AVD_SG;
>>>> +class AVD_SUTYPE;
>>>>
>>>>/**
>>>> * AMF director Service Unit representation.
>>>> @@ -94,7 +95,7 @@ class AVD_SU {
>>>>
>>>>AVD_SU *sg_list_su_next;/* the next SU in the SG */
>>>>AVD_SU *avnd_list_su_next;  /* the next SU in the AvND */
>>>> -  struct avd_sutype *su_type;
>>>> +  AVD_SUTYPE *su_type;
>>>>AVD_SU *su_list_su_type_next;
>>>>
>>>>void set_su_failover(bool value);
>>>> diff --git a/osaf/services/saf/amf/amfd/include/sutcomptype.h
>>>> b/osaf/services/saf/amf/amfd/include/sutcomptype.h
>>>> --- a/osaf/services/saf/amf/amfd/include/sutcomptype.h
>>>> +++ b/osaf/services/saf/amf/amfd/include/sutcomptype.h
>>>> @@ -36,7 +36,7 @@ typedef struct {
>>>>} AVD_SUTCOMP_TYPE;
>>>>extern AmfDb<std::string, AVD_SUTCOMP_TYPE> *sutcomptype_db;
>>>>
>>>> -SaAisErrorT avd_sutcomptype_config_get(SaNameT *sutype_name, struct
>>>> avd_sutype *sut);
>>>> +SaAisErrorT avd_sutcomptype_config_get(SaNameT *sutype_name,
>>>> AVD_SUTYPE *sut);
>>>>void avd_sutcomptype_constructor(void);
>>>>
>>>>#endif
>>>> diff --git a/osaf/services/saf/amf/amfd/include/sutype.h
>>>> b/osaf/services/saf/amf/amfd/include/sutype.h
>>>> --- a/osaf/services/saf/amf/amfd/include/sutype.h
>>>> +++ b/osaf/services/saf/amf/amfd/include/sutype.h
>>>> @@ -20,16 +20,24 @@
>>>>
>>>>#include 
>>>>#include 
>>>> +#include 
>>>>
>>>> -struct avd_sutype {
>>>> -  SaNameT name;
>>>> -  SaUint32T saAmfSutIsExternal;
>>>> -  SaUint32T saAmfSutDefSUFailover;
>>>> -  SaNameT *saAmfSutProvidesSvcTypes; /* array of DNs, size in
>>>> number_svc_types */
>>>> -  unsigned int number_svc_types;  /* size of array
>>>> saAmfSutProvidesSvcTypes */
>>>> -  AVD_SU *list_of_su;
>>>> +class AVD_SUTYPE {
>>>> + public:
>>>> +  explicit AVD_SUTYPE(const SaNameT *dn);
>>>> +  SaNameT name {};
>>>> +  SaUint32T saAmfSutIsExternal {};
>>>> +  SaUint32T saAmfSutDefSUFailover {};
>>>> +  SaNameT *saAmfSutProvidesSvcTypes {}; /* array of DNs, size in
>>>> number_svc_types */
>>&g

Re: [devel] [PATCH 07 of 10] amfd: Make AVD_AMF_SG_TYPE a class [#1142]

2015-09-09 Thread Hans Nordebäck
Hi Nagu,

please see comment inlined with [HansN]/Thanks HansN

On 09/09/2015 11:17 AM, Nagendra Kumar wrote:
> Please find comment inlined with [Nagu].
>
> Thanks
> -Nagu
>> -Original Message-
>> From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
>> Sent: 14 August 2015 20:20
>> To: Praveen Malviya; Nagendra Kumar; gary@dektech.com.au
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: [PATCH 07 of 10] amfd: Make AVD_AMF_SG_TYPE a class [#1142]
>>
>>   osaf/services/saf/amf/amfd/include/sg.h |   3 +-
>>   osaf/services/saf/amf/amfd/include/sgtype.h |  39 -
>>   osaf/services/saf/amf/amfd/sg.cc|   1 -
>>   osaf/services/saf/amf/amfd/sgtype.cc|  84 
>> +++-
>>   4 files changed, 59 insertions(+), 68 deletions(-)
>>
>>
>> diff --git a/osaf/services/saf/amf/amfd/include/sg.h
>> b/osaf/services/saf/amf/amfd/include/sg.h
>> --- a/osaf/services/saf/amf/amfd/include/sg.h
>> +++ b/osaf/services/saf/amf/amfd/include/sg.h
>> @@ -192,8 +192,7 @@ public:
>>  SaInvocationT adminOp_invocationId;
>>  SaAmfAdminOperationIdT adminOp;
>>
>> -AVD_SG *sg_list_sg_type_next;
>> -struct avd_amf_sg_type_tag *sg_type;
>> +AVD_AMF_SG_TYPE *sg_type;
>>  AVD_SG *sg_list_app_next;
>>  AVD_APP *app;
>>  bool equal_ranked_su; /* This flag is set when ranks of all SU is the
>> same.
>> diff --git a/osaf/services/saf/amf/amfd/include/sgtype.h
>> b/osaf/services/saf/amf/amfd/include/sgtype.h
>> --- a/osaf/services/saf/amf/amfd/include/sgtype.h
>> +++ b/osaf/services/saf/amf/amfd/include/sgtype.h
>> @@ -27,28 +27,37 @@
>>
>>   #include 
>>   #include 
>> +#include 
>>
>>   class AVD_SG;
>>
>> -typedef struct avd_amf_sg_type_tag {
>> -SaNameT name;
>> -bool saAmfSgtDefAutoRepair_configured; /* True when user
>> configures saAmfSGDefAutoRepair else false */
>> +class AVD_AMF_SG_TYPE {
>> + public:
>> +  explicit AVD_AMF_SG_TYPE(const SaNameT *dn);
>> +  SaNameT name {};
>> +  bool saAmfSgtDefAutoRepair_configured {}; /* True when user configures
>> saAmfSGDefAutoRepair else false */
>>  / B.04 model
>> */
>> -SaNameT *saAmfSGtValidSuTypes;  /* array of DNs, size in
>> number_su_type */
>> -SaAmfRedundancyModelT saAmfSgtRedundancyModel;
>> -SaBoolT saAmfSgtDefAutoRepair;
>> -SaBoolT saAmfSgtDefAutoAdjust;
>> -SaTimeT saAmfSgtDefAutoAdjustProb;
>> -SaTimeT saAmfSgtDefCompRestartProb;
>> -SaUint32T saAmfSgtDefCompRestartMax;
>> -SaTimeT saAmfSgtDefSuRestartProb;
>> -SaUint32T saAmfSgtDefSuRestartMax;
>> +  SaNameT *saAmfSGtValidSuTypes {}; /* array of DNs, size in
>> number_su_type */
>> +  SaAmfRedundancyModelT saAmfSgtRedundancyModel {};
>> +  SaBoolT saAmfSgtDefAutoRepair {};
>> +  SaBoolT saAmfSgtDefAutoAdjust {};
>> +  SaTimeT saAmfSgtDefAutoAdjustProb {};
>> +  SaTimeT saAmfSgtDefCompRestartProb {};
>> +  SaUint32T saAmfSgtDefCompRestartMax {};
>> +  SaTimeT saAmfSgtDefSuRestartProb {};
>> +  SaUint32T saAmfSgtDefSuRestartMax {};
>>  / B.04 model
>> */
>>
>> -uint32_t number_su_type;/* size of array saAmfSGtValidSuTypes
>> */
>> -AVD_SG *list_of_sg;
>> +  uint32_t number_su_type {};   /* size of array saAmfSGtValidSuTypes */
>> +  std::vector list_of_sg {};
>> + private:
>> +  AVD_AMF_SG_TYPE();
>> +  void initialize();
>> +  // disallow copy and assign
>> +  AVD_AMF_SG_TYPE(const AVD_AMF_SG_TYPE&);
>> +  void operator=(const AVD_AMF_SG_TYPE&);
>>
>> -} AVD_AMF_SG_TYPE;
>> +};
>>
>>   extern AmfDb *sgtype_db;
>>   SaAisErrorT avd_sgtype_config_get(void);
>> diff --git a/osaf/services/saf/amf/amfd/sg.cc
>> b/osaf/services/saf/amf/amfd/sg.cc
>> --- a/osaf/services/saf/amf/amfd/sg.cc
>> +++ b/osaf/services/saf/amf/amfd/sg.cc
>> @@ -119,7 +119,6 @@ AVD_SG::AVD_SG():
>>  sg_redundancy_model(SA_AMF_NO_REDUNDANCY_MODEL),
>>  list_of_su(NULL),
>>  list_of_si(NULL),
>> -sg_list_sg_type_next(NULL),
>>  sg_type(NULL),
>>  sg_list_app_next(NULL),
>>  app(NULL),
>> diff --git a/osaf/services/saf/amf/amfd/sgtype.cc
>> b/osaf/services/saf/amf/amfd/sgtype.cc
>> --- a/osaf/services/saf/amf/amfd/sgtype.cc
>> +++ b/osaf/services/saf/amf/amfd/sgtype.cc
>> @@ -26,42 +26,27 @@
>>   #include 
>>   #include 
>>   #include 
>> +#include 
>>
>>   AmfDb *sgtype_db = NULL;
>>
>>   void avd_sgtype_add_sg(AVD_SG *sg)
>>   {
>> -sg->sg_list_sg_type_next = sg->sg_type->list_of_sg;
>> -sg->sg_type->list_of_sg = sg;
>> +sg->sg_type->list_of_sg.push_back(sg);
> [Nagu]: Though order doesn't matter here, push_back add in the end. Is this 
> reason to use push_back?
[HansN] list_of_sg is a std::vector, there is no push_front on std::vector.
>
>>   }
>>
>> -void avd_sgtype_remove_sg(AVD_SG *sg)
>> 

Re: [devel] [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]

2015-09-09 Thread Hans Nordebäck
Hi Nagu,
please see comment below./Thanks HansN

On 09/09/2015 02:10 PM, Nagendra Kumar wrote:
> Please find my comment below:
>
>> -Original Message-----
>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
>> Sent: 09 September 2015 17:26
>> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
>>
>> see comment below/Thanks HansN
>>
>> On 09/09/2015 01:53 PM, Nagendra Kumar wrote:
>>> Thanks for the clarification, few more needed, please check below.
>>>
>>>> -Original Message-
>>>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
>>>> Sent: 09 September 2015 17:09
>>>> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
>>>> Cc: opensaf-devel@lists.sourceforge.net
>>>> Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
>>>>
>>>> Hi Nagu,
>>>>
>>>> please see my comment inlined with [HansN] /Thanks HansN
>>>>
>>>> On 09/09/2015 01:13 PM, Nagendra Kumar wrote:
>>>>> Please check my comment below
>>>>>
>>>>> Thanks
>>>>> -Nagu
>>>>>> -Original Message-
>>>>>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
>>>>>> Sent: 09 September 2015 15:59
>>>>>> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
>>>>>> Cc: opensaf-devel@lists.sourceforge.net
>>>>>> Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
>>>>>>
>>>>>> Hi Nagu,
>>>>>>
>>>>>> please see comment inlined with [HansN] /Thanks HansN
>>>>>>
>>>>>> On 09/09/2015 11:58 AM, Nagendra Kumar wrote:
>>>>>>> Please find comment inlined with [Nagu].
>>>>>>>
>>>>>>> Thanks
>>>>>>> -Nagu
>>>>>>>> -Original Message-
>>>>>>>> From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
>>>>>>>> Sent: 14 August 2015 20:20
>>>>>>>> To: Praveen Malviya; Nagendra Kumar; gary@dektech.com.au
>>>>>>>> Cc: opensaf-devel@lists.sourceforge.net
>>>>>>>> Subject: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
>>>>>>>>
>>>>>>>>  osaf/services/saf/amf/amfd/include/su.h  |3 +-
>>>>>>>>  osaf/services/saf/amf/amfd/include/sutcomptype.h |2 +-
>>>>>>>>  osaf/services/saf/amf/amfd/include/sutype.h  |   24 +++-
>>>>>>>>  osaf/services/saf/amf/amfd/sgtype.cc |2 +-
>>>>>>>>  osaf/services/saf/amf/amfd/su.cc |6 +-
>>>>>>>>  osaf/services/saf/amf/amfd/sutcomptype.cc|2 +-
>>>>>>>>  osaf/services/saf/amf/amfd/sutype.cc |  108 
>>>>>>>> +---
>> 
>>>> --
>>>>>>>>  7 files changed, 70 insertions(+), 77 deletions(-)
>>>>>>>>
>>>>>>>>
>>>>>>>> diff --git a/osaf/services/saf/amf/amfd/include/su.h
>>>>>>>> b/osaf/services/saf/amf/amfd/include/su.h
>>>>>>>> --- a/osaf/services/saf/amf/amfd/include/su.h
>>>>>>>> +++ b/osaf/services/saf/amf/amfd/include/su.h
>>>>>>>> @@ -35,6 +35,7 @@
>>>>>>>>  #include "include/db_template.h"
>>>>>>>>
>>>>>>>>  class AVD_SG;
>>>>>>>> +class AVD_SUTYPE;
>>>>>>>>
>>>>>>>>  /**
>>>>>>>>   * AMF director Service Unit representation.
>>>>>>>> @@ -94,7 +95,7 @@ class AVD_SU {
>>>>>>>>
>>>>>>>>AVD_SU *sg_list_su_next;/* the next SU in the SG */
>>>>>>>>AVD_SU *avnd_list_su_next;  /* the next SU in the AvND */
>>>>>>>> -  struct avd_sutype *su_type;
>>>>>>>> +  AVD_SUTYPE *su_type;
>>>>>>>>AVD_SU *su_list_su_type_next;
>>>>>>>>
>>>&

Re: [devel] [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]

2015-09-09 Thread Hans Nordebäck

Hi Nagu,

I wrote a small test program that you can try to explore how 
std::erase/std::remove operates. /Thanks HansN



On 09/09/2015 03:15 PM, Hans Nordebäck wrote:

Hi Nagu,
please see comment below./Thanks HansN

On 09/09/2015 02:10 PM, Nagendra Kumar wrote:

Please find my comment below:


-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
Sent: 09 September 2015 17:26
To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]

see comment below/Thanks HansN

On 09/09/2015 01:53 PM, Nagendra Kumar wrote:

Thanks for the clarification, few more needed, please check below.


-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
Sent: 09 September 2015 17:09
To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]

Hi Nagu,

please see my comment inlined with [HansN] /Thanks HansN

On 09/09/2015 01:13 PM, Nagendra Kumar wrote:

Please check my comment below

Thanks
-Nagu

-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
Sent: 09 September 2015 15:59
To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]

Hi Nagu,

please see comment inlined with [HansN] /Thanks HansN

On 09/09/2015 11:58 AM, Nagendra Kumar wrote:

Please find comment inlined with [Nagu].

Thanks
-Nagu

-Original Message-
From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
Sent: 14 August 2015 20:20
To: Praveen Malviya; Nagendra Kumar; gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]

osaf/services/saf/amf/amfd/include/su.h |3 +-
osaf/services/saf/amf/amfd/include/sutcomptype.h |2 +-
osaf/services/saf/amf/amfd/include/sutype.h |   24 +++-
osaf/services/saf/amf/amfd/sgtype.cc |2 +-
osaf/services/saf/amf/amfd/su.cc |6 +-
osaf/services/saf/amf/amfd/sutcomptype.cc |2 +-
osaf/services/saf/amf/amfd/sutype.cc |  108 +---



--

 7 files changed, 70 insertions(+), 77 deletions(-)


diff --git a/osaf/services/saf/amf/amfd/include/su.h
b/osaf/services/saf/amf/amfd/include/su.h
--- a/osaf/services/saf/amf/amfd/include/su.h
+++ b/osaf/services/saf/amf/amfd/include/su.h
@@ -35,6 +35,7 @@
 #include "include/db_template.h"

 class AVD_SG;
+class AVD_SUTYPE;

 /**
  * AMF director Service Unit representation.
@@ -94,7 +95,7 @@ class AVD_SU {

 AVD_SU *sg_list_su_next;/* the next SU in the SG */
 AVD_SU *avnd_list_su_next;/* the next SU in the 
AvND */

-struct avd_sutype *su_type;
+AVD_SUTYPE *su_type;
 AVD_SU *su_list_su_type_next;

 void set_su_failover(bool value); diff --git
a/osaf/services/saf/amf/amfd/include/sutcomptype.h
b/osaf/services/saf/amf/amfd/include/sutcomptype.h
--- a/osaf/services/saf/amf/amfd/include/sutcomptype.h
+++ b/osaf/services/saf/amf/amfd/include/sutcomptype.h
@@ -36,7 +36,7 @@ typedef struct {
 } AVD_SUTCOMP_TYPE;
 extern AmfDb<std::string, AVD_SUTCOMP_TYPE> *sutcomptype_db;

-SaAisErrorT avd_sutcomptype_config_get(SaNameT *sutype_name,

struct

avd_sutype *sut);
+SaAisErrorT avd_sutcomptype_config_get(SaNameT *sutype_name,
AVD_SUTYPE *sut);
 void avd_sutcomptype_constructor(void);

 #endif
diff --git a/osaf/services/saf/amf/amfd/include/sutype.h
b/osaf/services/saf/amf/amfd/include/sutype.h
--- a/osaf/services/saf/amf/amfd/include/sutype.h
+++ b/osaf/services/saf/amf/amfd/include/sutype.h
@@ -20,16 +20,24 @@

 #include 
 #include 
+#include 

-struct avd_sutype {
-SaNameT name;
-SaUint32T saAmfSutIsExternal;
-SaUint32T saAmfSutDefSUFailover;
-SaNameT *saAmfSutProvidesSvcTypes; /* array of DNs, size in
number_svc_types */
-unsigned int number_svc_types;/* size of array
saAmfSutProvidesSvcTypes */
-AVD_SU *list_of_su;
+class AVD_SUTYPE {
+ public:
+  explicit AVD_SUTYPE(const SaNameT *dn);
+  SaNameT name {};
+  SaUint32T saAmfSutIsExternal {};
+  SaUint32T saAmfSutDefSUFailover {};
+  SaNameT *saAmfSutProvidesSvcTypes {}; /* array of DNs, size in
number_svc_types */
+  unsigned int number_svc_types {};/* size of array
saAmfSutProvidesSvcTypes */
+  std::vector<AVD_SU*> list_of_su {};
+ private:
+  AVD_SUTYPE();
+  // disallow copy and assign
+  AVD_SUTYPE(const AVD_SUTYPE&);  void operator=(const
+ AVD_SUTYPE&);
 };
-extern AmfDb<std::string, avd_sutype> *sutype_db;
+extern AmfDb<std::string, AVD_SUTYPE> *sutype_db;

 /**
  * Get SaAmfSUType from IMM and create internal objects diff
--git a/osaf/services/saf/amf/amfd/sgtype.cc
b/osaf/services/saf/amf/amfd/sgtype.cc
--- a/osaf/services/saf/amf/

Re: [devel] [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]

2015-09-09 Thread Hans Nordebäck
Good, so it is ack for the whole series, 0-10? /Thanks HansN

-Original Message-
From: Nagendra Kumar [mailto:nagendr...@oracle.com] 
Sent: den 9 september 2015 15:44
To: Hans Nordebäck; Praveen Malviya; Gary Lee
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]

Little confusing, but Ok :)

Thanks
-Nagu
> -Original Message-
> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
> Sent: 09 September 2015 18:45
> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
> 
> Hi Nagu,
> please see comment below./Thanks HansN
> 
> On 09/09/2015 02:10 PM, Nagendra Kumar wrote:
> > Please find my comment below:
> >
> >> -Original Message-
> >> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
> >> Sent: 09 September 2015 17:26
> >> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
> >> Cc: opensaf-devel@lists.sourceforge.net
> >> Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class [#1142]
> >>
> >> see comment below/Thanks HansN
> >>
> >> On 09/09/2015 01:53 PM, Nagendra Kumar wrote:
> >>> Thanks for the clarification, few more needed, please check below.
> >>>
> >>>> -Original Message-
> >>>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
> >>>> Sent: 09 September 2015 17:09
> >>>> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
> >>>> Cc: opensaf-devel@lists.sourceforge.net
> >>>> Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class 
> >>>> [#1142]
> >>>>
> >>>> Hi Nagu,
> >>>>
> >>>> please see my comment inlined with [HansN] /Thanks HansN
> >>>>
> >>>> On 09/09/2015 01:13 PM, Nagendra Kumar wrote:
> >>>>> Please check my comment below
> >>>>>
> >>>>> Thanks
> >>>>> -Nagu
> >>>>>> -Original Message-
> >>>>>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
> >>>>>> Sent: 09 September 2015 15:59
> >>>>>> To: Nagendra Kumar; Praveen Malviya; gary@dektech.com.au
> >>>>>> Cc: opensaf-devel@lists.sourceforge.net
> >>>>>> Subject: Re: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class 
> >>>>>> [#1142]
> >>>>>>
> >>>>>> Hi Nagu,
> >>>>>>
> >>>>>> please see comment inlined with [HansN] /Thanks HansN
> >>>>>>
> >>>>>> On 09/09/2015 11:58 AM, Nagendra Kumar wrote:
> >>>>>>> Please find comment inlined with [Nagu].
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>> -Nagu
> >>>>>>>> -Original Message-
> >>>>>>>> From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
> >>>>>>>> Sent: 14 August 2015 20:20
> >>>>>>>> To: Praveen Malviya; Nagendra Kumar; gary@dektech.com.au
> >>>>>>>> Cc: opensaf-devel@lists.sourceforge.net
> >>>>>>>> Subject: [PATCH 10 of 10] amfd: Make AVD_SUTYPE a class 
> >>>>>>>> [#1142]
> >>>>>>>>
> >>>>>>>>  osaf/services/saf/amf/amfd/include/su.h  |3 +-
> >>>>>>>>  osaf/services/saf/amf/amfd/include/sutcomptype.h |2 +-
> >>>>>>>>  osaf/services/saf/amf/amfd/include/sutype.h  |   24 +++-
> >>>>>>>>  osaf/services/saf/amf/amfd/sgtype.cc |2 +-
> >>>>>>>>  osaf/services/saf/amf/amfd/su.cc |6 +-
> >>>>>>>>  osaf/services/saf/amf/amfd/sutcomptype.cc|2 +-
> >>>>>>>>  osaf/services/saf/amf/amfd/sutype.cc |  108 
> >>>>>>>> +---
> 
> >> 
> >>>> --
> >>>>>>>>  7 files changed, 70 insertions(+), 77 deletions(-)
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> diff --git a/osaf/services/saf/amf/amfd/include/su.h
> >>>>>>>> b/osaf/services/saf/amf/

Re: [devel] [PATCH 1 of 1] amfd: update pure runtime attributes only in IMM callbacks [#185]

2015-08-28 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: Gary Lee [mailto:gary@dektech.com.au] 
Sent: den 14 augusti 2015 07:56
To: nagendr...@oracle.com; Hans Nordebäck; praveen.malv...@oracle.com; Gary Lee
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: update pure runtime attributes only in IMM 
callbacks [#185]

 osaf/services/saf/amf/amfd/ndproc.cc |  6 --
 1 files changed, 0 insertions(+), 6 deletions(-)


We should only update pure runtime attributes when IMM calls 
saImmOiRtAttrUpdateCallback

diff --git a/osaf/services/saf/amf/amfd/ndproc.cc 
b/osaf/services/saf/amf/amfd/ndproc.cc
--- a/osaf/services/saf/amf/amfd/ndproc.cc
+++ b/osaf/services/saf/amf/amfd/ndproc.cc
@@ -694,9 +694,6 @@
l_val = *((uint32_t 
*)n2d_msg-msg_info.n2d_data_req.param_info.value[0]);
comp-saAmfCompRestartCount = 
ntohl(l_val);
m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(cb, 
comp, AVSV_CKPT_COMP_RESTART_COUNT);
-   
avd_saImmOiRtObjectUpdate(comp-comp_info.name,
- 
const_castSaImmAttrNameT(saAmfCompRestartCount), SA_IMM_ATTR_SAUINT32T,
- 
comp-saAmfCompRestartCount);
} else {
/* log error that a the  value len is 
invalid */
LOG_ER(%s:%u: %u, __FILE__, __LINE__, 
n2d_msg-msg_info.n2d_data_req.param_info.
@@ -714,9 +711,6 @@
(char 
*)n2d_msg-msg_info.n2d_data_req.param_info.value,
SA_MAX_NAME_LENGTH - 1);
m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(cb, 
comp, AVSV_CKPT_COMP_CURR_PROXY_NAME);
-   
avd_saImmOiRtObjectUpdate(comp-comp_info.name,
- 
const_castSaImmAttrNameT(saAmfCompCurrProxyName), SA_IMM_ATTR_SANAMET,
- 
comp-saAmfCompCurrProxyName);
} else {
/* log error that a the  value len is 
invalid */
LOG_ER(%s:%u: %u, __FILE__, __LINE__, 
n2d_msg-msg_info.n2d_data_req.param_info.

--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: maintain runtime updates for su, comp, si and csi at standby [#1141]

2015-08-27 Thread Hans Nordebäck
Hi Praveen,

I forgot one question, is it correct that the standby amfd also updates imm? 
/Thanks HansN

-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] 
Sent: den 10 augusti 2015 09:01
To: praveen.malv...@oracle.com; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [devel] [PATCH 1 of 1] amfd: maintain runtime updates for su, 
comp, si and csi at standby [#1141]

Ack, code review only, with one comment below/Thanks HansN



-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 31 juli 2015 14:35
To: Hans Nordebäck; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: maintain runtime updates for su, comp, si and csi 
at standby [#1141]

 osaf/services/saf/amf/amfd/ckpt_dec.cc   |  10 ++
 osaf/services/saf/amf/amfd/csi.cc|   3 -
 osaf/services/saf/amf/amfd/imm.cc|  53 +--
 osaf/services/saf/amf/amfd/include/imm.h |   2 +
 osaf/services/saf/amf/amfd/siass.cc  |   9 -
 5 files changed, 61 insertions(+), 16 deletions(-)


Amfd was killed when lock operation on su was going on.
After successful failover, susi of locked su is still shown.

In the reported issue, lock operation was successful and active AMFD was able 
to delete SUSIs and COMPCSIs in its database before got killed. AMFD was killed 
when it was performing run time updates for su, comp, si and csi to imm.
SUSI and COMPCSI of locked Su is still shown because active AMFD was killed 
without performing all the updates and since these updates are not maintained 
at standby AMFD, even after failover imm was not updated for the same.

Patch proposes a solution, in which standby AMFD will maintain run time updates 
for su, comp, si and csi. However the size of the job queue will not execeed 
more that 200. Job queue will be emptied iat standby if it crosses this max 
size limit. The value of 200 is taken from the reproted issue in which AMFD 
missed around 150 updates to imm for comp, su, csi and csi during failover.

TODO:
This solution has following limitations:
1)Fix size(200) of job queue at standby.
2)Standby maintains updates for only su,comp, csi and si.
3)New active may still miss some updates if updates are more than 200.

Improved solution will be something like this:
1)Standby AMFD will maintain updates for all the classes and with no size 
limitation.
2)Whenever active controller is finished updating to imm and there are no more 
jobs to update, it will ask standby AMFD to flush its job queue.

Implementaion of this will require new messaging (AMFD version update) and thus 
will be backward incompatible.

diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
b/osaf/services/saf/amf/amfd/ckpt_dec.cc
--- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
+++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
@@ -1372,6 +1372,8 @@ static uint32_t dec_su_admin_state(AVD_C
 
cb-async_updt_cnt.su_updt++;
 
+   avd_saImmOiRtObjectUpdate(su-name, saAmfSUAdminState,
+   SA_IMM_ATTR_SAUINT32T, su-saAmfSUAdminState);
TRACE_LEAVE2('%s', saAmfSUAdminState=%u, su_updt:%d,
name.value, su-saAmfSUAdminState, cb-async_updt_cnt.su_updt);
return NCSCC_RC_SUCCESS;
@@ -1403,6 +1405,8 @@ static uint32_t dec_su_readiness_state(A
 
cb-async_updt_cnt.su_updt++;
 
+   avd_saImmOiRtObjectUpdate(su-name, saAmfSUReadinessState,
+   SA_IMM_ATTR_SAUINT32T, su-saAmfSuReadinessState);
TRACE_LEAVE2('%s', saAmfSuReadinessState=%u, su_updt:%d,
name.value, su-saAmfSuReadinessState, 
cb-async_updt_cnt.su_updt);
return NCSCC_RC_SUCCESS;
@@ -1434,6 +1438,8 @@ static uint32_t dec_su_pres_state(AVD_CL
 
cb-async_updt_cnt.su_updt++;
 
+   avd_saImmOiRtObjectUpdate(su-name, saAmfSUPresenceState,
+   SA_IMM_ATTR_SAUINT32T, su-saAmfSUPresenceState);
TRACE_LEAVE2('%s', saAmfSUPresenceState=%u, su_updt:%d,
name.value, su-saAmfSUPresenceState, 
cb-async_updt_cnt.su_updt);
return NCSCC_RC_SUCCESS;
@@ -2082,6 +2088,8 @@ static uint32_t dec_comp_readiness_state
 
cb-async_updt_cnt.comp_updt++;
 
+   avd_saImmOiRtObjectUpdate(comp_struct-comp_info.name, 
saAmfCompReadinessState,
+   SA_IMM_ATTR_SAUINT32T, comp_struct-saAmfCompReadinessState);
TRACE_LEAVE2(status '%u', status);
return status;
 }
@@ -2132,6 +2140,8 @@ static uint32_t dec_comp_pres_state(AVD_
comp_struct-saAmfCompPresenceState = comp_ptr-saAmfCompPresenceState;
 
cb-async_updt_cnt.comp_updt++;
+   avd_saImmOiRtObjectUpdate(comp_struct-comp_info.name, 
saAmfCompPresenceState,
+   SA_IMM_ATTR_SAUINT32T, comp_struct-saAmfCompPresenceState);
 
TRACE_LEAVE2(status '%u', status);
return status;
diff --git a/osaf/services/saf/amf/amfd/csi.cc 
b/osaf/services/saf/amf/amfd/csi.cc
--- a/osaf/services

Re: [devel] [PATCH 1 of 1] tools/safamf: improve amf command amf-find and amf-state [#113]

2015-08-27 Thread Hans Nordebäck
ack/Thanks HansN

On 07/28/2015 11:22 AM, praveen.malv...@oracle.com wrote:
   osaf/tools/scripts/amf-find  |  116 
 +-
   osaf/tools/scripts/amf-state |   68 -
   2 files changed, 136 insertions(+), 48 deletions(-)


 1)amf-find is enhanced to search with a parent/ancestor:

 usage: amf-find class name [ancestor DN]

  class name: app|comp|csi|csiass|node|sg|si|siass|su|
  
 |appbasetype|apptype|csbasetype|csiattr|cstype|cluster|
  
 |compbasetype|compcstype|compglobalattr|comptype|ctcstype|
  
 |hc|hctype|ng|nodeswbundle|sgbasetype|sgtype|sidep|sirankedsu|
  
 |subasetype|sutype|sutcomptype|sibasetype|sitype|sitypecstype
  ancestor DN: display objects of class name having DN as ancestor.

 For example to search for all components in the OpenSAF NoRed SG:
 $ amf-find comp safSg=NoRed,safApp=OpenSAF

 2)amf-state is enhanced to search with a parent/ancestor:

 usage: amf-state [class name [state name] [object/parent/ancestor DN]]

  Without any arguments AMF entities with questionable health is 
 displayed.
  class names: app|comp|csiass|node|sg|si|siass|su|ng
  state names: adm|all|ass|ha|har|oper|pres|readi
  object/parent/ancestor DN: display objects with DN as 
 ancestor/parent.

 For example to show all states for all comps in the OpenSAF 2N SG:
 $ amf-state comp all safSg=2N,safApp=OpenSAF

 Both the commands are backward compatible.

 diff --git a/osaf/tools/scripts/amf-find b/osaf/tools/scripts/amf-find
 --- a/osaf/tools/scripts/amf-find
 +++ b/osaf/tools/scripts/amf-find
 @@ -14,124 +14,148 @@
   # Author(s): Ericsson
   #
   
 -if [ $# -eq 0 ]; then
 - echo usage: `basename $0` app|comp|csi|csiass|node|sg|si|siass|su|
 - |appbasetype|apptype|csbasetype|csiattr|cstype|cluster|
 - |compbasetype|compcstype|compglobalattr|comptype|ctcstype|
 - |hc|hctype|ng|nodeswbundle|sgbasetype|sgtype|sidep|sirankedsu|
 - |subasetype|sutype|sutcomptype|sibasetype|sitype|sitypecstype
 +usage ()
 +{
 + echo 
 + echo usage: `basename $0` class name [ancestor DN]
 + echo 
 + echo   class name: app|comp|csi|csiass|node|sg|si|siass|su|
 + |appbasetype|apptype|csbasetype|csiattr|cstype|cluster|
 + 
 |compbasetype|compcstype|compglobalattr|comptype|ctcstype|
 + 
 |hc|hctype|ng|nodeswbundle|sgbasetype|sgtype|sidep|sirankedsu|
 + 
 |subasetype|sutype|sutcomptype|sibasetype|sitype|sitypecstype
 + echo   ancestor DN: display objects of class name having DN as 
 ancestor.
 +}
   
 - exit 1
 -fi
   
 +CLASSNAME=
 +ANCESTOR=$2
 +ANCESTOR_VALID=`immfind $2 2 /dev/null`
   case $1 in
   app)
 - immfind -c SaAmfApplication
 + CLASSNAME=SaAmfApplication
   ;;
   comp)
 - immfind -c SaAmfComp
 + CLASSNAME=SaAmfComp
   ;;
   csi)
 - immfind -c SaAmfCSI
 + CLASSNAME=SaAmfCSI
   ;;
   csiass)
 - immfind -c SaAmfCSIAssignment
 + CLASSNAME=SaAmfCSIAssignment
   ;;
   node)
 - immfind -c SaAmfNode
 + CLASSNAME=SaAmfNode
   ;;
   sg)
 - immfind -c SaAmfSG
 + CLASSNAME=SaAmfSG
   ;;
   si)
 - immfind -c SaAmfSI
 + CLASSNAME=SaAmfSI
   ;;
   siass)
 - immfind -c SaAmfSIAssignment
 + CLASSNAME=SaAmfSIAssignment
   ;;
   su)
 - immfind -c SaAmfSU
 + CLASSNAME=SaAmfSU
   ;;
   appbasetype)
 - immfind -c SaAmfAppBaseType
 + CLASSNAME=SaAmfAppBaseType
   ;;
   apptype)
 - immfind -c SaAmfAppType
 + CLASSNAME=SaAmfAppType
   ;;
   csbasetype)
 - immfind -c SaAmfCSBaseType
 + CLASSNAME=SaAmfCSBaseType
   ;;
   csiattr)
 - immfind -c SaAmfCSIAttribute
 + CLASSNAME=SaAmfCSIAttribute
   ;;
   cstype)
 - immfind -c SaAmfCSType
 + CLASSNAME=SaAmfCSType
   ;;
   cluster)
 - immfind -c SaAmfCluster
 + CLASSNAME=SaAmfCluster
   ;;
   compbasetype)
 - immfind -c SaAmfCompBaseType
 + CLASSNAME=SaAmfCompBaseType
   ;;
   compcstype)
 - immfind -c SaAmfCompCsType
 + CLASSNAME=SaAmfCompCsType
   ;;
   compglobalattr)
 - immfind -c SaAmfCompGlobalAttributes
 + CLASSNAME=SaAmfCompGlobalAttributes
   ;;
   comptype)
 - immfind -c SaAmfCompType
 + CLASSNAME=SaAmfCompType

Re: [devel] [PATCH 1 of 1] amfd: Convert AVD_AVND list_of_ncs_su and list_of_ncs_su to std::vector [#1142]

2015-08-26 Thread Hans Nordebäck
I added  my comments below.

/Thanks HansN

-Original Message-
From: Gary Lee [mailto:gary@dektech.com.au] 
Sent: den 26 augusti 2015 07:41
To: Hans Nordebäck; praveen.malv...@oracle.com; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1 of 1] amfd: Convert AVD_AVND list_of_ncs_su and 
list_of_ncs_su to std::vector [#1142]

ack (not tested) - two minor comments below.

On 21/08/15 23:22, Hans Nordeback wrote:
   osaf/services/saf/amf/amfd/ckpt_dec.cc   |2 +-
   osaf/services/saf/amf/amfd/clm.cc|   12 +-
   osaf/services/saf/amf/amfd/include/node.h|   27 +---
   osaf/services/saf/amf/amfd/include/su.h  |1 -
   osaf/services/saf/amf/amfd/main.cc   |3 +-
   osaf/services/saf/amf/amfd/ndfsm.cc  |   15 +-
   osaf/services/saf/amf/amfd/ndproc.cc |7 +-
   osaf/services/saf/amf/amfd/node.cc   |  161 
 +-
   osaf/services/saf/amf/amfd/nodegroup.cc  |   31 ++---
   osaf/services/saf/amf/amfd/nodeswbundle.cc   |5 +-
   osaf/services/saf/amf/amfd/role.cc   |6 +-
   osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   21 +--
   osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   27 +---
   osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   28 +---
   osaf/services/saf/amf/amfd/sg_nway_fsm.cc|   39 ++
   osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   25 +--
   osaf/services/saf/amf/amfd/sgproc.cc |   56 ++--
   osaf/services/saf/amf/amfd/su.cc |5 +-
   osaf/services/saf/amf/amfd/util.cc   |4 +-
   19 files changed, 152 insertions(+), 323 deletions(-)


 diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
 b/osaf/services/saf/amf/amfd/ckpt_dec.cc
 --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
 +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
 @@ -3043,7 +3043,7 @@ static uint32_t dec_ng_admin_state(AVD_C
   AVD_AVND *node = avd_node_get(*iter);
   AVD_SU *su = NULL;
   //If this node has any susi on it.
 - for (su = node-list_of_su; su; su = su-avnd_list_su_next)
 + for (const auto su : node-list_of_su)
   if (su-list_of_susi != NULL)
   break;
   if ((ng-saAmfNGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN)  
 (su != NULL))
 diff --git a/osaf/services/saf/amf/amfd/clm.cc 
 b/osaf/services/saf/amf/amfd/clm.cc
 --- a/osaf/services/saf/amf/amfd/clm.cc
 +++ b/osaf/services/saf/amf/amfd/clm.cc
 @@ -26,8 +26,6 @@ static SaVersionT clmVersion = { 'B', 4,
   
   static void clm_node_join_complete(AVD_AVND *node)
   {
 - AVD_SU *su;
 -
   TRACE_ENTER();
   /* For each of the SUs calculate the readiness state.
** call the SG FSM with the new readiness state.
 @@ -39,8 +37,7 @@ static void clm_node_join_complete(AVD_A
   }
   
   avd_node_oper_state_set(node, SA_AMF_OPERATIONAL_ENABLED);
 - su = node-list_of_su;
 - while (su != NULL) {
 + for (const auto su : node-list_of_su) {
   /* For non-preinstantiable SU unlock-inst will not lead to its 
 inst until unlock. */
   if ( su-saAmfSUPreInstantiable == false ) {
   /* Skip the instantiation. */
 @@ -68,8 +65,6 @@ static void clm_node_join_complete(AVD_A
   }
   }
   }
 - /* get the next SU on the node */
 - su = su-avnd_list_su_next;
   }
   
   node_reset_su_try_inst_counter(node);
 @@ -82,7 +77,6 @@ done:
   /* validating this node for a graceful exit */
   static void clm_node_exit_validate(AVD_AVND *node)
   {
 - AVD_SU *su;
   AVD_SU_SI_REL *susi;
   bool reject = false;
   SaAisErrorT rc = SA_AIS_OK;
 @@ -99,8 +93,7 @@ static void clm_node_exit_validate(AVD_A
   
   /* now go through each SU to determine whether
any SI assigned becomes unassigned due to node exit*/
 - su = node-list_of_su;
 - while (su != NULL) {
 + for (const auto su : node-list_of_su) {
   susi = su-list_of_susi;
   /* now evalutate each SI that is assigned to this SU */
   while (susi != NULL) {
 @@ -114,7 +107,6 @@ static void clm_node_exit_validate(AVD_A
   }
   susi = susi-su_next;
   }
 - su = su-avnd_list_su_next;
   }
   
   done:
 diff --git a/osaf/services/saf/amf/amfd/include/node.h 
 b/osaf/services/saf/amf/amfd/include/node.h
 --- a/osaf/services/saf/amf/amfd/include/node.h
 +++ b/osaf/services/saf/amf/amfd/include/node.h
 @@ -43,6 +43,7 @@
   #include timer.h
   #include db_template.h
   #include set
 +#include vector
   
   class AVD_SU;
   struct avd_cluster_tag;
 @@ -76,6 +77,8 @@ class AVD_AVND {
public:
 AVD_AVND();
 explicit AVD_AVND(const SaNameT* dn);
 +
 +  bool is_node_lock();
 SaNameT name; /* DN */
 char *node_name;/* RDN value

Re: [devel] [PATCH 0 of 1] Review Request for amfd: Add missing TRACE_LEAVE [#1142]

2015-08-11 Thread Hans Nordebäck
Hi, please ignore this patch, I´ll send out a version 2. /Thanks HansN

-Original Message-
From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com] 
Sent: den 11 augusti 2015 15:11
To: praveen.malv...@oracle.com; nagendr...@oracle.com; Gary Lee
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 0 of 1] Review Request for amfd: Add missing 
TRACE_LEAVE [#1142]

Summary: amfd: Add missing TRACE_LEAVE
Review request for Trac Ticket(s): #1142 Peer Reviewer(s): Nagu, Praveen, Gary 
Pull request to: 
Affected branch(es): default
Development branch: default


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


Comments (indicate scope for each y above):
-
 EXPLAIN/COMMENT THE PATCH SERIES HERE

changeset e8b2d797e92c98df5d65699b45af66e0c14f6b73
Author: Hans Nordeback hans.nordeb...@ericsson.com
Date:   Tue, 11 Aug 2015 15:05:16 +0200

amfd: Add missing TRACE_LEAVE [#1142]


Complete diffstat:
--
 osaf/services/saf/amf/amfd/app.cc|   1 +
 osaf/services/saf/amf/amfd/apptype.cc|   2 ++
 osaf/services/saf/amf/amfd/chkop.cc  |   2 ++
 osaf/services/saf/amf/amfd/ckpt_enc.cc   |   3 +++
 osaf/services/saf/amf/amfd/comp.cc   |   5 -
 osaf/services/saf/amf/amfd/compcstype.cc |   2 ++
 osaf/services/saf/amf/amfd/comptype.cc   |   1 +
 osaf/services/saf/amf/amfd/csi.cc|   2 ++
 osaf/services/saf/amf/amfd/cstype.cc |   1 +
 osaf/services/saf/amf/amfd/ctcstype.cc   |   1 +
 osaf/services/saf/amf/amfd/ndfsm.cc  |   2 ++
 osaf/services/saf/amf/amfd/ndmsg.cc  |   3 +++
 osaf/services/saf/amf/amfd/node.cc   |   1 +
 osaf/services/saf/amf/amfd/nodegroup.cc  |   2 ++
 osaf/services/saf/amf/amfd/ntf.cc|   6 ++
 osaf/services/saf/amf/amfd/sg.cc |   4 
 osaf/services/saf/amf/amfd/sgtype.cc |   1 +
 osaf/services/saf/amf/amfd/si.cc |   2 ++
 osaf/services/saf/amf/amfd/siass.cc  |   3 ++-
 osaf/services/saf/amf/amfd/su.cc |   2 ++
 osaf/services/saf/amf/amfd/sutcomptype.cc|   1 +
 osaf/services/saf/amf/amfd/sutype.cc |   2 ++
 osaf/services/saf/amf/amfd/svctypecstypes.cc |   1 +
 osaf/services/saf/amf/amfd/timer.cc  |   8 +++-
 osaf/services/saf/amf/amfd/util.cc   |  23 +--
 25 files changed, 76 insertions(+), 5 deletions(-)


Testing Commands:
-
 LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES


Testing, Expected Results:
--
 PASTE COMMAND OUTPUTS / TEST RESULTS


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 

Re: [devel] [PATCH 0 of 2] Review Request for amfd: make AVD_APP_TYPE AVD_COMPCS_TYPE a class, alternative V2 [#1142]

2015-08-10 Thread Hans Nordebäck
Hi Nagu, Praveen,

Is it ok if I push these two patches?/Thanks HansN

-Original Message-
From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com] 
Sent: den 7 augusti 2015 08:57
To: nagendr...@oracle.com; praveen.malv...@oracle.com; Gary Lee
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 0 of 2] Review Request for amfd: make AVD_APP_TYPE 
AVD_COMPCS_TYPE a class, alternative V2 [#1142]

Summary:amfd: make AVD_APP_TYPE and AVD_COMPCS_TYPE a class, alternative V2 
Review request for Trac Ticket(s): #1142 Peer Reviewer(s): Nagu, Praveen, Gary 
Pull request to: 
Affected branch(es): default
Development branch: default


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


Comments (indicate scope for each y above):
-
I send out an alterantive V2 that uses c++11 in-class initializer, it  makes 
the code cleaner.
  

changeset 9a8bf1040d878ed7035463750d39351d56bf9f62
Author: Hans Nordeback hans.nordeb...@ericsson.com
Date:   Fri, 07 Aug 2015 08:45:53 +0200

amfd: make AVD_APP_TYPE a class, alternative V2 Use C++11 in-class
initializers.

changeset feb86fb938a9b4b45c123e1dbb164a29d00c0fc3
Author: Hans Nordeback hans.nordeb...@ericsson.com
Date:   Fri, 07 Aug 2015 08:45:56 +0200

amfd: make AVD_COMPCS_TYPE a class, alternative V2 Use C++11 in-class
initializers.


Complete diffstat:
--
 osaf/services/saf/amf/amfd/apptype.cc|  16 ++--
 osaf/services/saf/amf/amfd/compcstype.cc |  23 ++-
 osaf/services/saf/amf/amfd/include/apptype.h |   6 +++---
 osaf/services/saf/amf/amfd/include/comp.h|  15 +++
 4 files changed, 18 insertions(+), 42 deletions(-)


Testing Commands:
-
 LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES


Testing, Expected Results:
--
 PASTE COMMAND OUTPUTS / TEST RESULTS


Conditions of Submission:
-
 HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
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 ~/.hgrc file (i.e. username, 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.



Re: [devel] [PATCH 1 of 1] amfd: maintain runtime updates for su, comp, si and csi at standby [#1141]

2015-08-10 Thread Hans Nordebäck
Ack, code review only, with one comment below/Thanks HansN



-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 31 juli 2015 14:35
To: Hans Nordebäck; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: maintain runtime updates for su, comp, si and csi 
at standby [#1141]

 osaf/services/saf/amf/amfd/ckpt_dec.cc   |  10 ++
 osaf/services/saf/amf/amfd/csi.cc|   3 -
 osaf/services/saf/amf/amfd/imm.cc|  53 +--
 osaf/services/saf/amf/amfd/include/imm.h |   2 +
 osaf/services/saf/amf/amfd/siass.cc  |   9 -
 5 files changed, 61 insertions(+), 16 deletions(-)


Amfd was killed when lock operation on su was going on.
After successful failover, susi of locked su is still shown.

In the reported issue, lock operation was successful and active AMFD was able 
to delete SUSIs and COMPCSIs in its database before got killed. AMFD was killed 
when it was performing run time updates for su, comp, si and csi to imm.
SUSI and COMPCSI of locked Su is still shown because active AMFD was killed 
without performing all the updates and since these updates are not maintained 
at standby AMFD, even after failover imm was not updated for the same.

Patch proposes a solution, in which standby AMFD will maintain run time updates 
for su, comp, si and csi. However the size of the job queue will not execeed 
more that 200. Job queue will be emptied iat standby if it crosses this max 
size limit. The value of 200 is taken from the reproted issue in which AMFD 
missed around 150 updates to imm for comp, su, csi and csi during failover.

TODO:
This solution has following limitations:
1)Fix size(200) of job queue at standby.
2)Standby maintains updates for only su,comp, csi and si.
3)New active may still miss some updates if updates are more than 200.

Improved solution will be something like this:
1)Standby AMFD will maintain updates for all the classes and with no size 
limitation.
2)Whenever active controller is finished updating to imm and there are no more 
jobs to update, it will ask standby AMFD to flush its job queue.

Implementaion of this will require new messaging (AMFD version update) and thus 
will be backward incompatible.

diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
b/osaf/services/saf/amf/amfd/ckpt_dec.cc
--- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
+++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
@@ -1372,6 +1372,8 @@ static uint32_t dec_su_admin_state(AVD_C
 
cb-async_updt_cnt.su_updt++;
 
+   avd_saImmOiRtObjectUpdate(su-name, saAmfSUAdminState,
+   SA_IMM_ATTR_SAUINT32T, su-saAmfSUAdminState);
TRACE_LEAVE2('%s', saAmfSUAdminState=%u, su_updt:%d,
name.value, su-saAmfSUAdminState, cb-async_updt_cnt.su_updt);
return NCSCC_RC_SUCCESS;
@@ -1403,6 +1405,8 @@ static uint32_t dec_su_readiness_state(A
 
cb-async_updt_cnt.su_updt++;
 
+   avd_saImmOiRtObjectUpdate(su-name, saAmfSUReadinessState,
+   SA_IMM_ATTR_SAUINT32T, su-saAmfSuReadinessState);
TRACE_LEAVE2('%s', saAmfSuReadinessState=%u, su_updt:%d,
name.value, su-saAmfSuReadinessState, 
cb-async_updt_cnt.su_updt);
return NCSCC_RC_SUCCESS;
@@ -1434,6 +1438,8 @@ static uint32_t dec_su_pres_state(AVD_CL
 
cb-async_updt_cnt.su_updt++;
 
+   avd_saImmOiRtObjectUpdate(su-name, saAmfSUPresenceState,
+   SA_IMM_ATTR_SAUINT32T, su-saAmfSUPresenceState);
TRACE_LEAVE2('%s', saAmfSUPresenceState=%u, su_updt:%d,
name.value, su-saAmfSUPresenceState, 
cb-async_updt_cnt.su_updt);
return NCSCC_RC_SUCCESS;
@@ -2082,6 +2088,8 @@ static uint32_t dec_comp_readiness_state
 
cb-async_updt_cnt.comp_updt++;
 
+   avd_saImmOiRtObjectUpdate(comp_struct-comp_info.name, 
saAmfCompReadinessState,
+   SA_IMM_ATTR_SAUINT32T, comp_struct-saAmfCompReadinessState);
TRACE_LEAVE2(status '%u', status);
return status;
 }
@@ -2132,6 +2140,8 @@ static uint32_t dec_comp_pres_state(AVD_
comp_struct-saAmfCompPresenceState = comp_ptr-saAmfCompPresenceState;
 
cb-async_updt_cnt.comp_updt++;
+   avd_saImmOiRtObjectUpdate(comp_struct-comp_info.name, 
saAmfCompPresenceState,
+   SA_IMM_ATTR_SAUINT32T, comp_struct-saAmfCompPresenceState);
 
TRACE_LEAVE2(status '%u', status);
return status;
diff --git a/osaf/services/saf/amf/amfd/csi.cc 
b/osaf/services/saf/amf/amfd/csi.cc
--- a/osaf/services/saf/amf/amfd/csi.cc
+++ b/osaf/services/saf/amf/amfd/csi.cc
@@ -1175,9 +1175,6 @@ static void avd_delete_csiassignment_fro  {
SaNameT dn; 
 
-   if (avd_cb-avail_state_avd != SA_AMF_HA_ACTIVE)
-   return;
-
avsv_create_association_class_dn(comp_dn, csi_dn, safCSIComp, dn);
TRACE(Deleting %s, dn.value);
 
diff --git a/osaf/services/saf/amf/amfd/imm.cc 
b/osaf/services/saf/amf/amfd/imm.cc

Re: [devel] [PATCH 00 of 10] Review Request for amfd: convert AVD_SG_OPER to std::list [#1142]

2015-08-07 Thread Hans Nordebäck
ack for the whole series, code review only. Minor comment, all patches 
must be applied to compile,
and a question in patch 04. Perhaps we can use c++11 nullptr instead of 
NULL for pointers? /Thanks HansN

On 07/29/2015 08:36 AM, Gary Lee wrote:
 Summary: amfd: convert AVD_SG_OPER to std::list [#1142]
 Review request for Trac Ticket(s): 1142
 Peer Reviewer(s): AMF devs
 Pull request to:
 Affected branch(es): default
 Development branch: default

 
 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


 Comments (indicate scope for each y above):
 -

 This patch series changes the SU operation list in SG,
 from a linked list to a std::list.

 changeset 4c13e78d84c2dcdd743bfa11ad9c7650bcbba953
 Author:   Gary Lee gary@dektech.com.au
 Date: Wed, 29 Jul 2015 15:06:48 +1000

   amfd: convert AVD_SG_OPER to std::list [#1142]

   also convert some a few functions to members of various SG classes

 changeset a08af7abbef8d33dc63f478c4aa412d95d7c1c87
 Author:   Gary Lee gary@dektech.com.au
 Date: Wed, 29 Jul 2015 15:07:26 +1000

   amfd: convert AVD_SG_OPER to std::list [#1142]

 changeset 2b18577c0302fa7b5002e6395643868c84b11a0b
 Author:   Gary Lee gary@dektech.com.au
 Date: Wed, 29 Jul 2015 15:07:31 +1000

   amfd: convert AVD_SG_OPER to std::list [#1142]

 changeset 1a7c86ed19d413f2b8c6dd9c20b56daee512d237
 Author:   Gary Lee gary@dektech.com.au
 Date: Wed, 29 Jul 2015 15:07:37 +1000

   amfd: convert AVD_SG_OPER to std::list [#1142]

 changeset c47cd3c39211a78c01a587df3a8547f5bade4228
 Author:   Gary Lee gary@dektech.com.au
 Date: Wed, 29 Jul 2015 15:07:41 +1000

   amfd: convert AVD_SG_OPER to std::list [#1142]

 changeset 78c4128642d8bb9aff797704f6db5c692438abcb
 Author:   Gary Lee gary@dektech.com.au
 Date: Wed, 29 Jul 2015 15:07:45 +1000

   amfd: convert AVD_SG_OPER to std::list [#1142]

 changeset b1ee03cf2250379f926af717c07c5a9c69e98a1a
 Author:   Gary Lee gary@dektech.com.au
 Date: Wed, 29 Jul 2015 15:07:49 +1000

   amfd: convert AVD_SG_OPER to std::list [#1142]

 changeset 150034cf79a7e323e9d5beea660203ba88a688ce
 Author:   Gary Lee gary@dektech.com.au
 Date: Wed, 29 Jul 2015 15:07:53 +1000

   amfd: convert AVD_SG_OPER to std::list [#1142]

 changeset b9371f3e64e20962aa1ba155bfa733ac565df5af
 Author:   Gary Lee gary@dektech.com.au
 Date: Wed, 29 Jul 2015 15:41:22 +1000

   amfd: convert AVD_SG_OPER to std::list [#1142]

 changeset d8ea22acb9c3bfadf44a2b1a522c228cf63071f0
 Author:   Gary Lee gary@dektech.com.au
 Date: Wed, 29 Jul 2015 15:41:39 +1000

   amfd: convert AVD_SG_OPER to std::list [#1142]


 Complete diffstat:
 --
   osaf/services/saf/amf/amfd/ckpt_enc.cc   |7 +---
   osaf/services/saf/amf/amfd/include/sg.h  |   27 +---
   osaf/services/saf/amf/amfd/sg.cc |   24 +-
   osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   99 
 +++---
   osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   45 
 -
   osaf/services/saf/amf/amfd/sg_npm_fsm.cc |  126 
 +-
   osaf/services/saf/amf/amfd/sg_nway_fsm.cc|  125 
 +-
   osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   48 
 +++-
   osaf/services/saf/amf/amfd/sgproc.cc |   90 
 ---
   osaf/services/saf/amf/amfd/si_dep.cc |4 +-
   10 files changed, 276 insertions(+), 319 deletions(-)


 Testing Commands:
 -
   LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES


 Testing, Expected Results:
 --
   PASTE COMMAND OUTPUTS / TEST RESULTS


 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 

Re: [devel] [PATCH 04 of 10] amfd: convert AVD_SG_OPER to std::list [#1142]

2015-08-07 Thread Hans Nordebäck
ack code review only, one question below, (I may have missed see the 
check). /Thanks HansN

On 07/29/2015 08:36 AM, Gary Lee wrote:
   osaf/services/saf/amf/amfd/sg_2n_fsm.cc |  99 
 +++-
   1 files changed, 47 insertions(+), 52 deletions(-)


 diff --git a/osaf/services/saf/amf/amfd/sg_2n_fsm.cc 
 b/osaf/services/saf/amf/amfd/sg_2n_fsm.cc
 --- a/osaf/services/saf/amf/amfd/sg_2n_fsm.cc
 +++ b/osaf/services/saf/amf/amfd/sg_2n_fsm.cc
 @@ -882,7 +882,7 @@
*/
   TRACE_ENTER2('%s', su-name.value);
   
 - if (su-sg_of_su-su_oper_list.su == su) {
 + if (in_su_oper_list(su)) {
   su_ha_state = avd_su_state_determine(su);
   if (su_ha_state == SA_AMF_HA_QUIESCED) {
   su-set_su_switch(AVSV_SI_TOGGLE_STABLE);
 @@ -946,7 +946,7 @@
* active all to the other SU.
*/
   
 - a_su = su-sg_of_su-su_oper_list.su;
 + a_su = su-sg_of_su-su_oper_list.front();
   a_su_ha_state = avd_su_state_determine(a_su);
   
   if ((a_su-su_switch == AVSV_SI_TOGGLE_SWITCH) 
 @@ -1002,7 +1002,7 @@
* having quiesced assigned state Change switch field 
 to false.
*/
   
 - a_su = su-sg_of_su-su_oper_list.su;
 + a_su = su-sg_of_su-su_oper_list.front();
[HansN] question, is it checked if su_oper_list is not empty when 
calling front()?
   a_su_ha_state = avd_su_state_determine(a_su);
   
   if ((a_su-su_switch == AVSV_SI_TOGGLE_SWITCH) 
 @@ -1535,10 +1535,8 @@
* from the operation list.
*/
   su-delete_all_susis();
 - while (su-sg_of_su-su_oper_list.su != 
 NULL) {
 - avd_sg_su_oper_list_del(cb, 
 su-sg_of_su-su_oper_list.su, false);
 - }
 -
 + su-sg_of_su-su_oper_list_clear();
 + 
   if ((l_su = avd_sg_2n_su_chose_asgn(cb, 
 su-sg_of_su)) == NULL) {
   /* all the assignments have 
 already been done in the SG. */
   m_AVD_SET_SG_FSM(cb, 
 (su-sg_of_su), AVD_SG_FSM_STABLE);
 @@ -1596,9 +1594,7 @@
* from the operation list.
*/
   su-delete_all_susis();
 - while 
 (su-sg_of_su-su_oper_list.su != NULL) {
 - 
 avd_sg_su_oper_list_del(cb, su-sg_of_su-su_oper_list.su, false);
 - }
 + 
 su-sg_of_su-su_oper_list_clear();
   
   if ((l_su = 
 avd_sg_2n_su_chose_asgn(cb, su-sg_of_su)) == NULL) {
   /* all the assignments 
 have already been done in the SG. */
 @@ -1632,9 +1628,7 @@
   }
   
   su-delete_all_susis();
 - while 
 (su-sg_of_su-su_oper_list.su != NULL) {
 - 
 avd_sg_su_oper_list_del(cb, su-sg_of_su-su_oper_list.su, false);
 - }
 + 
 su-sg_of_su-su_oper_list_clear();
   
   avd_sg_su_oper_list_add(cb, 
 o_su, false);
   }   /* if ((o_su-list_of_susi != 
 AVD_SU_SI_REL_NULL) 
 @@ -1643,9 +1637,7 @@
   
   /* no other SU has any assignments. */
   su-delete_all_susis();
 - while (su-sg_of_su-su_oper_list.su != 
 NULL) {
 - avd_sg_su_oper_list_del(cb, 
 su-sg_of_su-su_oper_list.su, false);
 - }
 + su-sg_of_su-su_oper_list_clear();
   
   if ((l_su = avd_sg_2n_su_chose_asgn(cb, 
 su-sg_of_su)) == NULL) {
   /* all the assignments have 
 already been done in the SG. */
 @@ -1756,7 +1748,7 @@
   /* All are assigned. Remove the SU from the 
 operation list. */
   avd_sg_su_oper_list_del(cb, su, false);
   
 - if (su-sg_of_su-su_oper_list.su == 

Re: [devel] [PATCH 1 of 1] amfd: do not create compcsi of dependent csis if sponosr csi is unassigned [#1333]

2015-07-24 Thread Hans Nordebäck
ack, one question, in the ticket you mention it can be solved without 
recursion in AVD_SI::add_csi_db, why choose the recursion
solution in verify_csi_deps_and_delete_invalid_compcsi()? /Thanks HansN

On 05/15/2015 05:26 AM, praveen.malv...@oracle.com wrote:
   osaf/services/saf/amf/amfd/sgproc.cc |  2 ++
   1 files changed, 2 insertions(+), 0 deletions(-)


 A 2N application was up on both the controllers. Application contains
 10 CSIs in a single SI with CSI dependency with multiple sponsors for some
 CSIs.While application was up on controllers, amfnd segfaults dDuring opensaf 
 shutdown.

 For the CSI4, CStype is safVersion=4.0.0,safCSType=AmfDemo1 and for the rest 
 of
 CSIs it is safVersion=4.0.0,safCSType=AmfDemo. Now CSI4 directly or indirectly
 acts as sponsor for CSI3, CSI6,CSI7,CSI8,CSI9 and CSI10. For CSI4 compcstype
 is not configured in the configuration. So AMF deletes compcsi for CSI3, but
 since there is chain of dependency, all other compcsi could not be deleted
 because logic of deleting COMPCSI 
 (verify_csi_deps_and_delete_invalid_compcsi()
 in sgproc.c in #687) assumes that a SI (like SG) keeps the list_of_csi in the 
 ascending
 order of csi rank. But CSIs in SI are arranged in descending order.
 Since some of the CSIs of higher rank remained unassigned, AMFND goes in loop
 to remove CSIs of higher rank when a CSIs of lower ranks are removed and it
 crashes while accessing some csi record for which remove_done() is already 
 called.


 Patch ensures that irrespective of order of CSIs in SI, compcsi of dependent
 CSIs are deleted if any sponsor is unassigned.

 diff --git a/osaf/services/saf/amf/amfd/sgproc.cc 
 b/osaf/services/saf/amf/amfd/sgproc.cc
 --- a/osaf/services/saf/amf/amfd/sgproc.cc
 +++ b/osaf/services/saf/amf/amfd/sgproc.cc
 @@ -63,6 +63,8 @@ static void verify_csi_deps_and_delete_i
   compcsi-csi-assign_flag = false;
   compcsi-comp-assign_flag = false;
   
 avd_compcsi_from_csi_and_susi_delete(susi, compcsi, true);
 + //Delete compcsi of dependents.
 + 
 verify_csi_deps_and_delete_invalid_compcsi(susi);
   break;
   }
   }

--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: act on dep SIs if tol timer expires during controller fail-over [#427]

2015-07-24 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 05/19/2015 12:06 PM, praveen.malv...@oracle.com wrote:
   osaf/services/saf/amf/amfd/include/cb.h |  14 
   osaf/services/saf/amf/amfd/include/si_dep.h |   1 +
   osaf/services/saf/amf/amfd/main.cc  |   4 +-
   osaf/services/saf/amf/amfd/role.cc  |  28 +
   osaf/services/saf/amf/amfd/si_dep.cc|  90 
 
   5 files changed, 121 insertions(+), 16 deletions(-)


 Bring a 2N configuration with two SIs such that SI dep configured between 
 them with finite
 tolerance time. When tolerance timer is running, director component should be 
 killed such
 that standby should not become active before tolerance timer expiry.

 In this case, situation is active controller is going to reboot and standby 
 controller
 has not taken the active role, at this time tolerance timer expires.Standby 
 controller
 does not act on it (there is no handler registered for this).After standby 
 becomes active,
 it will not have any clue for tolerance timer expiry and thus it will never 
 assign dependents.
 Note in this particular case application is not hosted on the controllers, it 
 it were
 so nodefailover of active controller will take care of tol timer expiry.


 Patch ensures that standby controller should monitor SIs after there 
 tolerance timer
 expiry by keeping such a SIs in the list.SIs from this list will be deleted 
 if active
 controller check points a new si dep state after taking action on them or if 
 active
 controller fails without taking any action and standby takes action after 
 becoming
 active.

 diff --git a/osaf/services/saf/amf/amfd/include/cb.h 
 b/osaf/services/saf/amf/amfd/include/cb.h
 --- a/osaf/services/saf/amf/amfd/include/cb.h
 +++ b/osaf/services/saf/amf/amfd/include/cb.h
 @@ -44,6 +44,8 @@
   #include ckpt.h
   #include timer.h
   
 +#include list
 +class AVD_SI;
   struct avd_avnd_tag;
   
   typedef enum {
 @@ -223,6 +225,18 @@ typedef struct cl_cb_tag {
*/
   bool active_services_exist;
   
 + /*
 + A list of those SIs for which SI dep tolerance timer is running.
 + This is required because during controller switch-over or fail-over
 + active controller may not take action if tolerance timer expires and
 + controller itself is in role change phase. This list will help
 + standby controller to know for which SIs tolerance timer has expired
 + and active controller could not take the action. After becoming active
 + controller, SI dep action will be taken on the SIs in this list and in
 + TOLERANCE_TIMER_RUNNING state.
 +  */
 + std::listAVD_SI* sis_in_Tolerance_Timer_state;
 +
   } AVD_CL_CB;
   
   /* macro to push the ND msg in the queue (to the end of the list) */
 diff --git a/osaf/services/saf/amf/amfd/include/si_dep.h 
 b/osaf/services/saf/amf/amfd/include/si_dep.h
 --- a/osaf/services/saf/amf/amfd/include/si_dep.h
 +++ b/osaf/services/saf/amf/amfd/include/si_dep.h
 @@ -94,4 +94,5 @@ extern void sidep_update_dependents_stat
   extern void sidep_process_ready_to_unassign_depstate(AVD_SI *dep_si);
   extern void avd_sidep_sg_take_action(AVD_SG *sg);
   extern void get_dependent_si_list(SaNameT spons_si_name, 
 std::listAVD_SI* depsi_list);
 +extern void avd_sidep_activ_amfd_tol_timer_expiry(AVD_SI *spons_si, AVD_SI 
 *dep_si);
   #endif
 diff --git a/osaf/services/saf/amf/amfd/main.cc 
 b/osaf/services/saf/amf/amfd/main.cc
 --- a/osaf/services/saf/amf/amfd/main.cc
 +++ b/osaf/services/saf/amf/amfd/main.cc
 @@ -143,7 +143,7 @@ static const AVD_EVT_HDLR g_stndby_list[
   /* standby AvD timer events processing */
   avd_tmr_snd_hb_evh,   /* AVD_EVT_TMR_SND_HB */
   standby_invalid_evh,  /* AVD_EVT_TMR_CL_INIT */
 - standby_invalid_evh,  /* AVD_EVT_TMR_SI_DEP_TOL */
 + avd_sidep_tol_tmr_evh,  /* AVD_EVT_TMR_SI_DEP_TOL */
   
   /* standby AvD MDS events processing */
   avd_mds_avd_up_evh,   /* AVD_EVT_MDS_AVD_UP */
 @@ -181,7 +181,7 @@ static const AVD_EVT_HDLR g_quiesc_list[
   /* active AvD timer events processing */
   avd_tmr_snd_hb_evh, /* AVD_EVT_TMR_SND_HB */
   qsd_ignore_evh, /* AVD_EVT_TMR_CL_INIT */
 - qsd_ignore_evh, /* AVD_EVT_TMR_SI_DEP_TOL */
 + avd_sidep_tol_tmr_evh,  /* AVD_EVT_TMR_SI_DEP_TOL */
   
   /* active AvD MDS events processing */
   avd_mds_avd_up_evh, /* AVD_EVT_MDS_AVD_UP */
 diff --git a/osaf/services/saf/amf/amfd/role.cc 
 b/osaf/services/saf/amf/amfd/role.cc
 --- a/osaf/services/saf/amf/amfd/role.cc
 +++ b/osaf/services/saf/amf/amfd/role.cc
 @@ -231,6 +231,32 @@ done:
   return status;
   }
   
 +/**
 + * @brief  This function is related to SI dep feature and meant for a 
 dependent SIs.
 + * During contoller failover or switchover, tolerance timer may 
 expire for
 + * a dependent SIs. During the role change phase of controller 
 itself, active
 + *  controller may not act on the dependent SI 

Re: [devel] [PATCH 1 of 1] amfnd: wait for applcation exit during its termimation [#1375]

2015-06-17 Thread Hans Nordebäck
ack, code review and tested with amf demo app changed to delay exit at 
termination callback. /Thanks HansN

On 06/09/2015 03:47 PM, nagendr...@oracle.com wrote:
   osaf/services/saf/amf/amfnd/cbq.cc  |  31 
 +---
   osaf/services/saf/amf/amfnd/comp.cc |  14 ++-
   osaf/services/saf/amf/amfnd/err.cc  |  12 +
   osaf/services/saf/amf/amfnd/include/avnd_comp.h |   1 +
   4 files changed, 53 insertions(+), 5 deletions(-)


 During appl termination, amf issues instantiate cmd immediately after
 it receives appl termination resp. There is possibility that application
 may not have exited before Amf issues instantiate cmd and instantiate command
 may hang.
 So, Amf need to wait till appl exit after Amf receives termination response.
 If appl doesnot exit within termination cbk timeout, then Amf
 sends cleanup command.
 If there is some fault(like error report) happened after appl sends
 term resp and before application exits, Amf will take actions
 accordingly.

 diff --git a/osaf/services/saf/amf/amfnd/cbq.cc 
 b/osaf/services/saf/amf/amfnd/cbq.cc
 --- a/osaf/services/saf/amf/amfnd/cbq.cc
 +++ b/osaf/services/saf/amf/amfnd/cbq.cc
 @@ -376,10 +376,22 @@ uint32_t avnd_evt_ava_resp_evh(AVND_CB *
   m_AVND_COMP_TERM_FAIL_SET(comp);
   m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, comp, 
 AVND_CKPT_COMP_FLAG_CHANGE);
   }
 -
 - rc = avnd_comp_clc_fsm_run(cb, comp, (SA_AIS_OK == resp-err) ?
 -AVND_COMP_CLC_PRES_FSM_EV_TERM_SUCC 
 : AVND_COMP_CLC_PRES_FSM_EV_CLEANUP);
 - avnd_comp_cbq_rec_pop_and_del(cb, comp, cbk_rec, false);
 + /* For successful response from (1.) Sa-Aware PI component, wait
 +for down event to come, don't run clc here, run clc when down
 +event comes. (2.) proxied PI, no down event
 +expected, so run clc here. In case of failure response from
 +any body, follow the clc. No need to check for PI along with
 +proxied, because in case of PI only, term response will come
 +back from component. */
 + if((SA_AIS_OK == resp-err)  
 (!m_AVND_COMP_TYPE_IS_PROXIED(comp)))  {
 + /* Save invocation value to delete cbq record when
 +down event comes. */
 + comp-term_cbq_inv_value = resp-inv;
 + } else {
 + rc = avnd_comp_clc_fsm_run(cb, comp, (SA_AIS_OK == 
 resp-err) ?
 + AVND_COMP_CLC_PRES_FSM_EV_TERM_SUCC : 
 AVND_COMP_CLC_PRES_FSM_EV_CLEANUP);
 + avnd_comp_cbq_rec_pop_and_del(cb, comp, cbk_rec, false);
 + }
   
   // if all OK send a response to the client
   if ((rc == NCSCC_RC_SUCCESS)  (resp-err == SA_AIS_OK)) {
 @@ -563,6 +575,17 @@ uint32_t avnd_evt_tmr_cbk_resp_evh(AVND_
   } else if (AVSV_AMF_COMP_TERM == rec-cbk_info-type) {
   m_AVND_COMP_TERM_FAIL_SET(rec-comp);
   m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, rec-comp, 
 AVND_CKPT_COMP_FLAG_CHANGE);
 + if (rec-comp-term_cbq_inv_value != 0) {
 + AVND_COMP_CBK *cbk_rec;
 + /* Since, the cbq timer has expired and no down event
 +came, get the matching entry from the cbk list and
 +delete the cbq. */
 + m_AVND_COMP_CBQ_INV_GET(rec-comp, 
 rec-comp-term_cbq_inv_value, cbk_rec);
 + rec-comp-term_cbq_inv_value = 0;
 + if (cbk_rec) {
 + avnd_comp_cbq_rec_pop_and_del(cb, rec-comp, 
 cbk_rec, false);
 + }
 + }
   rc = avnd_comp_clc_fsm_run(cb, rec-comp, 
 AVND_COMP_CLC_PRES_FSM_EV_CLEANUP);
   } else {
   switch (rec-cbk_info-type) {
 diff --git a/osaf/services/saf/amf/amfnd/comp.cc 
 b/osaf/services/saf/amf/amfnd/comp.cc
 --- a/osaf/services/saf/amf/amfnd/comp.cc
 +++ b/osaf/services/saf/amf/amfnd/comp.cc
 @@ -381,12 +381,24 @@ uint32_t avnd_evt_mds_ava_dn_evh(AVND_CB
   }   /* for */
   
   if (comp) {
 + if (comp-term_cbq_inv_value != 0) {
 + AVND_COMP_CBK *cbk_rec;
 + /* Amf was waiting for this down event. Get the matching
 +entry from the cbk list and delete the cbq */
 + m_AVND_COMP_CBQ_INV_GET(comp, comp-term_cbq_inv_value, 
 cbk_rec);
 + comp-term_cbq_inv_value = 0;
 + rc = avnd_comp_clc_fsm_run(cb, comp, 
 AVND_COMP_CLC_PRES_FSM_EV_TERM_SUCC);
 + if (cbk_rec)
 + avnd_comp_cbq_rec_pop_and_del(cb, comp, 
 cbk_rec, false);
 + goto done;
 + }
   /* found the 

Re: [devel] [PATCH 0 of 2] Review Request for Add unit test V2 [#1142]

2015-06-11 Thread Hans Nordebäck
Hi Mathi,

We would like to keep the directory structure as in the patch as the 
topdir/tests/ are used for function tests,
the unit tests should be placed at the respective service. 

/Thanks HansN

-Original Message-
From: Mathivanan Naickan Palanivelu [mailto:mathi.naic...@oracle.com] 
Sent: den 5 juni 2015 17:33
To: Hans Nordebäck
Cc: ramesh.bet...@oracle.com; opensaf-devel@lists.sourceforge.net; 
nagendr...@oracle.com; Anders Widell; praveen.malv...@oracle.com
Subject: Re: [PATCH 0 of 2] Review Request for Add unit test V2 [#1142]

I dont have other comments other than the below one.
Ack after the above comment is fixed.

Thanks,
Mathi.

- mathi.naic...@oracle.com wrote:

 Hi,
 
 A quick comment. The newly added
 tests(osaf/services/saf/amf/amfd/tests/)
 directory is not in accordance to the existing directory structure.
 
 Please move this new directory under the top level tests directory, 
 appropriately.
 say for example topdir/tests/amf.
 
 Will get back with additional comments if any by tomorrow.
 
 Thanks,
 Mathi.
 
 - hans.nordeb...@ericsson.com wrote:
 
  Summary: Add unit test V2
  Review request for Trac Ticket(s): #1142 Peer Reviewer(s): AndersW, 
  Nagu, Praveen, Mathi Pull request to:
  Affected branch(es): default
  Development branch: default
  
  
  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
  
  
  Comments (indicate scope for each y above):
  -
   EXPLAIN/COMMENT THE PATCH SERIES HERE
  
  changeset 5503b0cd1d267939d94345bd3d74a23411fe1bf9
  Author: Hans Nordeback hans.nordeb...@ericsson.com
  Date:   Fri, 29 May 2015 10:24:34 +0200
  
  amfd: Add support for google unit test framework V3 [#1142]
  
  As part of refactoring enable the use of google unit test
 framework.
  Updated
  with review comments
  
  changeset 9ec365f1941da5abfcb38208ccb8d4da3d22f9c8
  Author: Hans Nordeback hans.nordeb...@ericsson.com
  Date:   Fri, 29 May 2015 10:32:41 +0200
  
  core: Add unit test for sysf_ipc.c V2 [#1142]
  
  Additional unit test program for sysf_ipc as an example on how to 
  write unit
  tests on self contained components in openSAF. This is an exampled 
  that can
  be extended. Updated with review comments.
  
  
  Added Files:
  
   00-README.unittest
   osaf/libs/core/leap/tests/Makefile.am
   osaf/libs/core/leap/tests/test_sysf_ipc.cc
   osaf/services/saf/amf/amfd/tests/Makefile.am
   osaf/services/saf/amf/amfd/tests/test_amf_db.cc
  
  
  Complete diffstat:
  --
   00-README.unittest  |   28 ++
   configure.ac|2 +
   osaf/libs/core/leap/Makefile.am |2 +-
   osaf/libs/core/leap/tests/Makefile.am   |   50 +++
   osaf/libs/core/leap/tests/test_sysf_ipc.cc  |  331
  
   osaf/services/saf/amf/amfd/Makefile.am  |2 +-
   osaf/services/saf/amf/amfd/tests/Makefile.am|   51 +++
   osaf/services/saf/amf/amfd/tests/test_amf_db.cc |   61 
   8 files changed, 525 insertions(+), 2 deletions(-)
  
  
  Testing Commands:
  -
   LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES
  
  
  Testing, Expected Results:
  --
   PASTE COMMAND OUTPUTS / TEST RESULTS
  
  
  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

Re: [devel] [PATCH 1 of 1] amfd: dump ckpt counts and node groups in internal state file[#1142]

2015-06-10 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 06/10/2015 12:53 PM, praveen.malv...@oracle.com wrote:
   osaf/services/saf/amf/amfd/util.cc |  25 +
   1 files changed, 25 insertions(+), 0 deletions(-)


 diff --git a/osaf/services/saf/amf/amfd/util.cc 
 b/osaf/services/saf/amf/amfd/util.cc
 --- a/osaf/services/saf/amf/amfd/util.cc
 +++ b/osaf/services/saf/amf/amfd/util.cc
 @@ -1383,6 +1383,23 @@ int amfd_file_dump(const char *filename)
   fprintf(f,   peer_msg_fmt_ver: %d\n, avd_cb-peer_msg_fmt_ver);
   fprintf(f,   avd_peer_ver: %d\n, avd_cb-avd_peer_ver);
   
 + fprintf(f,CKPT update counts:\n);
 + fprintf(f,   cb_updt:%d\n,avd_cb-async_updt_cnt.cb_updt);
 + fprintf(f,   node_updt:%d\n,avd_cb-async_updt_cnt.node_updt);
 + fprintf(f,   app_updt:%d\n,avd_cb-async_updt_cnt.app_updt);
 + fprintf(f,   sg_updt:%d\n,avd_cb-async_updt_cnt.sg_updt);
 + fprintf(f,   su_updt:%d\n,avd_cb-async_updt_cnt.su_updt);
 + fprintf(f,   si_updt:%d\n,avd_cb-async_updt_cnt.si_updt);
 + fprintf(f,   
 sg_su_oprlist_updt:%d\n,avd_cb-async_updt_cnt.sg_su_oprlist_updt);
 + fprintf(f,   
 sg_admin_si_updt:%d\n,avd_cb-async_updt_cnt.sg_admin_si_updt);
 + fprintf(f,   siass_updt:%d\n,avd_cb-async_updt_cnt.siass_updt);
 + fprintf(f,   comp_updt:%d\n,avd_cb-async_updt_cnt.comp_updt);
 + fprintf(f,   csi_updt:%d\n,avd_cb-async_updt_cnt.csi_updt);
 + fprintf(f,   
 compcstype_updt:%d\n,avd_cb-async_updt_cnt.compcstype_updt);
 + fprintf(f,   si_trans_updt:%d\n,avd_cb-async_updt_cnt.si_trans_updt);
 + fprintf(f,   ng_updt:%d\n,avd_cb-async_updt_cnt.ng_updt);
 +
 +
   fprintf(f, nodes:\n);
   for (std::mapuint32_t, AVD_AVND *::const_iterator it = 
 node_id_db-begin();
   it != node_id_db-end(); it++) {
 @@ -1518,6 +1535,14 @@ int amfd_file_dump(const char *filename)
   fprintf(f, saAmfCompCurrProxyName: %s\n, 
 comp-saAmfCompCurrProxyName.value);
   }
   
 + fprintf(f, Node Groups:\n);
 + for (std::mapstd::string, AVD_AMF_NG*::const_iterator it = 
 nodegroup_db-begin();
 +it != nodegroup_db-end(); it++) {
 + AVD_AMF_NG *ng = it-second;
 + fprintf(f,   dn: %s\n, ng-name.value);
 + fprintf(f, saAmfNGAdminState: 
 %s\n,avd_adm_state_name[ng-saAmfNGAdminState]);
 + }
 +
   fclose(f);
   return 0;
   }


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 0 of 1] Review Request for amfd: Add support for google unit test framework V2 [#1142]

2015-05-29 Thread Hans Nordebäck
yes I agree it is better to download and build gtest yourself. I have 
incorporated your suggested changes,
it works fine. Is it ok to push these patches now?

/Thanks HansN

On 05/26/2015 02:59 PM, Anders Widell wrote:
 Ack (for both patches on this ticket), with some comments:

 * Boiler plates (licence  copyright) are missing in the new files
 * The README assumes the developer uses Ubuntu and has sudo rights 
 (root access). Instead, I think it would be better to describe how to 
 download the Google test framework from the web and build it. This 
 would work on any Linux distribution and does not require root access. 
 I.e. something like this:

 wget https://googletest.googlecode.com/files/gtest-1.7.0.zip
 unzip gtest-1.7.0.zip
 cd gtest-1.7.0
 ./configure
 make
 export GTEST_DIR=`pwd`

 * Based on the instructions above, we also need to add 
 -L$(GTEST_DIR)/lib to LDFLAGS in the Makefile, since libgtest.a is not 
 installed in /usr/lib
 * When I tested this on Ubuntu 15.04 and gtest 1.7.0, I had to do some 
 modifications to make it build successfully. The attached file shows 
 what I had to change to make it build (including the 
 -L$(GTEST_DIR)/lib mentioned above).

 / Anders W

 On 05/08/2015 10:11 AM, Hans Nordeback wrote:
 Summary: amfd: Add support for google unit test framework V2
 Review request for Trac Ticket(s): #1142
 Peer Reviewer(s): Praveen, Nagu, Mathi, AndersW
 Pull request to:
 Affected branch(es): default
 Development branch: default

 
 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


 Comments (indicate scope for each y above):
 -
   EXPLAIN/COMMENT THE PATCH SERIES HERE

 changeset 6be42cd2de89b3a8b8e282d35e996e947eedb564
 Author:Hans Nordeback hans.nordeb...@ericsson.com
 Date:Fri, 08 May 2015 10:08:19 +0200

 amfd: Add support for google unit test framework V2 [#1142]

 As part of refactoring enable the use of google unit test framework.


 Added Files:
 
   00-README.unittest
   osaf/services/saf/amf/amfd/tests/Makefile.am
   osaf/services/saf/amf/amfd/tests/test_amf_db.cc


 Complete diffstat:
 --
   00-README.unittest  |  32 
   configure.ac|   1 +
   osaf/services/saf/amf/amfd/Makefile.am  |   2 +-
   osaf/services/saf/amf/amfd/tests/Makefile.am|  50 
 +
   osaf/services/saf/amf/amfd/tests/test_amf_db.cc |  44 
 ++
   5 files changed, 128 insertions(+), 1 deletions(-)


 Testing Commands:
 -
   LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES


 Testing, Expected Results:
 --
   PASTE COMMAND OUTPUTS / TEST RESULTS


 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 

Re: [devel] [PATCH 0 of 1] Review Request for amfd: Add support for google unit test framework V2 [#1142]

2015-05-29 Thread Hans Nordebäck
Hi Nagu,

no problem, I'll wait. Do you want me to send out the latest patches 
updated with AndersW comments?
/Thanks HansN

On 05/29/2015 10:33 AM, Nagendra Kumar wrote:
 Hi Hans N,
   Sorry for late entry. Can you please hold on until next week, I 
 need to get some more familiarity.

 Thanks
 -Nagu

 -Original Message-
 From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
 Sent: 29 May 2015 13:40
 To: Anders Widell; Nagendra Kumar; Praveen Malviya; Mathivanan Naickan
 Palanivelu
 Cc: opensaf-devel@lists.sourceforge.net
 Subject: Re: [PATCH 0 of 1] Review Request for amfd: Add support for google
 unit test framework V2 [#1142]

 yes I agree it is better to download and build gtest yourself. I have
 incorporated your suggested changes, it works fine. Is it ok to push these
 patches now?

 /Thanks HansN

 On 05/26/2015 02:59 PM, Anders Widell wrote:
 Ack (for both patches on this ticket), with some comments:

 * Boiler plates (licence  copyright) are missing in the new files
 * The README assumes the developer uses Ubuntu and has sudo rights
 (root access). Instead, I think it would be better to describe how to
 download the Google test framework from the web and build it. This
 would work on any Linux distribution and does not require root access.
 I.e. something like this:

 wget https://googletest.googlecode.com/files/gtest-1.7.0.zip
 unzip gtest-1.7.0.zip
 cd gtest-1.7.0
 ./configure
 make
 export GTEST_DIR=`pwd`

 * Based on the instructions above, we also need to add
 -L$(GTEST_DIR)/lib to LDFLAGS in the Makefile, since libgtest.a is not
 installed in /usr/lib
 * When I tested this on Ubuntu 15.04 and gtest 1.7.0, I had to do some
 modifications to make it build successfully. The attached file shows
 what I had to change to make it build (including the
 -L$(GTEST_DIR)/lib mentioned above).

 / Anders W

 On 05/08/2015 10:11 AM, Hans Nordeback wrote:
 Summary: amfd: Add support for google unit test framework V2 Review
 request for Trac Ticket(s): #1142 Peer Reviewer(s): Praveen, Nagu,
 Mathi, AndersW Pull request to:
 Affected branch(es): default
 Development branch: default

 
 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


 Comments (indicate scope for each y above):
 -
EXPLAIN/COMMENT THE PATCH SERIES HERE

 changeset 6be42cd2de89b3a8b8e282d35e996e947eedb564
 Author:Hans Nordeback hans.nordeb...@ericsson.com
 Date:Fri, 08 May 2015 10:08:19 +0200

  amfd: Add support for google unit test framework V2 [#1142]

  As part of refactoring enable the use of google unit test framework.


 Added Files:
 
00-README.unittest
osaf/services/saf/amf/amfd/tests/Makefile.am
osaf/services/saf/amf/amfd/tests/test_amf_db.cc


 Complete diffstat:
 --
00-README.unittest  |  32 
configure.ac|   1 +
osaf/services/saf/amf/amfd/Makefile.am  |   2 +-
osaf/services/saf/amf/amfd/tests/Makefile.am|  50
 +
osaf/services/saf/amf/amfd/tests/test_amf_db.cc |  44
 ++
5 files changed, 128 insertions(+), 1 deletions(-)


 Testing Commands:
 -
LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES


 Testing, Expected Results:
 --
PASTE COMMAND OUTPUTS / TEST RESULTS


 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

Re: [devel] [PATCH 1 of 1] amfd: ignore invalid modification of saAmfSGMaxActiveSIsperSU/saAmfSGMaxStandbySIsperSU [#1361]

2015-05-26 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: nagendr...@oracle.com [mailto:nagendr...@oracle.com] 
Sent: den 21 maj 2015 09:21
To: Hans Nordebäck; praveen.malv...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: ignore invalid modification of 
saAmfSGMaxActiveSIsperSU/saAmfSGMaxStandbySIsperSU [#1361]

 osaf/services/saf/amf/amfd/sg.cc |  31 +--
 1 files changed, 25 insertions(+), 6 deletions(-)


saAmfSGMaxActiveSIsperSU is valid for NPM, N_WAY and N_WAY_ACTIVE and invalid 
for Nored and 2N. So, modification of this attribute for  Nored and 2N 
redudancy models should be ignored.

saAmfSGMaxStandbySIsperSU is valid for NPM and N_WAY and invalid for Nored, 2N 
and NwayAct. So, modification of this attribute for Nored, 2N and NwayAct 
redudancy models should be ignored.

diff --git a/osaf/services/saf/amf/amfd/sg.cc b/osaf/services/saf/amf/amfd/sg.cc
--- a/osaf/services/saf/amf/amfd/sg.cc
+++ b/osaf/services/saf/amf/amfd/sg.cc
@@ -919,15 +919,34 @@ static void ccb_apply_modify_hdlr(CcbUti
} else if (!strcmp(attribute-attrName, 
saAmfSGMaxActiveSIsperSU)) {
if (value_is_deleted)
sg-saAmfSGMaxActiveSIsperSU = -1;
-   else
-   sg-saAmfSGMaxActiveSIsperSU = 
*((SaUint32T *)value);
-   TRACE(Modified saAmfSGMaxActiveSIsperSU is 
'%u', sg-saAmfSGMaxActiveSIsperSU);
+   else {
+   if ((sg-sg_redundancy_model == 
SA_AMF_NPM_REDUNDANCY_MODEL) ||
+   
(sg-sg_redundancy_model == SA_AMF_N_WAY_REDUNDANCY_MODEL) ||
+   
(sg-sg_redundancy_model == SA_AMF_N_WAY_ACTIVE_REDUNDANCY_MODEL)) {
+   sg-saAmfSGMaxActiveSIsperSU = 
*((SaUint32T *)value);
+   TRACE(Modified 
saAmfSGMaxActiveSIsperSU is '%u',
+   
sg-saAmfSGMaxActiveSIsperSU);
+   } else {
+   LOG_NO('%s' attribute 
saAmfSGMaxActiveSIsperSU not modified,
+not valid for 
Nored/2N Redundancy models,
+   sg-name.value);
+   }
+   }
} else if (!strcmp(attribute-attrName, 
saAmfSGMaxStandbySIsperSU)) {
if (value_is_deleted)
sg-saAmfSGMaxStandbySIsperSU = -1;
-   else
-   sg-saAmfSGMaxStandbySIsperSU = 
*((SaUint32T *)value);
-   TRACE(Modified saAmfSGMaxStandbySIsperSU is 
'%u', sg-saAmfSGMaxStandbySIsperSU);
+   else {
+   if ((sg-sg_redundancy_model == 
SA_AMF_NPM_REDUNDANCY_MODEL) ||
+   
(sg-sg_redundancy_model == SA_AMF_N_WAY_REDUNDANCY_MODEL)) {
+   sg-saAmfSGMaxStandbySIsperSU = 
*((SaUint32T *)value);
+   TRACE(Modified 
saAmfSGMaxStandbySIsperSU is '%u',
+   
sg-saAmfSGMaxStandbySIsperSU);
+   } else {
+   LOG_NO('%s' attribute 
saAmfSGMaxStandbySIsperSU not modified,
+not valid for 
Nored/2N/NwayAct Redundancy models,
+   sg-name.value);
+   }
+   }
} else if (!strcmp(attribute-attrName, 
saAmfSGAutoAdjustProb)) {
if (value_is_deleted)
sg-saAmfSGAutoAdjustProb = 
sg_type-saAmfSgtDefAutoAdjustProb;

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 0 of 2] Review Request for fix validation of CtCsType [#1302]

2015-05-22 Thread Hans Nordebäck
ack for both patches, tested according to the steps mentioned in the 
ticket/ Thanks HansN


On 05/21/2015 03:06 PM, praveen.malv...@oracle.com wrote:
 Summary: fix validation of CtCsType [#1302]
 Review request for Trac Ticket(s):  #1302
 Peer Reviewer(s): Hans N., Nagendra
 Pull request to: LIST THE PERSON WITH PUSH ACCESS HERE
 Affected branch(es): ALL
 Development branch: IF ANY GIVE THE REPO URL

 
 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


 Comments (indicate scope for each y above):
 -
 Note: Patch series one patch (1 of 2) from #986. Patch is included for
 testing purpose and will not be pusdhed as part of #1302.
   
 changeset 3e62c8edc300a383f17f86c6eab2e6bc37d429ca
 Author:   praveen.malv...@oracle.com
 Date: Thu, 21 May 2015 18:29:51 +0530

   amfd: validate CSType when creating CtCsType [#986,#1302]

   Note: This patch 1 of 2 was floated by Hans F. against the ticket #986. 
 This
   patch will not be pushed as a part of #1302.

   AMF allows to create a SaAmfCtCsType object although the SaAmfCSType 
 object
   referred to does not exist.

   Fix by looking up the SaAmfCSType DN in the SaAmfCSType database.

   This patch will protect the creation of invalid SaAmfCtCsType and
   configuration will not be added into the system.

 changeset 4850674b73cd5267345d5676290a16aba214807f
 Author:   praveen.malv...@oracle.com
 Date: Thu, 21 May 2015 18:30:22 +0530

   amfd: validate ctcstype relationship while modifying comptype in comp
   [#1302]

   Before modifying compType attribute in a comp, one more check on the
   validity of SaAmfCtCsType is still required which means association 
 (object
   of SaAmfCtCsType) between this new comptype and cstype in 
 SaAmfCompCsType
   (in case such an object exists for this component) must also exists in 
 the
   system. If ctcstype does not exist then there will be problem in 
 deciding
   components capability for a given cstype. So reject the modify ccb if
   ctstype does not exist with any cstypes supported by this component via
   compcstype.

   Thus assert can be removed as patch 1 and patch 2 will not allow any 
 invalid
   configuration in the syste.


 Complete diffstat:
 --
   osaf/services/saf/amf/amfd/comp.cc|  32 
 
   osaf/services/saf/amf/amfd/ctcstype.cc|  34 
 ++
   osaf/services/saf/amf/amfd/imm.cc |   7 ---
   osaf/services/saf/amf/amfd/include/comp.h |   1 +
   osaf/services/saf/amf/amfd/include/util.h |   1 +
   osaf/services/saf/amf/amfd/util.cc|  46 
 +-
   6 files changed, 117 insertions(+), 4 deletions(-)


 Testing Commands:
 -
 Tested by trying to modify comptype in a component.

 Testing, Expected Results:
 --
 CCB is rejected if ctcstype calidation passes

 Conditions of Submission:
 -
 Ack from any reviewer

 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 

Re: [devel] [PATCH 0 of 1] Review Request for core: Add unit test for sysf_ipc.c [#1142]

2015-05-19 Thread Hans Nordebäck
Any comments on this patch?/Thanks HansN

-Original Message-
From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com] 
Sent: den 8 maj 2015 09:56
To: ramesh.bet...@oracle.com; mathi.naic...@oracle.com; Anders Widell
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 0 of 1] Review Request for core: Add unit test for 
sysf_ipc.c [#1142]

Summary: core: Add unit test for sysf_ipc.c Review request for Trac Ticket(s): 
#1142 Peer Reviewer(s): Ramesh, Mathi, AndersW Pull request to: 
Affected branch(es): default
Development branch: default


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesn
 OpenSAF servicesn
 Core libraries  y
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each y above):
-
 EXPLAIN/COMMENT THE PATCH SERIES HERE

changeset 63c242f7c7d007d907d0613b2d6a08f2a54e4d3f
Author: Hans Nordeback hans.nordeb...@ericsson.com
Date:   Fri, 08 May 2015 09:53:34 +0200

core: Add unit test for sysf_ipc.c [#1142]

Additional unit test program for sysf_ipc as an example on how to write 
unit
tests on self contained components in openSAF. This is an exampled that 
can
be extended.


Added Files:

 osaf/libs/core/leap/tests/Makefile.am
 osaf/libs/core/leap/tests/test_sysf_ipc.cc


Complete diffstat:
--
 configure.ac   |1 +
 osaf/libs/core/leap/Makefile.am|2 +-
 osaf/libs/core/leap/tests/Makefile.am  |   49 
 osaf/libs/core/leap/tests/test_sysf_ipc.cc |  315 +
 4 files changed, 366 insertions(+), 1 deletions(-)


Testing Commands:
-
 LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES


Testing, Expected Results:
--
 PASTE COMMAND OUTPUTS / TEST RESULTS


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 ~/.hgrc file (i.e. username, 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.


--
One dashboard for servers and applications across Physical-Virtual-Cloud Widest 

Re: [devel] [PATCH 0 of 1] Review Request for amfd: Add support for google unit test framework V2 [#1142]

2015-05-19 Thread Hans Nordebäck
Any comments on this patch?/Thanks HansN

-Original Message-
From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com] 
Sent: den 8 maj 2015 10:11
To: Anders Widell; nagendr...@oracle.com; praveen.malv...@oracle.com; 
mathi.naic...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 0 of 1] Review Request for amfd: Add support for google 
unit test framework V2 [#1142]

Summary: amfd: Add support for google unit test framework V2 Review request for 
Trac Ticket(s): #1142 Peer Reviewer(s): Praveen, Nagu, Mathi, AndersW Pull 
request to: 
Affected branch(es): default
Development branch: default


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


Comments (indicate scope for each y above):
-
 EXPLAIN/COMMENT THE PATCH SERIES HERE

changeset 6be42cd2de89b3a8b8e282d35e996e947eedb564
Author: Hans Nordeback hans.nordeb...@ericsson.com
Date:   Fri, 08 May 2015 10:08:19 +0200

amfd: Add support for google unit test framework V2 [#1142]

As part of refactoring enable the use of google unit test framework.


Added Files:

 00-README.unittest
 osaf/services/saf/amf/amfd/tests/Makefile.am
 osaf/services/saf/amf/amfd/tests/test_amf_db.cc


Complete diffstat:
--
 00-README.unittest  |  32 
 configure.ac|   1 +
 osaf/services/saf/amf/amfd/Makefile.am  |   2 +-
 osaf/services/saf/amf/amfd/tests/Makefile.am|  50 +
 osaf/services/saf/amf/amfd/tests/test_amf_db.cc |  44 ++
 5 files changed, 128 insertions(+), 1 deletions(-)


Testing Commands:
-
 LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES


Testing, Expected Results:
--
 PASTE COMMAND OUTPUTS / TEST RESULTS


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 ~/.hgrc file (i.e. username, 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.



Re: [devel] [PATCH 1 of 1] osaf: During adminrestart of node directors, before re-instantiating kill them [#1326]

2015-05-13 Thread Hans Nordebäck
Hi Mathi,

Ack, code review only. Just a few comments, there is no guarantee that killproc 
 delivering a sigterm  to the component will succed, i.e the
component may still be running afterwards.  When the component exits, mds sends 
an avaDown but the component has already been removed
from the cb-compdb, perhaps amf could keep track of when also the component 
has exit by using the avaDown messages and keep the 
component in the cb-compdb a bit longer? Or use some retry logic in the script 
around the killproc.

/Thanks HansN

-Original Message-
From: mathi.naic...@oracle.com [mailto:mathi.naic...@oracle.com] 
Sent: den 6 maj 2015 16:47
To: Anders Widell; ramesh.bet...@oracle.com; Hans Nordebäck; 
nagendr...@oracle.com; praveen.malv...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] osaf: During adminrestart of node directors, before 
re-instantiating kill them [#1326]

 osaf/services/saf/cpsv/cpnd/cpnd_amf.c  |  14 +-
 osaf/services/saf/cpsv/cpnd/scripts/osaf-ckptnd.in  |  13 +
 osaf/services/saf/glsv/glnd/glnd_amf.c  |  14 ++
 osaf/services/saf/glsv/glnd/scripts/osaf-lcknd.in   |  13 +
 osaf/services/saf/immsv/immnd/immnd_amf.c   |  11 +++
 osaf/services/saf/immsv/immnd/scripts/osaf-immnd.in |  18 ++
 osaf/services/saf/mqsv/mqnd/mqnd_amf.c  |  11 +++
 osaf/services/saf/mqsv/mqnd/scripts/osaf-msgnd.in   |  13 +
 osaf/services/saf/smfsv/smfnd/scripts/osaf-smfnd.in |  13 +
 osaf/services/saf/smfsv/smfnd/smfnd_amf.c   |  11 +++
 10 files changed, 130 insertions(+), 1 deletions(-)


The command $ amf-adm restart DN name is one way of administratively 
restarting an AMF component.
As apart of this admin operation, AMF sends the component terminate callback to 
the PI components. It is up to the component to release all its resources and 
respond to AMF the status of its self-termination before exiting (typically) 
the process itself.
After receiving the response from the component, AMF invokes the instantiation 
script of the component. During this time, it is possible that the previously 
running instance of the process (of this component) has not yet exited. This 
situation when there is already a running daemon/process and now a new 
instantiation is being attempted can cause the instantiation script to return 
failure.
This patch creates temporary term_state_file from inside the component 
terminate callback of the node directors.
In the instantiation scripts, a check is done to distinguish a a fresh 
instantiation versus an instantiation after a termination.
If the term_state_file exists then it means, its an instantiation after 
termination.
If so, just attempt to kill (using killproc) the process again before calling 
start_daemon.

Note: There has been mention of using start_daemon -f option which will create 
another copy of the daemon if the previous daemon is still running. Using this 
option may not be ideal for us as it can create any inconsistency between the 
two daemons when using any resources and also, there is no proof or 
documentation of start_daemon -f working successfully. This is even more 
significant given that some distros are really slow in becoming LSB compliant, 
particularly the start_daemon and the likes of it.

diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_amf.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_amf.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_amf.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_amf.c
@@ -35,7 +35,9 @@
 **/
 
 #include cpnd.h
+#include configmake.h
 
+static const char *term_state_file = PKGPIDDIR /osafckptnd_termstate;
 /
  * Name  : cpnd_saf_health_chk_callback
  *
@@ -232,13 +234,23 @@ void cpnd_amf_comp_terminate_callback(Sa
 {
CPND_CB *cb = NULL;
SaAisErrorT saErr = SA_AIS_OK;
+   int fd;
+   TRACE_ENTER();
 
-   TRACE_ENTER();
cb = ncshm_take_hdl(NCS_SERVICE_ID_CPND, gl_cpnd_cb_hdl);
if (cb == NULL) {
LOG_ER(cpnd cb take handle failed in amf term callback);
return;
}
+
+   fd = open(term_state_file, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
+
+   if (fd =0)
+   (void)close(fd);
+   else
+   LOG_NO(cannot create termstate file %s: %s,
+   term_state_file, strerror(errno));
+
saAmfResponse(cb-amf_hdl, invocation, saErr);
ncshm_give_hdl(gl_cpnd_cb_hdl);
LOG_NO(Received AMF component terminate callback, exiting); diff 
--git a/osaf/services/saf/cpsv/cpnd/scripts/osaf-ckptnd.in 
b/osaf/services/saf/cpsv/cpnd/scripts/osaf-ckptnd.in
--- a/osaf/services/saf/cpsv/cpnd/scripts/osaf-ckptnd.in
+++ b/osaf/services/saf/cpsv/cpnd/scripts/osaf-ckptnd.in

Re: [devel] [PATCH 1 of 1] amfd: avoid null pointer access [#1365]

2015-05-06 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 05/05/2015 12:55 PM, nagendr...@oracle.com wrote:
   osaf/services/saf/amf/amfd/role.cc |  3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)


 During node failover if node is not found at amfd,
 then my_node remains null and amfd access it in the end.
 It needs to avoided as amfd crashes.

 diff --git a/osaf/services/saf/amf/amfd/role.cc 
 b/osaf/services/saf/amf/amfd/role.cc
 --- a/osaf/services/saf/amf/amfd/role.cc
 +++ b/osaf/services/saf/amf/amfd/role.cc
 @@ -366,7 +366,8 @@ static uint32_t avd_role_failover(AVD_CL
   
   done:
   if (NCSCC_RC_SUCCESS != status)
 - opensaf_reboot(my_node-node_info.nodeId, (char 
 *)my_node-node_info.executionEnvironment.value,
 + opensaf_reboot(my_node != NULL ? my_node-node_info.nodeId : 0,
 + my_node != NULL ? (char 
 *)my_node-node_info.executionEnvironment.value : NULL,
   FAILOVER failed);
   
   


--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] nid: cleanup should generate a core dump V3 [#1300]

2015-05-06 Thread Hans Nordebäck
Hi Mathi,

is it ok to push this patch? I'll add the documentation AndersW 
mentioned. /Thanks HansN

On 05/06/2015 12:17 PM, Anders Widell wrote:
 Ack with minor comment: The documentation for the function 
 spawn_wait() should be updated to say that NCSCC_RC_REQ_TIMEOUT is a 
 possible return code.

 / Anders Widell

 On 04/30/2015 03:13 PM, Hans Nordeback wrote:
 osaf/services/infrastructure/nid/nodeinit.c |  56 
 +++-
   1 files changed, 29 insertions(+), 27 deletions(-)


 Generate core dump only at timeout

 diff --git a/osaf/services/infrastructure/nid/nodeinit.c 
 b/osaf/services/infrastructure/nid/nodeinit.c
 --- a/osaf/services/infrastructure/nid/nodeinit.c
 +++ b/osaf/services/infrastructure/nid/nodeinit.c
 @@ -106,8 +106,8 @@ static NID_APP_TYPE get_apptype(char *);
   static uint32_t get_spawn_info(char *, NID_SPAWN_INFO *, char *);
   static uint32_t parse_nodeinit_conf(char *strbuf);
   static uint32_t check_process(NID_SPAWN_INFO *service);
 -static void cleanup(NID_SPAWN_INFO *service);
 -static uint32_t recovery_action(NID_SPAWN_INFO *, char *);
 +static void cleanup(NID_SPAWN_INFO *service, int reason);
 +static uint32_t recovery_action(NID_SPAWN_INFO *, char *, int);
   static uint32_t spawn_services(char *);
   static void nid_sleep(uint32_t);
   @@ -989,7 +989,7 @@ uint32_t spawn_wait(NID_SPAWN_INFO *serv
   while ((n = osaf_poll_one_fd(select_fd, service-time_out * 
 10)) = 0) {
   if (n == 0) {
   LOG_ER(Timed-out for response from %s, 
 service-serv_name);
 -return NCSCC_RC_FAILURE;
 +return NCSCC_RC_REQ_TIMOUT;
   }
   break;
   }
 @@ -1151,7 +1151,7 @@ static pid_t get_pid_from_file(const cha
* Return Values : 
 NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.   *
 * *
 ***/
 -void cleanup(NID_SPAWN_INFO *service)
 +void cleanup(NID_SPAWN_INFO *service, int reason)
   {
   char strbuff[256];
   @@ -1168,27 +1168,29 @@ void cleanup(NID_SPAWN_INFO *service)
   const uint32_t MAX_NO_RETRIES = 5;
 // get pid of current service_name instead of the parent pid
 -pid = get_pid_from_file(service-serv_name);
 -if (pid  0) {
 -if (check_process(service)) {
 -// send abort signal to process to generate a core dump
 -LOG_ER(Sending SIGABRT to %s, pid=%d, (origin parent 
 pid=%d), service-serv_name, pid, service-pid);
 -if (kill(pid, SIGABRT) = 0) {
 -// wait a short period for process to exit
 -do {
 -w_pid = waitpid(service-pid, status, WNOHANG);
 -if (w_pid  0) {
 -if (errno == EINTR)
 -continue;
 -else
 -break;
 -} else if (w_pid  0) {
 -if (WIFEXITED(status) || WIFSIGNALED(status)) {
 -break;
 +if (reason == NCSCC_RC_REQ_TIMOUT) {
 +pid = get_pid_from_file(service-serv_name);
 +if (pid  0) {
 +if (check_process(service)) {
 +// send abort signal to process to generate a core dump
 +LOG_ER(Sending SIGABRT to %s, pid=%d, (origin 
 parent pid=%d), service-serv_name, pid, service-pid);
 +if (kill(pid, SIGABRT) = 0) {
 +// wait a short period for process to exit
 +do {
 +w_pid = waitpid(service-pid, status, 
 WNOHANG);
 +if (w_pid  0) {
 +if (errno == EINTR)
 +continue;
 +else
 +break;
 +} else if (w_pid  0) {
 +if (WIFEXITED(status) || 
 WIFSIGNALED(status)) {
 +break;
 +}
   }
 -}
 -sleep(1);
 -} while (++no_of_retries  MAX_NO_RETRIES);
 +sleep(1);
 +} while (++no_of_retries  MAX_NO_RETRIES);
 +}
   }
   }
   }
 @@ -1229,7 +1231,7 @@ void cleanup(NID_SPAWN_INFO *service)
* Return Values : 
 NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.   *
 * *
 ***/
 -uint32_t recovery_action(NID_SPAWN_INFO *service, char *strbuff)
 +uint32_t recovery_action(NID_SPAWN_INFO *service, char *strbuff, int 
 reason)
   {
   uint32_t count = 0;
   NID_RECOVERY_OPT opt = NID_RESPAWN;
 @@ -1244,7 +1246,7 @@ uint32_t recovery_action(NID_SPAWN_INFO
/* Just clean the stuff we created during prev 
 retry */
   if (service-pid != 0)
 -

Re: [devel] [PATCH 1 of 1] amfd: send data verify message to node in NO_CONFIG and NCS_INIT also [#1359]

2015-05-06 Thread Hans Nordebäck
Hi Nagu,

please see below. /Thanks HansN


On 05/06/2015 10:51 AM, Nagendra Kumar wrote:

 Hi Hans N,

  perhaps the comment above the change need to be updated

 I didn’t get it. Please specify the comment you are pointing.

 Thanks

 -Nagu

 *From:*Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
 *Sent:* 05 May 2015 17:21
 *To:* Nagendra Kumar; Praveen Malviya
 *Cc:* opensaf-devel@lists.sourceforge.net
 *Subject:* Re: [PATCH 1 of 1] amfd: send data verify message to node 
 in NO_CONFIG and NCS_INIT also [#1359]

 ack, code review only, perhaps the comment above the change need to be 
 updated/Thanks HansN

 On 04/30/2015 02:11 PM, nagendr...@oracle.com 
 mailto:nagendr...@oracle.com wrote:

   osaf/services/saf/amf/amfd/ndfsm.cc |  4 +++-

   1 files changed, 3 insertions(+), 1 deletions(-)

   

   

 When Amfd is comming up as Act, it is not sending data verify message to 
 node,

 which is in state AVD_AVND_STATE_NO_CONFIG and AVD_AVND_STATE_NCS_INIT.

 This creates problem of marking the upcoming node in 
 AVD_AVND_STATE_GO_DOWN and

 this stops that node to join the cluster.

 When node has just come up and sent node up message to Act amfd and at 
 that time

 if Act Amfd node goes for switchover or failover, then that node has to

 contact to newly Act Amfd for further communication.

 So, that node needs to get data verify message from newly Amfd.

   

 diff --git a/osaf/services/saf/amf/amfd/ndfsm.cc 
 b/osaf/services/saf/amf/amfd/ndfsm.cc

 --- a/osaf/services/saf/amf/amfd/ndfsm.cc

 +++ b/osaf/services/saf/amf/amfd/ndfsm.cc

 @@ -405,7 +405,9 @@ void avd_fail_over_event(AVD_CL_CB *cb)

   * Check if we are in present state. If yes then send 
 DATA verify

[HansN] the above comment, perhaps change to Check if we are in present 
state and ...

   * message to all the AVND's.

   */

 -   if (AVD_AVND_STATE_PRESENT == avnd-node_state) {

 +   if ((AVD_AVND_STATE_PRESENT == avnd-node_state) ||

 +  (AVD_AVND_STATE_NO_CONFIG == 
 avnd-node_state) ||

 +  (AVD_AVND_STATE_NCS_INIT == 
 avnd-node_state)) {

  /*

   * Send verify message to this node.

   */


--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: Support lock-in and unlock-in on nodegroup V2 [#1327]

2015-05-06 Thread Hans Nordebäck
Hi Praveen,

you mean that we can use version 1 of this patch then add your 
modified.patch on top of it and ignore version 2?
/Thanks HansN

On 05/05/2015 03:06 PM, praveen malviya wrote:


 On 28-Apr-15 4:39 PM, Hans Nordeback wrote:
 osaf/services/saf/amf/amfd/include/node.h |1 +
   osaf/services/saf/amf/amfd/ndproc.cc  |   23 ++-
   osaf/services/saf/amf/amfd/node.cc|2 +-
   osaf/services/saf/amf/amfd/nodegroup.cc   |  230 
 ++
   4 files changed, 253 insertions(+), 3 deletions(-)


 diff --git a/osaf/services/saf/amf/amfd/include/node.h 
 b/osaf/services/saf/amf/amfd/include/node.h
 --- a/osaf/services/saf/amf/amfd/include/node.h
 +++ b/osaf/services/saf/amf/amfd/include/node.h
 @@ -232,4 +232,5 @@ extern void avd_nodeswbundle_constructor
   extern void ng_complete_admin_op(AVD_AMF_NG *ng, SaAisErrorT result);
   extern void avd_ng_admin_state_set(AVD_AMF_NG* ng, SaAmfAdminStateT 
 state);
   extern bool are_all_ngs_in_unlocked_state(const AVD_AVND *node);
 +extern void node_sus_termstate_set(AVD_AVND *node, bool term_state);
   #endif
 diff --git a/osaf/services/saf/amf/amfd/ndproc.cc 
 b/osaf/services/saf/amf/amfd/ndproc.cc
 --- a/osaf/services/saf/amf/amfd/ndproc.cc
 +++ b/osaf/services/saf/amf/amfd/ndproc.cc
 @@ -779,8 +779,26 @@ void avd_data_update_req_evh(AVD_CL_CB *
   l_val = ntohl(*((uint32_t 
 *)n2d_msg-msg_info.n2d_data_req.param_info.value[0]));
 su-set_pres_state(static_castSaAmfPresenceStateT(l_val));

 +AVD_AMF_NG *ng = su-su_on_node-admin_ng;
 +
 +if (ng != 0) {
 +TRACE(NG: admin_oper %u, 
 ng-admin_ng_pend_cbk.admin_oper);
 +TRACE(NG: node-su_cnt_admin_oper %u, 
 node-su_cnt_admin_oper);
 +TRACE(NG: node_oper_list size: %u, 
 node-admin_ng-oper_list_size());
 +
 + su-su_on_node-su_cnt_admin_oper--;
 +
 +if (node-su_cnt_admin_oper == 0) {
 + ng-node_oper_list.erase(Amf::to_string(node-name));
 +TRACE(node_oper_list size:%u, 
 ng-oper_list_size());
 +}
 +/*If adm oper changes are done on all the 
 SUs on each node of nodegroup
 +  then reply to IMM for status of admin 
 operation.*/
 +if (ng-node_oper_list.empty())
 +ng_complete_admin_op(ng, SA_AIS_OK);
 +
   /* Send response to any admin callbacks 
 delivered by IMM if not sent already. */
 -if 
 (su-su_on_node-admin_node_pend_cbk.invocation != 0) {
 +} else if 
 (su-su_on_node-admin_node_pend_cbk.invocation != 0) {
   node_admin_op_report_to_imm(su, 
 static_castSaAmfPresenceStateT(l_val));
   } else if (su-pend_cbk.invocation != 0) {
   su_admin_op_report_to_imm(su, 
 static_castSaAmfPresenceStateT(l_val));
 @@ -843,7 +861,8 @@ void avd_data_update_req_evh(AVD_CL_CB *
done:
   avsv_dnd_msg_free(n2d_msg);
   evt-info.avnd_msg = NULL;
 -TRACE_LEAVE();
 +
 +TRACE_LEAVE2(su_cnt_admin_oper: %u, node-su_cnt_admin_oper);
   }

 /*
 diff --git a/osaf/services/saf/amf/amfd/node.cc 
 b/osaf/services/saf/amf/amfd/node.cc
 --- a/osaf/services/saf/amf/amfd/node.cc
 +++ b/osaf/services/saf/amf/amfd/node.cc
 @@ -1057,7 +1057,7 @@ void avd_node_admin_lock_unlock_shutdown
*
* @param node
*/
 -static void node_sus_termstate_set(AVD_AVND *node, bool term_state)
 +void node_sus_termstate_set(AVD_AVND *node, bool term_state)
   {
   AVD_SU *su;

 diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
 b/osaf/services/saf/amf/amfd/nodegroup.cc
 --- a/osaf/services/saf/amf/amfd/nodegroup.cc
 +++ b/osaf/services/saf/amf/amfd/nodegroup.cc
 @@ -23,6 +23,7 @@
   #include cluster.h
   #include imm.h
   #include set
 +#include list

   AmfDbstd::string, AVD_AMF_NG *nodegroup_db = 0;
   static AVD_AMF_NG *ng_create(SaNameT *dn, const SaImmAttrValuesT_2 
 **attributes);
 @@ -722,6 +723,130 @@ void ng_complete_admin_op(AVD_AMF_NG *ng
   node-admin_ng = NULL;
   }
   }
 +
 +
 +static bool suRank(const AVD_AVND* a, const AVD_AVND* b)
 +{
 +if (a-list_of_su  b-list_of_su) {
 +TRACE(Node %s and %s has SUs, a-name.value, 
 b-name.value);
 +return a-list_of_su-saAmfSURank  
 b-list_of_su-saAmfSURank;
 +} else {
 +  TRACE(Node %s or %s has no SUs, a-name.value, 
 b-name.value);
 +  return false;
 +}
 +}
 +
 +/**
 + * Sends msg to instantiate SUs on the node as part of unlock 
 instantiation
 + *
 + * @param node
 + */
 +uint32_t ng_node_admin_unlock_instantiation(AVD_AMF_NG *ng)
 +{
 +std::listAVD_AVND* ng_nodes; // to be sorted by su rank for 
 the whole node group
 +AVD_SU *su;
 +AVD_AVND *node;
 + 

Re: [devel] [PATCH 1 of 1] amfd: node rebooted when immnd is killed twice in succession [#1290]

2015-05-06 Thread Hans Nordebäck
Hi Nagu,

The handling of BAD_HANDLE should be equal to handling of TRY_AGAIN and 
preferably supported in immutil, (perhaps an enhancement ticket for immutil?)
Anyhow I sent out a version 2 of this patch that uses the default values from 
ImmUtilWrapperProfile. 
The number of retries and retry interval will be the same as for TRY_AGAIN In 
immutil.

 /Thanks HansN

-Original Message-
From: Nagendra Kumar [mailto:nagendr...@oracle.com] 
Sent: den 29 april 2015 12:54
To: Hans Nordebäck; Praveen Malviya
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1 of 1] amfd: node rebooted when immnd is killed twice in 
succession [#1290]

Looks ok to me(code review only) except 
1.  sleep of 1 sec may be more, we can go in micro sleep and 
2.  MAX_NO_RETRIES could match with 10 as max no of retries for immnd 
within 60 seconds.

Thanks
-Nagu

 -Original Message-
 From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
 Sent: 21 April 2015 20:24
 To: Praveen Malviya; Nagendra Kumar
 Cc: opensaf-devel@lists.sourceforge.net
 Subject: [PATCH 1 of 1] amfd: node rebooted when immnd is killed twice 
 in succession [#1290]
 
  osaf/services/saf/amf/amfd/imm.cc |  79 
 +++-
 --
  1 files changed, 55 insertions(+), 24 deletions(-)
 
 
 diff --git a/osaf/services/saf/amf/amfd/imm.cc
 b/osaf/services/saf/amf/amfd/imm.cc
 --- a/osaf/services/saf/amf/amfd/imm.cc
 +++ b/osaf/services/saf/amf/amfd/imm.cc
 @@ -49,7 +49,8 @@
  #include si_dep.h
  #include osaf_utility.h
 
 -
 +#include osaf_time.h
 +#include stdint.h
 
  /*
 =
 ===
   *   DEFINITIONS
 @@ -1643,6 +1644,10 @@ static void *avd_imm_reinit_bg_thread(vo
   AVD_EVT *evt;
   uint32_t status;
 
 + struct timespec time = {1, 0 };
 + uint32_t no_of_retries = 0;
 + const uint32_t MAX_NO_RETRIES = 5;
 +
   TRACE_ENTER();
   osaf_mutex_lock_ordie(imm_reinit_mutex);
   /* Send signal that imm_reinit_mutex has been taken. */ @@ -1652,38 
 +1657,64 @@ static void *avd_imm_reinit_bg_thread(vo
 
   immutilWrapperProfile.errorsAreFatal = 0;
 
 - if ((rc = immutil_saImmOiInitialize_2(cb-immOiHandle,
 avd_callbacks, immVersion)) != SA_AIS_OK) {
 - LOG_ER(saImmOiInitialize failed %u, rc);
 - osaf_mutex_unlock_ordie(imm_reinit_mutex);
 - exit(EXIT_FAILURE);
 - }
 + while (++no_of_retries  MAX_NO_RETRIES) {
 + (void) saImmOiFinalize(avd_cb-immOiHandle);
 
 - if ((rc = immutil_saImmOiSelectionObjectGet(cb-immOiHandle, cb-
 imm_sel_obj)) != SA_AIS_OK) {
 - LOG_ER(saImmOiSelectionObjectGet failed %u, rc);
 - osaf_mutex_unlock_ordie(imm_reinit_mutex);
 - exit(EXIT_FAILURE);
 - }
 + avd_cb-immOiHandle = 0;
 + avd_cb-is_implementer = false;
 
 - /* If this is the active server, become implementer again. */
 - if (cb-avail_state_avd == SA_AMF_HA_ACTIVE) {
 - if (avd_imm_impl_set() != SA_AIS_OK) {
 - LOG_ER(exiting since avd_imm_impl_set failed);
 - osaf_mutex_unlock_ordie(imm_reinit_mutex);
 - exit(EXIT_FAILURE);
 - }
 - } else {
 - /* become applier and re-read the config */
 - if (avd_imm_applier_set() != SA_AIS_OK) {
 - LOG_ER(exiting since avd_imm_applier_set failed);
 + if ((rc = immutil_saImmOiInitialize_2(cb-immOiHandle,
 avd_callbacks, immVersion)) != SA_AIS_OK) {
 + LOG_ER(saImmOiInitialize failed %u, rc);
   osaf_mutex_unlock_ordie(imm_reinit_mutex);
   exit(EXIT_FAILURE);
   }
 
 - if (avd_imm_config_get() != NCSCC_RC_SUCCESS) {
 - LOG_ER(avd_imm_config_get FAILED);
 + rc = immutil_saImmOiSelectionObjectGet(cb-immOiHandle,
 cb-imm_sel_obj);
 + if (rc == SA_AIS_ERR_BAD_HANDLE) {
 + osaf_nanosleep(time);
 + continue;
 + } else if (rc != SA_AIS_OK) {
 + LOG_ER(saImmOiSelectionObjectGet failed %u, rc);
   osaf_mutex_unlock_ordie(imm_reinit_mutex);
   exit(EXIT_FAILURE);
   }
 +
 + /* If this is the active server, become implementer again. */
 + if (cb-avail_state_avd == SA_AMF_HA_ACTIVE) {
 + rc = avd_imm_impl_set();
 + if (rc == SA_AIS_ERR_BAD_HANDLE) {
 + osaf_nanosleep(time);
 + continue;
 + } else if (rc != SA_AIS_OK) {
 + LOG_ER(exiting since avd_imm_impl_set
 failed);
 +
   osaf_mutex_unlock_ordie(imm_reinit_mutex);
 + exit(EXIT_FAILURE);
 + }
 + } else

Re: [devel] [PATCH 1 of 1] amfnd: avoid creating existing safHealthcheckKey record in amfnd database [#1363]

2015-05-05 Thread Hans Nordebäck
ack, code review only. /Thanks HansN

On 05/04/2015 12:10 PM, praveen.malv...@oracle.com wrote:
   osaf/services/saf/amf/amfnd/chc.cc  |   2 +-
   osaf/services/saf/amf/amfnd/hcdb.cc |  12 +---
   2 files changed, 10 insertions(+), 4 deletions(-)


 saAmfHealthcheckStart() API fails with SA_AIS_ERR_NOT_EXIST in the reported 
 case.

 In the reported case, Application is up with 2 SUs with one component in each 
 SU.
 Each component belongs to same component type.HealtchCheckKey is configured 
 for
 component type. Now, dynamically, a SU is added in the system having one 
 component
 of same component type and a different health check key is configured for the 
 same
 component type. When this SU is unlocked, saAmfHealthcheckStart() API fails 
 with
 SA_AIS_ERR_NOT_EXIST. Why  ? As a part of dynamic addition of SU, AMFND reads 
 SU
 configuration from IMM. While reading information for healthCheckType,
 AMFND reads all keys again for the same compType and try to create again 
 record for
 it. Since record already exists in its database, record is not added in 
 database and
 at this error AMF does not continue to read other healthCheckType from 
 IMM.AMFND must
 skip creating existing records and must continue to read other records from 
 IMM.


 Patch ensures that AMFND first checks if record already exists in its 
 database. It creates
 record only if it does not exists. Thus error situation while addition of 
 record is avoided
 and all records are read.

 diff --git a/osaf/services/saf/amf/amfnd/chc.cc 
 b/osaf/services/saf/amf/amfnd/chc.cc
 --- a/osaf/services/saf/amf/amfnd/chc.cc
 +++ b/osaf/services/saf/amf/amfnd/chc.cc
 @@ -100,7 +100,7 @@ uint32_t avnd_evt_ava_hc_start_evh(AVND_
   }
   /* validate the healthcheck start message */
   avnd_comp_hc_param_val(cb, AVSV_AMF_HC_START, (uint8_t *)hc_start, 
 comp, 0, amf_rc);
 -
 + TRACE_1(sending response:%d,amf_rc);
   /* send the response back to AvA */
   rc = avnd_amf_resp_send(cb, AVSV_AMF_HC_START, amf_rc, 0, 
 api_info-dest, evt-mds_ctxt, comp, msg_from_avnd);
   
 diff --git a/osaf/services/saf/amf/amfnd/hcdb.cc 
 b/osaf/services/saf/amf/amfnd/hcdb.cc
 --- a/osaf/services/saf/amf/amfnd/hcdb.cc
 +++ b/osaf/services/saf/amf/amfnd/hcdb.cc
 @@ -326,9 +326,15 @@ SaAisErrorT avnd_hctype_config_get(SaImm
   while (immutil_saImmOmSearchNext_2(searchHandle, hc_name, 
 (SaImmAttrValuesT_2 ***)attributes) == SA_AIS_OK) {
   
   TRACE_1('%s', hc_name.value);
 -
 - if (hctype_create(avnd_cb, hc_name, attributes) == NULL)
 - goto done2;
 + //A record may get created in the context of some other 
 component of same comptype.
 + AVND_HCTYPE *hctype = NULL;
 + if ((hctype = (AVND_HCTYPE *)ncs_patricia_tree_get(hctypedb,
 + (uint8_t *)hc_name)) == NULL) {
 + if (hctype_create(avnd_cb, hc_name, attributes) == 
 NULL)
 + goto done2;
 + }
 + else
 + TRACE_2(Record already exists);
   }
   
   error = SA_AIS_OK;


--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: ignore si rank modification for the same value [#1336]

2015-05-05 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 04/30/2015 12:24 PM, nagendr...@oracle.com wrote:
   osaf/services/saf/amf/amfd/si.cc |  13 +
   1 files changed, 5 insertions(+), 8 deletions(-)


 Amfd rejects ccb modification operation on si rank if
 its current si rank value is being modified by
 the same value.
 Amfd can accept it and ignore the changes to avoid ccb  abort.

 diff --git a/osaf/services/saf/amf/amfd/si.cc 
 b/osaf/services/saf/amf/amfd/si.cc
 --- a/osaf/services/saf/amf/amfd/si.cc
 +++ b/osaf/services/saf/amf/amfd/si.cc
 @@ -778,12 +778,6 @@ static SaAisErrorT si_ccb_completed_modi
   
   SaUint32T sirank = 
 *(SaUint32T*)attribute-attrValues[0];
   
 - if (si-saAmfSIRank == (sirank == 0 ? ~0U : sirank)) {
 - report_ccb_validation_error(opdata, Changing 
 same value of saAmfSIRank(%u), sirank);
 - rc = SA_AIS_ERR_EXIST;
 - break;
 - }
 -
   if (!si-is_sirank_valid(sirank)) {
   report_ccb_validation_error(opdata, 
 saAmfSIRank(%u) is invalid due to SI Dependency rules, sirank);
   rc = SA_AIS_ERR_BAD_OPERATION;
 @@ -1205,8 +1199,11 @@ static void si_ccb_apply_modify_hdlr(Ccb
   } else if (!strcmp(attribute-attrName, saAmfSIRank)) {
   if (value_is_deleted == true)
   si-update_sirank(0);
 - else
 - si-update_sirank(*((SaUint32T 
 *)attr_mod-modAttr.attrValues[0]));
 + else {
 + /* Ignore the modification with the same value. 
 */
 + if (si-saAmfSIRank != *((SaUint32T 
 *)attr_mod-modAttr.attrValues[0]))
 + si-update_sirank(*((SaUint32T 
 *)attr_mod-modAttr.attrValues[0]));
 + }
   TRACE(Modified saAmfSIRank is '%u', si-saAmfSIRank);
   } else {
   osafassert(0);


--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: send data verify message to node in NO_CONFIG and NCS_INIT also [#1359]

2015-05-05 Thread Hans Nordebäck
ack, code review only, perhaps the comment above the change need to be 
updated/Thanks HansN

On 04/30/2015 02:11 PM, nagendr...@oracle.com wrote:
   osaf/services/saf/amf/amfd/ndfsm.cc |  4 +++-
   1 files changed, 3 insertions(+), 1 deletions(-)


 When Amfd is comming up as Act, it is not sending data verify message to node,
 which is in state AVD_AVND_STATE_NO_CONFIG and AVD_AVND_STATE_NCS_INIT.
 This creates problem of marking the upcoming node in AVD_AVND_STATE_GO_DOWN 
 and
 this stops that node to join the cluster.
 When node has just come up and sent node up message to Act amfd and at that 
 time
 if Act Amfd node goes for switchover or failover, then that node has to
 contact to newly Act Amfd for further communication.
 So, that node needs to get data verify message from newly Amfd.

 diff --git a/osaf/services/saf/amf/amfd/ndfsm.cc 
 b/osaf/services/saf/amf/amfd/ndfsm.cc
 --- a/osaf/services/saf/amf/amfd/ndfsm.cc
 +++ b/osaf/services/saf/amf/amfd/ndfsm.cc
 @@ -405,7 +405,9 @@ void avd_fail_over_event(AVD_CL_CB *cb)
* Check if we are in present state. If yes then send DATA 
 verify
* message to all the AVND's.
*/
 - if (AVD_AVND_STATE_PRESENT == avnd-node_state) {
 + if ((AVD_AVND_STATE_PRESENT == avnd-node_state) ||
 + (AVD_AVND_STATE_NO_CONFIG == avnd-node_state) 
 ||
 + (AVD_AVND_STATE_NCS_INIT == avnd-node_state)) {
   /*
* Send verify message to this node.
*/

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: ignore locked-in node during lock, shutdown and unlock op on ng [#1356]

2015-05-05 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 04/30/2015 09:02 AM, praveen.malv...@oracle.com wrote:
   osaf/services/saf/amf/amfd/nodegroup.cc |  18 --
   osaf/services/saf/amf/amfd/sgproc.cc|   2 ++
   2 files changed, 18 insertions(+), 2 deletions(-)


 If a node is in lock-in state and lock, shutdown or unlock are initiated on 
 any of its
 nodegroup then there are two problems:
 1)During lock and shutdown operation on ng, locked-in admin state of node is 
 changed
 to locked.
 2)During unlock operation on ng, locked-in admin state of node is changed to 
 unlocked.
 In both the above cases locked-in state of node should remain intact.

 Patch ensures that a locked-in node remains untouched during lock, shutdown 
 and unlock
 operation on any nodegroup of node.

 diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
 b/osaf/services/saf/amf/amfd/nodegroup.cc
 --- a/osaf/services/saf/amf/amfd/nodegroup.cc
 +++ b/osaf/services/saf/amf/amfd/nodegroup.cc
 @@ -771,19 +771,22 @@ void ng_unlock(AVD_AMF_NG *ng)
   for (std::setstd::string::const_iterator iter = 
 ng-saAmfNGNodeList.begin();
   iter != ng-saAmfNGNodeList.end(); ++iter) {
   AVD_AVND *node = avd_node_get(*iter);
 + node-su_cnt_admin_oper = 0;
 + if (node-saAmfNodeAdminState == 
 SA_AMF_ADMIN_LOCKED_INSTANTIATION)
 + continue;
   node_admin_state_set(node, SA_AMF_ADMIN_UNLOCKED);
   if (node-node_info.member == false) {
   LOG_NO('%s' UNLOCK: CLM node is not member, 
 node-name.value);
   continue;
   }
 - node-su_cnt_admin_oper = 0;
   node-admin_ng = ng;
   }
   for (std::setstd::string::const_iterator iter = 
 ng-saAmfNGNodeList.begin();
   iter != ng-saAmfNGNodeList.end(); ++iter) {
   AVD_AVND *node = avd_node_get(*iter);
   if ((node-saAmfNodeOperState == SA_AMF_OPERATIONAL_DISABLED) ||
 - (node-node_info.member == false))
 + (node-saAmfNodeAdminState == 
 SA_AMF_ADMIN_LOCKED_INSTANTIATION) ||
 + (node-node_info.member == false))
   continue;
   for (AVD_SU *su = node-list_of_su; su != NULL;  su = 
 su-avnd_list_su_next) {
   if (su-is_in_service() == true) {
 @@ -796,6 +799,7 @@ void ng_unlock(AVD_AMF_NG *ng)
   AVD_AVND *node = avd_node_get(*iter);
   if ((node-saAmfNodeOperState == SA_AMF_OPERATIONAL_DISABLED) ||
   (node-node_info.member == false) ||
 + (node-saAmfNodeAdminState == 
 SA_AMF_ADMIN_LOCKED_INSTANTIATION) ||
   (avd_cb-init_state == AVD_INIT_DONE))
   continue;
   /*
 @@ -867,12 +871,16 @@ static void ng_admin_op_cb(SaImmOiHandle
   iter != ng-saAmfNGNodeList.end(); ++iter) {
   AVD_AVND *node = avd_node_get(*iter);
   node-su_cnt_admin_oper = 0;
 + if (node-saAmfNodeAdminState == 
 SA_AMF_ADMIN_LOCKED_INSTANTIATION)
 + continue;
   node-admin_ng = ng;
   node_admin_state_set(node, SA_AMF_ADMIN_LOCKED);
   }
   for (std::setstd::string::const_iterator iter = 
 ng-saAmfNGNodeList.begin();
   iter != ng-saAmfNGNodeList.end(); ++iter) {
   AVD_AVND *node = avd_node_get(*iter);
 + if (node-saAmfNodeAdminState == 
 SA_AMF_ADMIN_LOCKED_INSTANTIATION)
 + continue;
   ng_node_lock_and_shutdown(node);
   }
   if (ng-node_oper_list.empty())
 @@ -916,12 +924,16 @@ static void ng_admin_op_cb(SaImmOiHandle
   iter != ng-saAmfNGNodeList.end(); ++iter) {
   AVD_AVND *node = avd_node_get(*iter);
   node-su_cnt_admin_oper = 0;
 + if (node-saAmfNodeAdminState == 
 SA_AMF_ADMIN_LOCKED_INSTANTIATION)
 + continue;
   node-admin_ng = ng;
   node_admin_state_set(node, SA_AMF_ADMIN_SHUTTING_DOWN);
   }
   for (std::setstd::string::const_iterator iter = 
 ng-saAmfNGNodeList.begin();
   iter != ng-saAmfNGNodeList.end(); ++iter) {
   AVD_AVND *node = avd_node_get(*iter);
 + if (node-saAmfNodeAdminState == 
 SA_AMF_ADMIN_LOCKED_INSTANTIATION)
 + continue;
   ng_node_lock_and_shutdown(node);
   if (node-su_cnt_admin_oper == 0)
   node_admin_state_set(node, SA_AMF_ADMIN_LOCKED);
 @@ -931,6 

Re: [devel] [PATCH 1 of 1] amfa: avoid illigal memory access [#1307]

2015-05-04 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: nagendr...@oracle.com [mailto:nagendr...@oracle.com] 
Sent: den 21 april 2015 13:32
To: Hans Nordebäck; praveen.malv...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfa: avoid illigal memory access [#1307]

 osaf/libs/agents/saf/amfa/ava_api.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


While invalid handle is passed to saAmfProtectionGroupTrack_4, code jumps to 
done and calls avsv_nda_ava_msg_content_free(msg). But msg is not meset to 
zero, so it has garbage values. Inside avsv_nda_ava_msg_content_free, the 
following code points to garbage pointer and agent crashes:
if (msg-info.cbk_info) {
avsv_amf_cbk_free(msg-info.cbk_info);
msg need to be memset before code jumps to 'done'.

diff --git a/osaf/libs/agents/saf/amfa/ava_api.c 
b/osaf/libs/agents/saf/amfa/ava_api.c
--- a/osaf/libs/agents/saf/amfa/ava_api.c
+++ b/osaf/libs/agents/saf/amfa/ava_api.c
@@ -2194,6 +2194,9 @@ SaAisErrorT saAmfProtectionGroupTrack_4(
SaAisErrorT rc = SA_AIS_OK;
TRACE_ENTER2(SaAmfHandleT passed is %llx, hdl);
 
+   /* initialize the msg */
+   memset(msg, 0, sizeof(AVSV_NDA_AVA_MSG));
+
/* Verifying the input Handle  global handle */
if(!gl_ava_hdl || hdl  AVSV_UNS32_HDL_MAX) {
TRACE_2(Invalid SaAmfHandle passed by component: %llx,hdl); 
@@ -2226,9 +2229,6 @@ SaAisErrorT saAmfProtectionGroupTrack_4(
/* TODO: check cluster membership, if node is not a member answer back 
with SA_AIS_ERR_UNAVAILABLE */
/* TODO: check if handle is old, due to node rejoin as member in 
cluster. If not: SA_AIS_ERR_UNAVAILABLE */
 
-   /* initialize the msg */
-   memset(msg, 0, sizeof(AVSV_NDA_AVA_MSG));
-
if (!csi_name || !(csi_name-length) || (csi_name-length  
SA_MAX_NAME_LENGTH)) {
TRACE_LEAVE2(Incorrect arguments);
rc = SA_AIS_ERR_INVALID_PARAM;

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amf/tools: add options for all AMF classes in amf-find [#1318]

2015-05-04 Thread Hans Nordebäck
Ack with one comment, sirankedsu in the usage text do not correspond to the 
siranksu) case stmt. /Thanks HansN

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 21 april 2015 15:02
To: Hans Nordebäck; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amf/tools: add options for all AMF classes in amf-find 
[#1318]

 osaf/tools/scripts/amf-find |  85 ++--
 1 files changed, 81 insertions(+), 4 deletions(-)


With this enhancement amf-find will list of any AMF class.
Its usage:
 amf-find
usage: amf-find app|comp|csi|csiass|node|sg|si|siass|su|
|appbasetype|apptype|csbasetype|csiattr|cstype|cluster|
|compbasetype|compcstype|compglobalattr|comptype|ctcstype|
|hc|hctype|ng|nodeswbundle|sgbasetype|sgtype|sidep|sirankedsu|
|subasetype|sutype|sutcomptype|sibasetype|sitype|sitypecstype

diff --git a/osaf/tools/scripts/amf-find b/osaf/tools/scripts/amf-find
--- a/osaf/tools/scripts/amf-find
+++ b/osaf/tools/scripts/amf-find
@@ -15,7 +15,12 @@
 #
 
 if [ $# -eq 0 ]; then
-   echo usage: `basename $0` app|comp|csi|csiass|node|sg|si|siass|su
+   echo usage: `basename $0` app|comp|csi|csiass|node|sg|si|siass|su|
+   |appbasetype|apptype|csbasetype|csiattr|cstype|cluster|
+   |compbasetype|compcstype|compglobalattr|comptype|ctcstype|
+   |hc|hctype|ng|nodeswbundle|sgbasetype|sgtype|sidep|sirankedsu|
+   |subasetype|sutype|sutcomptype|sibasetype|sitype|sitypecstype
+
exit 1
 fi
 
@@ -32,9 +37,6 @@ case $1 in
csiass)
immfind -c SaAmfCSIAssignment
;;
-   comp)
-   immfind -c SaAmfComp
-   ;;
node)
immfind -c SaAmfNode
;;
@@ -50,6 +52,81 @@ case $1 in
su)
immfind -c SaAmfSU
;;
+   appbasetype)
+   immfind -c SaAmfAppBaseType
+   ;;
+   apptype)
+   immfind -c SaAmfAppType
+   ;;
+   csbasetype)
+   immfind -c SaAmfCSBaseType
+   ;;
+   csiattr)
+   immfind -c SaAmfCSIAttribute
+   ;;
+   cstype)
+   immfind -c SaAmfCSType
+   ;;
+   cluster)
+   immfind -c SaAmfCluster
+   ;;
+   compbasetype)
+   immfind -c SaAmfCompBaseType
+   ;;
+   compcstype)
+   immfind -c SaAmfCompCsType
+   ;;
+   compglobalattr)
+   immfind -c SaAmfCompGlobalAttributes
+   ;;
+   comptype)
+   immfind -c SaAmfCompType
+   ;;
+   ctcstype)
+   immfind -c SaAmfCtCsType
+   ;;
+   hc)
+   immfind -c SaAmfHealthcheck
+   ;;
+   hctype)
+   immfind -c SaAmfHealthcheckType
+   ;;
+   ng)
+   immfind -c SaAmfNodeGroup
+   ;;
+   nodeswbundle)
+   immfind -c SaAmfNodeSwBundle
+   ;;
+   sgbasetype)
+   immfind -c SaAmfSGBaseType
+   ;;
+   sgtype)
+   immfind -c SaAmfSGType
+   ;;
+   sidep)
+   immfind -c SaAmfSIDependency
+   ;;
+   siranksu)
+immfind -c SaAmfSIRankedSU
+   ;;
+   subasetype)
+   immfind -c SaAmfSUBaseType
+   ;;
+   sutype)
+   immfind -c SaAmfSUType
+   ;;
+   sutcomptype)
+   immfind -c SaAmfSutCompType
+   ;;
+   sibasetype)
+   immfind -c SaAmfSvcBaseType
+   ;;
+   sitype)
+   immfind -c SaAmfSvcType
+   ;;
+   sitypecstype)
+   immfind -c SaAmfSvcTypeCSTypes
+   ;;
*)
echo unsupported type, trying anyway...
immfind -c $*

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: respond to nid only after initialization is completed [#1334]

2015-05-04 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: nagendr...@oracle.com [mailto:nagendr...@oracle.com] 
Sent: den 27 april 2015 11:19
To: Hans Nordebäck; praveen.malv...@oracle.com; mathi.naic...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: respond to nid only after initialization is 
completed [#1334]

 osaf/services/saf/amf/amfd/chkop.cc |  4   
osaf/services/saf/amf/amfd/main.cc  |  6 +-
 2 files changed, 9 insertions(+), 1 deletions(-)


Act Amfd initialization is said to be completed when it completes its 
initialization with imm.
Apart from initializing with imm, Standby Amfd also need to get run time data 
from Act Amfd using cold sync.
So, Standby Amfd initialization is said to be completed when it completes its 
initialization with imm and it completes its cold sync with Act Amfd.
In the present code, Standby is sending response to nid without cold sync 
complete.
So, code has been added to send nid response only when Amfd completes its 
initialization.

diff --git a/osaf/services/saf/amf/amfd/chkop.cc 
b/osaf/services/saf/amf/amfd/chkop.cc
--- a/osaf/services/saf/amf/amfd/chkop.cc
+++ b/osaf/services/saf/amf/amfd/chkop.cc
@@ -40,6 +40,7 @@
 
 #include logtrace.h
 #include amfd.h
+#include nid_api.h
 
 static uint32_t avsv_mbcsv_cb(NCS_MBCSV_CB_ARG *arg);  static uint32_t 
avsv_mbcsv_process_enc_cb(AVD_CL_CB *cb, NCS_MBCSV_CB_ARG *arg); @@ -444,6 
+445,9 @@ ignore_msg:
** when in a more critical state */
saflog(LOG_NOTICE, amfSvcUsrName, Cold sync 
complete at %x, cb-node_id_avd);
cb-stby_sync_state = AVD_STBY_IN_SYNC;
+   /* It is important for Standby Amfd to inform 
nid after it is
+  ready for Act controller failover and accept 
Act role. */
+   (void) nid_notify(const_castchar*(AMFD), 
NCSCC_RC_SUCCESS, 
+NULL);
}
 
cb-synced_reo_type = arg-info.decode.i_reo_type; diff 
--git a/osaf/services/saf/amf/amfd/main.cc b/osaf/services/saf/amf/amfd/main.cc
--- a/osaf/services/saf/amf/amfd/main.cc
+++ b/osaf/services/saf/amf/amfd/main.cc
@@ -831,7 +831,11 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
 
-   (void) nid_notify(const_castchar*(AMFD), NCSCC_RC_SUCCESS, NULL);
+   /* Act Amfd need to inform nid after it has initialized itself, while
+  Stanby Amfd need to inform nid after it has done cold sync. */
+   if (avd_cb-avail_state_avd == SA_AMF_HA_ACTIVE) {
+   (void) nid_notify(const_castchar*(AMFD), NCSCC_RC_SUCCESS, 
NULL);
+   }
 
main_loop();
 

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] base: Coredumps are not generated when running as non root [#1106]

2015-04-27 Thread Hans Nordebäck
it was tested with an LSB compiler, but I can add the ifndef before 
pushing. /Thanks HansN

On 04/27/2015 01:20 PM, Anders Widell wrote:
 Ack.

 Question: Did you try this with an LSB compiler? I am surprised it 
 didn't complain about PR_SET_DUMPABLE. Maybe it would be good to add 
 an #ifndef, just in case:

 #ifndef PR_SET_DUMPABLE
 #define PR_SET_DUMPABLE 4
 #endif

 / Anders Widell

 On 04/20/2015 02:52 PM, Hans Nordeback wrote:
   osaf/libs/core/common/daemon.c |  12 
   1 files changed, 12 insertions(+), 0 deletions(-)


 diff --git a/osaf/libs/core/common/daemon.c 
 b/osaf/libs/core/common/daemon.c
 --- a/osaf/libs/core/common/daemon.c
 +++ b/osaf/libs/core/common/daemon.c
 @@ -48,6 +48,8 @@
   #include sys/types.h
   #include time.h
   +#include sys/prctl.h
 +
   #define DEFAULT_RUNAS_USERNAMEopensaf
 static const char* internal_version_id_;
 @@ -206,6 +208,9 @@ static void __parse_options(int argc, ch
 void daemonize(int argc, char *argv[])
   {
 +#ifndef RUNASROOT
 +static int (*plibc_prctl) (int option, ...) = NULL;
 +#endif
   pid_t pid, sid;
   struct sched_param param;
   char *thread_prio;
 @@ -349,6 +354,13 @@ void daemonize(int argc, char *argv[])
   syslog(LOG_ERR, setuid failed, uid=%d (%s), 
 pw-pw_uid, strerror(errno));
   exit(EXIT_FAILURE);
   }
 +// Enable generating core files
 +plibc_prctl = dlsym(RTLD_DEFAULT, prctl);
 +if (plibc_prctl) {
 +if (plibc_prctl(PR_SET_DUMPABLE, 1)  0) {
 +syslog(LOG_ERR, prctl failed: %s, 
 strerror(errno));
 +}
 +}
   } else {
   syslog(LOG_ERR, invalid user name %s, __runas_username);
   exit(EXIT_FAILURE);



--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: validate node for being nodegroup member [#1311]

2015-04-23 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 04/22/2015 01:27 PM, nagendr...@oracle.com wrote:
   osaf/services/saf/amf/amfd/node.cc |  14 ++
   1 files changed, 14 insertions(+), 0 deletions(-)


 Amfd is allowing node to be deleted even if node is being part of node group.
 This creates database differences because that node is still part of node 
 group,
 but it doesn's exists.
 When a nodegroup is created and node is added to it, Amfd checks whether
 node exists or not. If it doesn't exist, then node addition fails.
 This is done in the expectation that node should exists if it want to
 be part of node group. This concept should go inline with deletion of node
 as well and node deletion shouldn't be allowed until it is part of a 
 nodegroup.

 A valiadation has been added when node is being deleted for its membership
 of a node group. If node is a part of membership, it can't be deleted. So,
 to delete a node, first delete that node from node group.

 diff --git a/osaf/services/saf/amf/amfd/node.cc 
 b/osaf/services/saf/amf/amfd/node.cc
 --- a/osaf/services/saf/amf/amfd/node.cc
 +++ b/osaf/services/saf/amf/amfd/node.cc
 @@ -453,6 +453,20 @@ static SaAisErrorT node_ccb_completed_de
   goto done;
   }
   }
 +
 + /* This node shouldn't be part of any nodegroup. First this node has to 
 be deleted from
 +node group. */
 + for (std::mapstd::string, AVD_AMF_NG*::const_iterator it = 
 nodegroup_db-begin();
 + it != nodegroup_db-end(); it++) {
 + AVD_AMF_NG *ng = it-second;
 + if (node_in_nodegroup(Amf::to_string((opdata-objectName)), 
 ng) == true) {
 + report_ccb_validation_error(opdata, '%s' exists in
 +  the nodegroup '%s',
 + opdata-objectName.value, 
 ng-name.value);
 + rc = SA_AIS_ERR_BAD_OPERATION;
 + goto done;
 + }
 + }
   opdata-userData = node;
   done:
   TRACE_LEAVE();

--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfnd: fix double free of cbk_info [#1321]

2015-04-22 Thread Hans Nordebäck
ack, (code review only) /Thanks HansN

On 04/22/2015 07:04 AM, Gary Lee wrote:
 Hi Hans

 I think the success case should be OK. cbk_info is freed when 
 avnd_msg_content_free() is called elsewhere (avnd_mds_flat_enc?) for 
 the successful case. The bit of code I removed was only getting called 
 when 'NCSCC_RC_SUCCESS != rc'.

 I agree with your second comment. Setting it to 0 is unnecessary. I'll 
 remove this.

 Thanks
 Gary

 On 21/04/15 20:47, Hans Nordebäck wrote:
 Hi Gary,

 two questions, in avnd_msg_content_free it seems that the cbk_info is 
 not freed if msg-info.ava == 0,
 it is set to 0 when avnd_mds_send succeeds, so it will not be freed 
 as that code now has been removed?
 The cbk_info is a local variable so it shouldn't be necessary to set 
 it to 0.

 /Thanks HansN
 On 04/21/2015 03:23 AM, Gary Lee wrote:
   osaf/services/saf/amf/amfnd/pg.cc   | 3 ---
   osaf/services/saf/amf/amfnd/util.cc |  1 +
   2 files changed, 1 insertions(+), 3 deletions(-)


 cbk_info is already freed in avnd_pg_cbk_msg_send(). There is
 no need to free it again.

 diff --git a/osaf/services/saf/amf/amfnd/pg.cc 
 b/osaf/services/saf/amf/amfnd/pg.cc
 --- a/osaf/services/saf/amf/amfnd/pg.cc
 +++ b/osaf/services/saf/amf/amfnd/pg.cc
 @@ -784,9 +784,6 @@
   /* reset the is_syn flag */
   trk-info.is_syn = false;
   - if ((NCSCC_RC_SUCCESS != rc)  cbk_info)
 -amf_cbk_free(cbk_info);
 -
   TRACE_LEAVE2(rc '%u', rc);
   return rc;
   }
 diff --git a/osaf/services/saf/amf/amfnd/util.cc 
 b/osaf/services/saf/amf/amfnd/util.cc
 --- a/osaf/services/saf/amf/amfnd/util.cc
 +++ b/osaf/services/saf/amf/amfnd/util.cc
 @@ -638,6 +638,7 @@
 /* free the cbk-info ptr */
   delete cbk_info;
 +cbk_info = NULL;
 return;
   }





--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfnd: fix double free of cbk_info [#1321]

2015-04-21 Thread Hans Nordebäck
Hi Gary,

two questions, in avnd_msg_content_free it seems that the cbk_info is 
not freed if msg-info.ava == 0,
it is set to 0 when avnd_mds_send succeeds, so it will not be freed as 
that code now has been removed?
The cbk_info is a local variable so it shouldn't be necessary to set it 
to 0.

/Thanks HansN
On 04/21/2015 03:23 AM, Gary Lee wrote:
   osaf/services/saf/amf/amfnd/pg.cc   |  3 ---
   osaf/services/saf/amf/amfnd/util.cc |  1 +
   2 files changed, 1 insertions(+), 3 deletions(-)


 cbk_info is already freed in avnd_pg_cbk_msg_send(). There is
 no need to free it again.

 diff --git a/osaf/services/saf/amf/amfnd/pg.cc 
 b/osaf/services/saf/amf/amfnd/pg.cc
 --- a/osaf/services/saf/amf/amfnd/pg.cc
 +++ b/osaf/services/saf/amf/amfnd/pg.cc
 @@ -784,9 +784,6 @@
   /* reset the is_syn flag */
   trk-info.is_syn = false;
   
 - if ((NCSCC_RC_SUCCESS != rc)  cbk_info)
 - amf_cbk_free(cbk_info);
 -
   TRACE_LEAVE2(rc '%u', rc);
   return rc;
   }
 diff --git a/osaf/services/saf/amf/amfnd/util.cc 
 b/osaf/services/saf/amf/amfnd/util.cc
 --- a/osaf/services/saf/amf/amfnd/util.cc
 +++ b/osaf/services/saf/amf/amfnd/util.cc
 @@ -638,6 +638,7 @@
   
   /* free the cbk-info ptr */
   delete cbk_info;
 + cbk_info = NULL;
   
   return;
   }


--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfa: avoid illigal memory access [#1307]

2015-04-21 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 04/21/2015 01:31 PM, nagendr...@oracle.com wrote:
   osaf/libs/agents/saf/amfa/ava_api.c |  6 +++---
   1 files changed, 3 insertions(+), 3 deletions(-)


 While invalid handle is passed to saAmfProtectionGroupTrack_4, code jumps to
 done and calls avsv_nda_ava_msg_content_free(msg). But msg is not meset
 to zero, so it has garbage values. Inside avsv_nda_ava_msg_content_free, the
 following code points to garbage pointer and agent crashes:
 if (msg-info.cbk_info) {
  avsv_amf_cbk_free(msg-info.cbk_info);
 msg need to be memset before code jumps to 'done'.

 diff --git a/osaf/libs/agents/saf/amfa/ava_api.c 
 b/osaf/libs/agents/saf/amfa/ava_api.c
 --- a/osaf/libs/agents/saf/amfa/ava_api.c
 +++ b/osaf/libs/agents/saf/amfa/ava_api.c
 @@ -2194,6 +2194,9 @@ SaAisErrorT saAmfProtectionGroupTrack_4(
   SaAisErrorT rc = SA_AIS_OK;
   TRACE_ENTER2(SaAmfHandleT passed is %llx, hdl);
   
 + /* initialize the msg */
 + memset(msg, 0, sizeof(AVSV_NDA_AVA_MSG));
 +
   /* Verifying the input Handle  global handle */
   if(!gl_ava_hdl || hdl  AVSV_UNS32_HDL_MAX) {
   TRACE_2(Invalid SaAmfHandle passed by component: %llx,hdl);
 @@ -2226,9 +2229,6 @@ SaAisErrorT saAmfProtectionGroupTrack_4(
   /* TODO: check cluster membership, if node is not a member answer back 
 with SA_AIS_ERR_UNAVAILABLE */
   /* TODO: check if handle is old, due to node rejoin as member in 
 cluster. If not: SA_AIS_ERR_UNAVAILABLE */
   
 - /* initialize the msg */
 - memset(msg, 0, sizeof(AVSV_NDA_AVA_MSG));
 -
   if (!csi_name || !(csi_name-length) || (csi_name-length  
 SA_MAX_NAME_LENGTH)) {
   TRACE_LEAVE2(Incorrect arguments);
   rc = SA_AIS_ERR_INVALID_PARAM;


--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: segv in avd_sidep_is_si_failover_possible #1309

2015-04-14 Thread Hans Nordebäck
Hi Nagu,

this segv is due to the problem in ticket #1312. Minh is working on 
#1312 but the segv in #1309 should be avoided.
/Thanks HansN

On 04/10/2015 10:19 AM, Nagendra Kumar wrote:
 Hi Hans N,
   Can you please share the logs in the ticket.

 Thanks
 -Nagu
 -Original Message-
 From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
 Sent: 09 April 2015 20:02
 To: praveen malviya; Nagendra Kumar
 Cc: opensaf-devel@lists.sourceforge.net
 Subject: RE: [PATCH 1 of 1] amfd: segv in avd_sidep_is_si_failover_possible
 #1309

 Hi,

 The problem has been reproduced and traces has been provided, I'll come
 back with steps how to reproduce the fault/Thanks HansN

 -Original Message-
 From: praveen malviya [mailto:praveen.malv...@oracle.com]
 Sent: den 8 april 2015 11:33
 To: Hans Nordebäck; nagendr...@oracle.com
 Cc: opensaf-devel@lists.sourceforge.net
 Subject: Re: [PATCH 1 of 1] amfd: segv in avd_sidep_is_si_failover_possible
 #1309

 Hi Hans,

 Please tell if there are some steps to reproduce it.

 Thanks,
 Praveen

 On 08-Apr-15 2:38 PM, Hans Nordeback wrote:
osaf/services/saf/amf/amfd/si_dep.cc |  2 +-
1 files changed, 1 insertions(+), 1 deletions(-)


 diff --git a/osaf/services/saf/amf/amfd/si_dep.cc
 b/osaf/services/saf/amf/amfd/si_dep.cc
 --- a/osaf/services/saf/amf/amfd/si_dep.cc
 +++ b/osaf/services/saf/amf/amfd/si_dep.cc
 @@ -1912,7 +1912,7 @@ static void sidep_dependentsi_role_failo
 if (stdby_su) {
 if
 (avd_sidep_si_dependency_exists_within_su(stdby_su)) {
 for (susi = stdby_su-list_of_susi;susi !=
 NULL;susi = susi-su_next) {
 -   if (avd_susi_role_failover(susi,
 actv_su) == NCSCC_RC_FAILURE) {
 +   if (actv_su 
 avd_susi_role_failover(susi, actv_su) == NCSCC_RC_FAILURE) {
 LOG_NO( %s: %u: Active role
 modification failed for  %s ,
 __FILE__,
 __LINE__, susi-su-name.value);
 goto done;




--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] nid: cleanup should generate a core dump V2 [#1300]

2015-04-14 Thread Hans Nordebäck
Hi Mathi,

Isn't the problem that the programs nodeinit spawns are in its turn 
daemonized, i.e. now owned by the init process.
But the pid from nodeinit's initial fork, service-pid, may now be a 
zombie process?
So  the /var/run/pid files should be used in both script, daemon and the 
process case.
/Thanks HansN

On 04/14/2015 03:02 PM, Mathivanan Naickan Palanivelu wrote:
 Hi Hans,

 I have clarified to your comment below. It's an ACK anyways.

 Nodeinit sends SIGKILL to parent pid returned from fork. Sending
 SIGABRT
 the child pid should be used instead.
 Yes that's true, and a good catch. Must have been caught in the first version!

 You would have already guessed the reason also. But in case if you have not,
 then this behaviour is seen because we marked in the nodeinit.conf, for NID 
 to spawn scripts
 by specifying S
 i.e. For eg:-
 /usr/local/lib/opensaf/clc-cli/osaf-rded:RDE:S:/usr/local/lib/opensaf/clc-cli/osaf-rded:12000:-6:2:1:start:stop

 Therefore the pid is that of the script and not of our executable, also while 
 spawning scripts, NID also cancels all the signals for that process.

 If we had specified it as D for daemon or E for regular process then the 
 service-pid would have
 had the pid of that process itself.

 Thanks,
 Mathi.

 - hans.nordeb...@ericsson.com wrote:

 osaf/services/infrastructure/nid/nodeinit.c |  88
 +
   1 files changed, 88 insertions(+), 0 deletions(-)


 Nodeinit sends SIGKILL to parent pid returned from fork. Sending
 SIGABRT
 the child pid should be used instead.

 diff --git a/osaf/services/infrastructure/nid/nodeinit.c
 b/osaf/services/infrastructure/nid/nodeinit.c
 --- a/osaf/services/infrastructure/nid/nodeinit.c
 +++ b/osaf/services/infrastructure/nid/nodeinit.c
 @@ -56,6 +56,10 @@
   #include sys/time.h
   #include sys/resource.h
   
 +#include signal.h
 +#include sys/wait.h
 +#include stdint.h
 +
   #include configmake.h
   #include rda_papi.h
   #include logtrace.h
 @@ -1084,6 +1088,58 @@ uint32_t check_process(NID_SPAWN_INFO *s
  TRACE_LEAVE();
   }
   
 +
 +/
 + * Name  : get_pid_from_file
*
 + *
*
 + * Description   : Retrieves the given service name pid.
*
 + *
*
 + * Arguments : service name.
*
 + *
*
 + * Return Values :  0 - process id of given service
*
 + * -1 - error, see syslog
*
 + *
*
 +
 ***/
 +static pid_t get_pid_from_file(const char* service_name)
 +{
 +char pid_file[NAME_MAX];
 +
 +char prog_name[40];
 +char *service, *tmp;
 +FILE *f;
 +pid_t pid;
 +
 +service = (char*) malloc(strlen(service_name) +1);
 +strcpy(service, service_name);
 +tmp = service;
 +for ( ; *tmp; ++tmp) *tmp = tolower(*tmp);
 +
 +strcpy(prog_name, osaf);
 +strcat(prog_name, service);
 +free(service);
 +
 +LOG_IN( %s, prog_name);
 +
 +snprintf(pid_file, sizeof(pid_file), PKGPIDDIR /%s.pid,
 prog_name);
 +
 +if ((f = fopen(pid_file, r)) == 0) {
 +LOG_WA(Failed to open %s, pid_file);
 +return -1;
 +}
 +
 +if (fscanf(f, %d, pid) == 0) {
 +LOG_WA(Could not read PID from file %s, pid_file);
 +return -1;
 +}
 +
 +if (fclose(f) != 0) {
 +LOG_WA(Could not close file);
 +return -1;
 +}
 +
 +return pid;
 +}
 +

 /
* Name  : cleanup
*
*
*
 @@ -1108,6 +1164,38 @@ void cleanup(NID_SPAWN_INFO *service)
  nid_close_ipc();
  select_fd = -1;
   
 +pid_t w_pid;
 +pid_t pid;
 +int status;
 +uint32_t no_of_retries = 0;
 +const uint32_t MAX_NO_RETRIES = 5;
 +
 +// get pid of current service_name instead of the parent pid
 +pid = get_pid_from_file(service-serv_name);
 +if (pid  0) {
 +if (check_process(service)) {
 +// send abort signal to process to generate a core dump
 +LOG_ER(Sending SIGABRT to %s, pid=%d, (parent pid=%d),
 service-serv_name, pid, service-pid);
 +if (kill(pid, SIGABRT) = 0) {
 +// wait a short period for process to exit
 +do {
 +w_pid = waitpid(service-pid, status, 
 WNOHANG);
 +if (w_pid  0) {
 +if (errno == EINTR)
 +continue;
 +else
 +break;
 +} else if (w_pid  0) {
 +if (WIFEXITED(status) || 
 WIFSIGNALED(status)) {
 +  

Re: [devel] [PATCH 1 of 1] nid: cleanup should generate a core dump V2 [#1300]

2015-04-14 Thread Hans Nordebäck
Hi Mathi,

the daemonized process will be owned by init process but I could not see that 
there are any wait in nodeinit for the forked process, (service-pid) 
so when nodeinit exit I guess it will be orphaned/zombie and re-parent to the 
init process, not a big problem, but perhaps 
there should  be a wait added for service-pid? Which branches should the patch 
be pushed to?

/Thanks HansN  

Från: Mathivanan Naickan Palanivelu [mathi.naic...@oracle.com]
Skickat: den 14 april 2015 16:26
Till: Hans Nordebäck
Kopia: opensaf-devel@lists.sourceforge.net; Anders Widell
Ämne: Re: [PATCH 1 of 1] nid: cleanup should generate a core dump V2 [#1300]

Well, i think we can read from /var/run/opensaf/*.pid of anything that is a 
daemon that
is spawned by 'start_daemon', because you would know that the pid value inside 
the /var/run/opensaf/osaf*.pid file is
written into by the 'start_daemon' lsb command and not by NID.

Hmm, NID forks our opensaf clc-cli scripts using fork_script(). The 
fork_script() returns the pid of the child which
would be the pid of the clc-cli script.
The opensaf clc-cli scripts inturn call start_daemon which stores the pid in 
/var/run/opensaf/osaf*.pid file.

Are you referring to our clc-cli scripts becoming zombies!?

- Mathi.

- hans.nordeb...@ericsson.com wrote:

 Hi Mathi,

 Isn't the problem that the programs nodeinit spawns are in its turn
 daemonized, i.e. now owned by the init process.
 But the pid from nodeinit's initial fork, service-pid, may now be a
 zombie process?
 So  the /var/run/pid files should be used in both script, daemon and
 the
 process case.
 /Thanks HansN

 On 04/14/2015 03:02 PM, Mathivanan Naickan Palanivelu wrote:
  Hi Hans,
 
  I have clarified to your comment below. It's an ACK anyways.
 
  Nodeinit sends SIGKILL to parent pid returned from fork. Sending
  SIGABRT
  the child pid should be used instead.
  Yes that's true, and a good catch. Must have been caught in the
 first version!
 
  You would have already guessed the reason also. But in case if you
 have not,
  then this behaviour is seen because we marked in the nodeinit.conf,
 for NID to spawn scripts
  by specifying S
  i.e. For eg:-
 
 /usr/local/lib/opensaf/clc-cli/osaf-rded:RDE:S:/usr/local/lib/opensaf/clc-cli/osaf-rded:12000:-6:2:1:start:stop
 
  Therefore the pid is that of the script and not of our executable,
 also while spawning scripts, NID also cancels all the signals for that
 process.
 
  If we had specified it as D for daemon or E for regular process
 then the service-pid would have
  had the pid of that process itself.
 
  Thanks,
  Mathi.
 
  - hans.nordeb...@ericsson.com wrote:
 
  osaf/services/infrastructure/nid/nodeinit.c |  88
  +
1 files changed, 88 insertions(+), 0 deletions(-)
 
 
  Nodeinit sends SIGKILL to parent pid returned from fork. Sending
  SIGABRT
  the child pid should be used instead.
 
  diff --git a/osaf/services/infrastructure/nid/nodeinit.c
  b/osaf/services/infrastructure/nid/nodeinit.c
  --- a/osaf/services/infrastructure/nid/nodeinit.c
  +++ b/osaf/services/infrastructure/nid/nodeinit.c
  @@ -56,6 +56,10 @@
#include sys/time.h
#include sys/resource.h
 
  +#include signal.h
  +#include sys/wait.h
  +#include stdint.h
  +
#include configmake.h
#include rda_papi.h
#include logtrace.h
  @@ -1084,6 +1088,58 @@ uint32_t check_process(NID_SPAWN_INFO *s
 TRACE_LEAVE();
}
 
  +
 
 +/
  + * Name  : get_pid_from_file
 *
  + *
 *
  + * Description   : Retrieves the given service name pid.
 *
  + *
 *
  + * Arguments : service name.
 *
  + *
 *
  + * Return Values :  0 - process id of given service
 *
  + * -1 - error, see syslog
 *
  + *
 *
  +
 
 ***/
  +static pid_t get_pid_from_file(const char* service_name)
  +{
  +  char pid_file[NAME_MAX];
  +
  +  char prog_name[40];
  +  char *service, *tmp;
  +  FILE *f;
  +  pid_t pid;
  +
  +  service = (char*) malloc(strlen(service_name) +1);
  +  strcpy(service, service_name);
  +  tmp = service;
  +  for ( ; *tmp; ++tmp) *tmp = tolower(*tmp);
  +
  +  strcpy(prog_name, osaf);
  +  strcat(prog_name, service);
  +  free(service);
  +
  +  LOG_IN( %s, prog_name);
  +
  +  snprintf(pid_file, sizeof(pid_file), PKGPIDDIR /%s.pid,
  prog_name);
  +
  +  if ((f = fopen(pid_file, r)) == 0) {
  +  LOG_WA(Failed to open %s, pid_file);
  +  return -1;
  +  }
  +
  +  if (fscanf(f, %d, pid) == 0) {
  +  LOG_WA(Could not read PID from file %s, pid_file);
  +  return -1;
  +  }
  +
  +  if (fclose(f) != 0) {
  +  LOG_WA(Could not close file);
  +  return -1;
  +  }
  +
  +  return pid

Re: [devel] [PATCH 1 of 1] amfd: avoid calling failover function twice [#1298]

2015-04-13 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: nagendr...@oracle.com [mailto:nagendr...@oracle.com] 
Sent: den 9 april 2015 14:49
To: Hans Nordebäck; praveen.malv...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: avoid calling failover function twice [#1298]

 osaf/services/saf/amf/amfd/main.cc |  14 +-
 1 files changed, 13 insertions(+), 1 deletions(-)


When Amfd becomes Act, it is calling node failover function for those nodes 
also, which were already gone down and already failover has been performed by 
older Act Amfd.
This needs to be avoided.

diff --git a/osaf/services/saf/amf/amfd/main.cc 
b/osaf/services/saf/amf/amfd/main.cc
--- a/osaf/services/saf/amf/amfd/main.cc
+++ b/osaf/services/saf/amf/amfd/main.cc
@@ -405,8 +405,20 @@ static void handle_event_in_failover_sta
for (std::mapuint32_t, AVD_AVND *::const_iterator it = 
node_id_db-begin();
it != node_id_db-end(); it++) {
AVD_AVND *node = it-second;
+   bool fover_done = false;
if (AVD_AVND_STATE_ABSENT == node-node_state) {
-   avd_node_failover(node);
+   /* Check whether this node failover has been
+  performed or not. */
+   for (AVD_SU *i_su = node-list_of_ncs_su; i_su;
+   i_su = i_su-avnd_list_su_next) 
{
+   if 
((i_su-sg_of_su-sg_redundancy_model == SA_AMF_NO_REDUNDANCY_MODEL) 
+   (i_su-list_of_susi == 
NULL)) {
+   fover_done = true;
+   break;
+   }
+   }
+   if (fover_done == false)
+   avd_node_failover(node);
}
}
/* Since we are sending lots of async update to its peer from

--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: segv in avd_sidep_is_si_failover_possible #1309

2015-04-09 Thread Hans Nordebäck
Hi,

The problem has been reproduced and traces has been provided, I'll come back 
with steps how to reproduce the fault/Thanks HansN

-Original Message-
From: praveen malviya [mailto:praveen.malv...@oracle.com] 
Sent: den 8 april 2015 11:33
To: Hans Nordebäck; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1 of 1] amfd: segv in avd_sidep_is_si_failover_possible 
#1309

Hi Hans,

Please tell if there are some steps to reproduce it.

Thanks,
Praveen

On 08-Apr-15 2:38 PM, Hans Nordeback wrote:
   osaf/services/saf/amf/amfd/si_dep.cc |  2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)


 diff --git a/osaf/services/saf/amf/amfd/si_dep.cc 
 b/osaf/services/saf/amf/amfd/si_dep.cc
 --- a/osaf/services/saf/amf/amfd/si_dep.cc
 +++ b/osaf/services/saf/amf/amfd/si_dep.cc
 @@ -1912,7 +1912,7 @@ static void sidep_dependentsi_role_failo
   if (stdby_su) {
   if (avd_sidep_si_dependency_exists_within_su(stdby_su)) 
 {
   for (susi = stdby_su-list_of_susi;susi != 
 NULL;susi = susi-su_next) {
 - if (avd_susi_role_failover(susi, 
 actv_su) == NCSCC_RC_FAILURE) {
 + if (actv_su  
 avd_susi_role_failover(susi, actv_su) == NCSCC_RC_FAILURE) {
   LOG_NO( %s: %u: Active role 
 modification failed for  %s ,
   __FILE__, 
 __LINE__, susi-su-name.value);
   goto done;


--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] nid: cleanup should generate a core dump #1300

2015-04-09 Thread Hans Nordebäck
Thanks Mathi and Anders, I'll update with your review comments, and I guess it 
is ok to push this then./Thanks HansN

-Original Message-
From: Anders Widell 
Sent: den 9 april 2015 16:09
To: Hans Nordebäck; mathi.naic...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1 of 1] nid: cleanup should generate a core dump #1300

Ack with comments.

1) Maybe you should use osaf_nanosleep() instead of sleep() here?
2) Agree with Mathi that you should handle EINTR
3) When I read the man page for waitpid(), I think it is a bit unclear if the 
status variable has a defined value when waitipid() returns zero. 
Maybe it would be safer to treat the status variable as undefined in this case?
4) You need to add the following includes:

#include signal.h // for kill()
#include sys/wait.h // for waitpid()
#include stdint.h // for uint32_t

/ Anders Widell

On 04/02/2015 02:17 PM, Hans Nordeback wrote:
   osaf/services/infrastructure/nid/nodeinit.c |  24 
   1 files changed, 24 insertions(+), 0 deletions(-)


 diff --git a/osaf/services/infrastructure/nid/nodeinit.c 
 b/osaf/services/infrastructure/nid/nodeinit.c
 --- a/osaf/services/infrastructure/nid/nodeinit.c
 +++ b/osaf/services/infrastructure/nid/nodeinit.c
 @@ -1108,6 +1108,30 @@ void cleanup(NID_SPAWN_INFO *service)
   nid_close_ipc();
   select_fd = -1;
   
 + pid_t w_pid;
 + int status;
 + uint32_t no_of_retries = 0;
 + const uint32_t MAX_NO_RETRIES = 5;
 +
 + if (check_process(service)) {
 + // send abort signal to process to generate a core dump
 + LOG_ER(Sending SIGABRT to %s, pid=%d, service-serv_name, 
 service-pid);
 + if (kill(service-pid, SIGABRT) = 0) {
 + // wait a short period for process to exit
 + do {
 + w_pid = waitpid(service-pid, status, WNOHANG);
 + if (w_pid  0) {
 + break;
 + } else {
 + if (!WIFEXITED(status)  
 !WIFSIGNALED(status)) {
 + sleep(1);
 + }
 + }
 + } while (!WIFEXITED(status)  !WIFSIGNALED(status)  
 ++no_of_retries  MAX_NO_RETRIES);
 + }
 + }
 +
 + // if sending abort signal did not succeed, fallback to sigkill
   if (check_process(service)) {
   LOG_ER(Sending SIGKILL to %s, pid=%d, service-serv_name, 
 service-pid);
   kill(service-pid, SIGKILL);


--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] base: base: Dump stack trace to file on fatal signals, V3 #1281

2015-04-08 Thread Hans Nordebäck
Hi Anders,
I updated the patch with your comments and added the pid and uid to the 
header output.
Pid and uid will be available if the signal originates from the kill 
call otherwise pid and uid will be 0.

  /Thanks HansN

On 04/08/2015 02:33 PM, Anders Widell wrote:
 Ack with comments.

 * Make sure to have a properly formatted commit message (base: was 
 duplicated, square brackets missing around ticket number).
 * It could be useful to see the identity of one who sent the signal 
 (PID, maybe also UID).
 * See below for inline comments.

 / Anders Widell

 On 04/01/2015 10:32 AM, Hans Nordeback wrote:
   osaf/libs/core/common/daemon.c |  117 
 +
   1 files changed, 117 insertions(+), 0 deletions(-)


 Use dlsym on bactrace symbols to circumvent lsb compliance problems.

 diff --git a/osaf/libs/core/common/daemon.c 
 b/osaf/libs/core/common/daemon.c
 --- a/osaf/libs/core/common/daemon.c
 +++ b/osaf/libs/core/common/daemon.c
 @@ -34,6 +34,8 @@
   #include sys/stat.h
   #include sys/file.h
   +#include dlfcn.h
 +
   #include configmake.h
 #include daemon.h
 @@ -43,6 +45,8 @@
   #include os_defs.h
   #include osaf_secutil.h
   +#include sys/types.h
 +#include time.h
 #define DEFAULT_RUNAS_USERNAMEopensaf
   @@ -57,6 +61,8 @@ static unsigned int __tracemask;
   static unsigned int __nofork = 0;
   static int __logmask;
   +static void install_fatal_signal_handlers();
 C functions taking no parameters should be declared as (void) instead 
 of ().
 +
   static void __print_usage(const char* progname, FILE* stream, int 
 exit_code)
   {
   fprintf(stream, Usage:  %s [OPTIONS]...\n, progname);
 @@ -350,6 +356,9 @@ void daemonize(int argc, char *argv[])
   }
   #endif
   +/* install fatal signal handlers for writing backtrace to 
 file */
 +install_fatal_signal_handlers();
 +
 Whitespace problems on the three lines above (space instead of tab, 
 whitespace at end of line).
   /* Initialize the log/trace interface */
   if (logtrace_init_daemon(basename(argv[0]), __tracefile, 
 __tracemask, __logmask) != 0)
   exit(EXIT_FAILURE);
 @@ -414,3 +423,111 @@ void daemon_sigterm_install(int *term_fd
 *term_fd = term_sel_obj.rmv_obj;
   }
 +
 +static char bt_filename[80];
 This variable shall hold the result of sprintf(..., PKGLOGDIR 
 /bt_%s_%d, ...). PKLOGDIR is a path that can be configured by the 
 user. Therefore, this buffer ought to be either PATH_MAX bytes large, 
 or dynamically allocated.
 +
 +static int (*plibc_backtrace) (void **buffer, int size) = NULL;
 +static int (*plibc_backtrace_symbols_fd) (void *const *buffer, int 
 size, int fd) = NULL;
 +
 +static int init_backtrace_fptrs()
 C functions taking no parameters should be declared as (void) instead 
 of ().
 +{
 +plibc_backtrace = dlsym(RTLD_NEXT, backtrace);
 Should use RTLD_DEFAULT instead of RTLD_NEXT.
 +if (plibc_backtrace == NULL) {
 +syslog(LOG_ERR, unable to find \backrace\ symbol);
 +return -1;
 +}
 +plibc_backtrace_symbols_fd = dlsym(RTLD_NEXT, 
 backtrace_symbols_fd);
 Should use RTLD_DEFAULT instead of RTLD_NEXT.
 +if (plibc_backtrace_symbols_fd == NULL) {
 +syslog(LOG_ERR, unable to find \backrace_symbols_fd\ 
 symbol);
 +return -1;
 +}
 +return 0;
 +}
 +
 +/**
 + * Signal handler for fatal errors. Writes a backtrace and 
 re-throws the signal.
 + */
 +static void fatal_signal_handler(int sig, siginfo_t* siginfo, void* 
 ctx)
 +{
 +const int BT_ARRAY_SIZE = 20;
 +void *bt_array[BT_ARRAY_SIZE];
 +size_t bt_size;
 +int fd;
 +char bt_header[30];
 +
 +if ((fd = open(bt_filename, O_RDWR|O_CREAT, 0644))  0) {
 +goto done;
 +}
 +
 +snprintf(bt_header, sizeof(bt_header), signal: %d\n, sig);
 +
 +if (write(fd, bt_header, strlen(bt_header))  0) {
 +close(fd);
 +goto done;
 +}
 +
 +bt_size = plibc_backtrace(bt_array, BT_ARRAY_SIZE);
 +plibc_backtrace_symbols_fd(bt_array, bt_size, fd);
 +
 +close(fd);
 +done:
 +// re-throw the signal
 +raise(sig);
 +}
 +
 +/**
 + * Install signal handlers for fatal errors to be able to print a 
 backtrace.
 + */
 +static void install_fatal_signal_handlers()
 C functions taking no parameters should be declared as (void) instead 
 of ().
 +{
 +
 +time_t current_time;
 +char time_string[20];
 +
 +struct sigaction action;
 +int i = 0;
 +const int HANDLED_SIGNALS_MAX = 7;
 +static const int handled_signals[] = {
 +SIGHUP,
 +SIGILL,
 +SIGABRT,
 +SIGFPE,
 +SIGSEGV,
 +SIGPIPE,
 +SIGBUS
 +};
 +
 +// to circumvent lsb use dlsym to retrieve backtrace in runtime
 +if (init_backtrace_fptrs()  0) {
 +syslog(LOG_WARNING, backtrace symbols not found, no fatal 
 signal handlers will be installed);
 +}
 +else {
 No new line before the else keyword.
 +
 +// prepare a filename for 

Re: [devel] [PATCH 1 of 1] amfd: fix controller swap in 4.4.2 [#1257]

2015-04-01 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 04/01/2015 02:41 PM, praveen.malv...@oracle.com wrote:
   osaf/services/saf/amf/amfd/role.cc |  10 +++---
   1 files changed, 7 insertions(+), 3 deletions(-)


 diff --git a/osaf/services/saf/amf/amfd/role.cc 
 b/osaf/services/saf/amf/amfd/role.cc
 --- a/osaf/services/saf/amf/amfd/role.cc
 +++ b/osaf/services/saf/amf/amfd/role.cc
 @@ -591,26 +591,30 @@ static void reset_admin_op_params_after_
   while (NULL != (node = avd_node_getnext_nodeid(node_id))) {
   node-admin_node_pend_cbk.invocation = 0;
   node-admin_node_pend_cbk.admin_oper = 
 static_castSaAmfAdminOperationIdT(0);
 + node_id = node-node_info.nodeId;
   }
   //For SI.
   AVD_SI *si;
   dn.length = 0;
 - for (si = avd_si_getnext(dn); si != NULL; si = avd_si_getnext(dn))
 + for (si = avd_si_getnext(dn); si != NULL; si = avd_si_getnext(dn)) {
   si-invocation = 0;
 + dn = si-name;
 + }
   //For SG.
   AVD_SG *sg = NULL;
   dn.length = 0;
   for (sg = avd_sg_getnext(dn); sg != NULL; sg = 
 avd_sg_getnext(dn)) {
   sg-adminOp_invocationId = 0;
   sg-adminOp = static_castSaAmfAdminOperationIdT(0);
 + dn = sg-name;
   }
   //For SU.
   AVD_SU *su;
   dn.length = 0;
   for (su = avd_su_getnext(dn); su != NULL; su = avd_su_getnext(dn)) {
   su-pend_cbk.invocation = 0;
 -su-pend_cbk.admin_oper = 
 static_castSaAmfAdminOperationIdT(0);
 -
 + su-pend_cbk.admin_oper = 
 static_castSaAmfAdminOperationIdT(0);
 + dn = su-name;
   }
   TRACE_LEAVE();
   }


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: reset admin op params during controller role swap [#1257]

2015-03-30 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 03/24/2015 12:49 PM, praveen.malv...@oracle.com wrote:
   osaf/services/saf/amf/amfd/role.cc |  70 
 +
   1 files changed, 55 insertions(+), 15 deletions(-)


 If two controller switchover occurs during lock operation on node, su etc; 
 then
 unlock does gets timeout after try again.

 AMF does not clear admin op params like invocation id and operation
 id during controller switchover.

 Patch fixes the problem by clearing above mentioned params during controller
 swichover.

 diff --git a/osaf/services/saf/amf/amfd/role.cc 
 b/osaf/services/saf/amf/amfd/role.cc
 --- a/osaf/services/saf/amf/amfd/role.cc
 +++ b/osaf/services/saf/amf/amfd/role.cc
 @@ -576,7 +576,57 @@ void avd_role_switch_ncs_su_evh(AVD_CL_C
   
   TRACE_LEAVE();
   }
 +/**
 + * @brief  Resets admin op params for all admin op capable AMF entities 
 during
 + * when active AMFD gives implementer role during controller 
 switchover.
 + */
 +static void reset_admin_op_params_after_impl_clear()
 +{
 + TRACE_ENTER();
 + //For ng.
 + for (std::mapstd::string, AVD_AMF_NG*::const_iterator it = 
 nodegroup_db-begin();
 + it != nodegroup_db-end(); it++) {
 + AVD_AMF_NG *ng = it-second;
 + if (ng-admin_ng_pend_cbk.invocation != 0) {
 + ng-admin_ng_pend_cbk.invocation = 0;
 + ng-admin_ng_pend_cbk.admin_oper = 
 static_castSaAmfAdminOperationIdT(0);
 + for (std::setstd::string::const_iterator iter = 
 ng-saAmfNGNodeList.begin();
 + iter != ng-saAmfNGNodeList.end(); 
 ++iter) {
 + AVD_AVND *node = avd_node_get(*iter);
 + node-admin_ng = NULL;
 + }
 + }
 + }
 + //For Node.
 + for (std::mapuint32_t, AVD_AVND *::const_iterator it = 
 node_id_db-begin();
 + it != node_id_db-end(); it++) {
 + AVD_AVND *node = it-second;
 + node-admin_node_pend_cbk.invocation = 0;
 + node-admin_node_pend_cbk.admin_oper = 
 static_castSaAmfAdminOperationIdT(0);
 + }
 + //For SI.
 + for (std::mapstd::string, AVD_SI*::const_iterator it = si_db-begin();
 + it != si_db-end(); it++) {
 + AVD_SI *si = it-second;
 + si-invocation = 0;
 + }
 + //For SG.
 + for (std::mapstd::string, AVD_SG*::const_iterator it = sg_db-begin();
 + it != sg_db-end(); it++) {
 + AVD_SG *sg = it-second;
 + sg-adminOp_invocationId = 0;
 + sg-adminOp = static_castSaAmfAdminOperationIdT(0);
 + }
 + //For SU.
 + for (std::mapstd::string, AVD_SU*::const_iterator it = su_db-begin();
 + it != su_db-end(); it++) {
 + AVD_SU *su = it-second;
 + su-pend_cbk.invocation = 0;
 +su-pend_cbk.admin_oper = 
 static_castSaAmfAdminOperationIdT(0);
   
 + }
 + TRACE_LEAVE();
 +}
   
 /*
* Function: avd_mds_qsd_role_func
*
 @@ -663,21 +713,11 @@ void avd_mds_qsd_role_evh(AVD_CL_CB *cb,
   cb-swap_switch = false;
   amfd_switch_qsd_actv(cb);
   }
 - /*Since this AMFD has given up implementor role, clear admin operation 
 params
 -for admin operation on nodegroup*/
 - for (std::mapstd::string, AVD_AMF_NG*::const_iterator it = 
 nodegroup_db-begin();
 - it != nodegroup_db-end(); it++) {
 - AVD_AMF_NG *ng = it-second;
 - if (ng-admin_ng_pend_cbk.invocation != 0) {
 - ng-admin_ng_pend_cbk.invocation = 0;
 - ng-admin_ng_pend_cbk.admin_oper = 
 static_castSaAmfAdminOperationIdT(0);
 - for (std::setstd::string::const_iterator iter = 
 ng-saAmfNGNodeList.begin();
 - iter != ng-saAmfNGNodeList.end(); 
 ++iter) {
 - AVD_AVND *node = avd_node_get(*iter);
 - node-admin_ng = NULL;
 - }
 - }
 - }
 + /*
 +Since this AMFD has given up implementor role, clear admin operation 
 params
 +for admin operation on AMF entities.
 +  */
 + reset_admin_op_params_after_impl_clear();
   TRACE_LEAVE();
   }
   


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/

Re: [devel] [PATCH 1 of 1] amfd: do not send multiple notificaitons for node admin state [#1284]

2015-03-25 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 03/25/2015 05:44 AM, praveen.malv...@oracle.com wrote:
   osaf/services/saf/amf/amfd/node.cc |  2 ++
   1 files changed, 2 insertions(+), 0 deletions(-)


 diff --git a/osaf/services/saf/amf/amfd/node.cc 
 b/osaf/services/saf/amf/amfd/node.cc
 --- a/osaf/services/saf/amf/amfd/node.cc
 +++ b/osaf/services/saf/amf/amfd/node.cc
 @@ -692,6 +692,8 @@ void node_admin_state_set(AVD_AVND *node
   {
   SaAmfAdminStateT old_state  = node-saAmfNodeAdminState;
   
 + if (old_state == admin_state)
 + return;
   osafassert(admin_state = SA_AMF_ADMIN_SHUTTING_DOWN);
   if (0 != node-clm_pend_inv) {
   /* Clm operations going on, skip notifications and rt updates 
 for node change. We are using node state


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: checkpoint node admin state during clm lock [#409]

2015-03-25 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 03/19/2015 10:24 AM, nagendr...@oracle.com wrote:
 + m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, 
 su-su_on_node, AVSV_CKPT_AVND_ADMIN_STATE);


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 7] amfd : support shutdown, lock and unlock for 2N, NoRed and NWay_Active on NG[#1235]

2015-03-16 Thread Hans Nordebäck
Ack. /Thanks HansN

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 2 mars 2015 14:35
To: Hans Nordebäck; nagendr...@oracle.com; Bertil Engelholm; 
mathi.naic...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 7] amfd : support shutdown, lock and unlock for 2N, NoRed 
and NWay_Active on NG[#1235]

 osaf/services/saf/amf/amfd/comp.cc   |   14 +
 osaf/services/saf/amf/amfd/include/comp.h|1 +
 osaf/services/saf/amf/amfd/include/node.h|   16 +-
 osaf/services/saf/amf/amfd/include/sg.h  |   24 +-
 osaf/services/saf/amf/amfd/include/su.h  |3 +
 osaf/services/saf/amf/amfd/node.cc   |   17 +
 osaf/services/saf/amf/amfd/nodegroup.cc  |  414 ++-
 osaf/services/saf/amf/amfd/role.cc   |   17 +-
 osaf/services/saf/amf/amfd/sg.cc |   82 +
 osaf/services/saf/amf/amfd/sgproc.cc |  122 +++-
 osaf/services/saf/amf/amfd/su.cc |   72 -
 osaf/services/saf/amf/config/amf_classes.xml |8 +
 12 files changed, 770 insertions(+), 20 deletions(-)


Description of important changes in files:
*)comp.cc:
-utility function to check if any admin operation is going on component.
*)node.cc:
-A node can belong to several nodegroups. A utility function
 is added to check if all the nodegroups of a node are unlocked.
 If any nodegroup of node is not unlocked then SUs on any node
 of the nodegroup cannot be assigned any role irrespective of node
 admin state.
*)nodegroup.cc:
-Support for saAmfNGAdminState.
-Support for shutdown, lock and unlock operation for 2N, NoRed and 
NWay_Active models.
-Shutdown and lock operation executes parallely on all the nodes.
 Individual nodes also moves to LOCKED state along with nodegroup
 during shutdown and lock operation.
-Before accepting any of the three supported operations, AMF verifies
 if operation could be executed. AMF rejects operation on following 
conditionsi:
--If any AMF entity deployed on anyone of nodesis unstable.
--If a node contains a SU of NWay or NpM red models.
 Also because of shutdown or lock operation if there is going to be 
complete
 service outage in a SG on the nodegroup, AMF throws only syslogs a 
notice, but
 operation will continue.
-For shutdown and lock operation, AMF picks each node of nodegroup and 
it calls
 nodegroup admin operation handler (ng_admin()) for each SU of that 
node. This
 handler is written for the presently supported red models in 
sg_2n_fsm.cc,
 sg_nored_fsm.cc and sg_nwayact_fsm.cc.
-For unlock operation, AMF unlocks all the nodes and enables hosted 
SUs.It then
 calls assignment algorithm for the red model to which SU belongs.
 Thus SUs will be assigned according to their ranks.
*)role.cc:
   -If controller switchover occurs when any admin operation is going
on the nodegroup then AMF clears all the admin operation related
parameters.

*)sg.cc:
-Member function (is_sg_assigned_only_in_ng()) to check if SG has
 assignments only on the nodes of nodegroup.
-Member function (check_sg_stability()) to check if any admin
 operation is going on SG.
-Member function (is_sg_serviceable_outside_ng()) to check SG will
 have assignments outside the nodegroup after completion of shutdown
 or lock operation.
*)sgproc.cc:
-Whenever AMFD gets any assignment response from AMFND, it run SG FSM
 for that SU. After this AMF evaluates if it has to respond to IMM for
 pending admin operationon AMF entities.process_su_si_response_for_ng()
 does same functionality for nodegroup. This function also moves
 individual nodes and nodegroup from shutting_down to locked state.
*)su.cc:
-SU inservice availabilty c and SU instantiability criteria also 
includes
nodegroup admin state check.
-Member functions (any_susi_fsm_in_*())to check if any SUSI of SU is 
undergoing
modification or removal of assignments.
-Member function (check_su_stability()) to  check if any admin
 operation is going on SG.

diff --git a/osaf/services/saf/amf/amfd/comp.cc 
b/osaf/services/saf/amf/amfd/comp.cc
--- a/osaf/services/saf/amf/amfd/comp.cc
+++ b/osaf/services/saf/amf/amfd/comp.cc
@@ -1574,3 +1574,17 @@ bool comp_is_preinstantiable(const AVD_C
(category == 
AVSV_COMP_TYPE_PROXIED_LOCAL_PRE_INSTANTIABLE) ||
(category == AVSV_COMP_TYPE_EXTERNAL_PRE_INSTANTIABLE));
 }
+
+/**
+ * @brief  Verify if component is undergoing any admin operation.
+ * @param  ptr to component(AVD_COMP).
+ * @Return SA_AIS_OK/SA_AIS_ERR_TRY_AGAIN.
+ */
+SaAisErrorT check_comp_stability(const AVD_COMP *comp

Re: [devel] [PATCH 5 of 7] amfd : checkpoint saAmfNGAdminState of NG [#1235]

2015-03-12 Thread Hans Nordebäck
Ack, one comment below/Thanks HansN

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 2 mars 2015 14:35
To: Hans Nordebäck; nagendr...@oracle.com; Bertil Engelholm; 
mathi.naic...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 5 of 7] amfd : checkpoint saAmfNGAdminState of NG [#1235]

 osaf/services/saf/amf/amfd/chkop.cc   |  13 
 osaf/services/saf/amf/amfd/ckpt_dec.cc|  83 +-
 osaf/services/saf/amf/amfd/ckpt_edu.cc|   2 +
 osaf/services/saf/amf/amfd/ckpt_enc.cc|  24 +++-
 osaf/services/saf/amf/amfd/include/ckpt.h |   4 +-
 osaf/services/saf/amf/amfd/include/ckpt_msg.h |   1 +
 osaf/services/saf/amf/amfd/nodegroup.cc   |   1 +
 7 files changed, 120 insertions(+), 8 deletions(-)


Checkpointing of saAmfNGAdminState is needed because of two cases:
1)If during shutdown operation controller fail-over or switch-over
  occurs then new active controller will have to move NG to LOCKED
  admin state after completion of shutdown operation.
2)For 2N model (in future for NpM and NWay ) AMF performs SG shutdown or
  lock equivalent admin operation using saAmfSGAdminState if both active
  and standby SUs are hosted on nodes of nodegroup. So after completion of
  operation AMF will have to revert back saAmfSGAdminState.

In brief changes are:
-Patch enhances AMF MBCSV sub part version to 7 as a new async update for 
saAmfNGAdminState is added.
-New aync update counter for updates related to nodegroup 
(cb-async_updt_cnt.ng_updt).
-Encode and decode utility for saAmfNGAdminState.
-No async update for saAmfNGAdminState if peer AMFD has lower  
AVD_MBCSV_SUB_PART_VERSION than the updated version 7 
(AVD_MBCSV_SUB_PART_VERSION_7).
 This is the case when new AMFD is active with new version 
AVD_MBCSV_SUB_PART_VERSION_7  and old AMFD is standby.
-Simlilarly during cold sync update if new AMFD comes as standby with 
AVD_MBCSV_SUB_PART_VERSION_7  and old AMFD is active with 
versionAVD_MBCSV_SUB_PART_VERSION_7 then cb-async_updt_cnt.ng_updt  will not 
be matched.

diff --git a/osaf/services/saf/amf/amfd/chkop.cc 
b/osaf/services/saf/amf/amfd/chkop.cc
--- a/osaf/services/saf/amf/amfd/chkop.cc
+++ b/osaf/services/saf/amf/amfd/chkop.cc
@@ -1032,6 +1032,19 @@ uint32_t avsv_send_ckpt_data(AVD_CL_CB *
case AVSV_CKPT_AVD_COMP_CS_TYPE_CONFIG:
cb-async_updt_cnt.compcstype_updt++;
break;
+   case AVSV_CKPT_NG_ADMIN_STATE:
+   /* Below check is for the case when new AMFD 
(AVD_MBCSV_SUB_PART_VERSION_7) is 
+  active and old AMFD (AVD_MBCSV_SUB_PART_VERSION_7) is 
standby.
+  In this case no need to send the message to standby as this 
async is newly
+  added.
+*/
+   if (avd_cb-avd_peer_ver  AVD_MBCSV_SUB_PART_VERSION_7) {
+   LOG_NO(No ckpt for NG_ADMIN_STATE as peer AMFD has
+lower version:%d, 
avd_cb-avd_peer_ver);
+   return NCSCC_RC_SUCCESS;
+   }
+   cb-async_updt_cnt.ng_updt++;
+   break;
 
default:
return NCSCC_RC_SUCCESS;
diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
b/osaf/services/saf/amf/amfd/ckpt_dec.cc
--- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
+++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
@@ -82,6 +82,7 @@ static uint32_t dec_comp_pres_state(AVD_  static uint32_t 
dec_comp_restart_count(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec);  static uint32_t 
dec_cs_oper_su(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec);  static uint32_t 
dec_comp_cs_type_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec);
+static uint32_t dec_ng_admin_state(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC 
+*dec);
 
 /* Declaration of static cold sync decode functions */  static uint32_t 
dec_cs_cb_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec, uint32_t num_of_obj); @@ 
-172,7 +173,8 @@ const AVSV_DECODE_CKPT_DATA_FUNC_PTR avd
dec_comp_restart_count,
NULL,   /* AVSV_SYNC_COMMIT */
dec_su_restart_count,
-   dec_si_dep_state
+   dec_si_dep_state,
+   dec_ng_admin_state
 };
 
 /*
@@ -1089,6 +1091,28 @@ static uint32_t dec_sg_admin_state(AVD_C
 
cb-async_updt_cnt.sg_updt++;
 
+   //For 2N model check if this checkpointing being done in the context of 
nodegroup operation.
+   if ((sg-sg_ncs_spec == false)  (sg-sg_redundancy_model == 
SA_AMF_2N_REDUNDANCY_MODEL)) {
+   if (((sg-saAmfSGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) ||
+(sg-saAmfSGAdminState == SA_AMF_ADMIN_LOCKED)) 
+(sg-ng_using_saAmfSGAdminState == false)) { 
+   for (std::mapstd::string, AVD_AMF_NG*::const_iterator 
it = nodegroup_db-begin();
+   it != nodegroup_db-end(); it++) {
+   AVD_AMF_NG *ng

Re: [devel] [PATCH 4 of 7] amfd: modify assignments of NoRed SU during admin op on NG [#1235]

2015-03-12 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 2 mars 2015 14:35
To: Hans Nordebäck; nagendr...@oracle.com; Bertil Engelholm; 
mathi.naic...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 4 of 7] amfd: modify assignments of NoRed SU during admin op on 
NG [#1235]

 osaf/services/saf/amf/amfd/include/sg.h|   1 +
 osaf/services/saf/amf/amfd/sg_nored_fsm.cc |  40 ++
 2 files changed, 41 insertions(+), 0 deletions(-)


Handles modification of assignments in SU of NoRed SG because of lock or 
shutdown operation on Node group.
If SU does not have any SIs assigned to it, AMF will try to instantiate new SUs 
in the SG. If SU has assignments, then depending upon lock or shutdown 
operation, quiesced or quiescing state will be sent for the SU.

diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
b/osaf/services/saf/amf/amfd/include/sg.h
--- a/osaf/services/saf/amf/amfd/include/sg.h
+++ b/osaf/services/saf/amf/amfd/include/sg.h
@@ -464,6 +464,7 @@ public:
struct avd_su_si_rel_tag *susi, AVSV_SUSI_ACT act, 
SaAmfHAStateT state);
uint32_t susi_failed(AVD_CL_CB *cb, AVD_SU *su,
struct avd_su_si_rel_tag *susi, AVSV_SUSI_ACT act, 
SaAmfHAStateT state);
+   void ng_admin(AVD_SU *su, AVD_AMF_NG *ng) ;
 private:
AVD_SU *assign_sis_to_sus();
 };
diff --git a/osaf/services/saf/amf/amfd/sg_nored_fsm.cc 
b/osaf/services/saf/amf/amfd/sg_nored_fsm.cc
--- a/osaf/services/saf/amf/amfd/sg_nored_fsm.cc
+++ b/osaf/services/saf/amf/amfd/sg_nored_fsm.cc
@@ -1178,6 +1178,46 @@ uint32_t SG_NORED::sg_admin_down(AVD_CL_
 
return NCSCC_RC_SUCCESS;
 }
+/*
+ * @brief  Handles modification of assignments in SU of NoRed SG
+ * because of lock or shutdown operation on Node group.
+ * If SU does not have any SIs assigned to it, AMF will try
+ * to instantiate new SUs in the SG. If SU has assignments,
+ * then depending upon lock or shutdown operation, quiesced
+ * or quiescing state will be sent for the SU.
+ *
+ * @param[in]  ptr to SU
+ * @param[in]  ptr to nodegroup AVD_AMF_NG.
+ */
+void SG_NORED::ng_admin(AVD_SU *su, AVD_AMF_NG *ng) {
+   TRACE_ENTER2('%s', sg_fsm_state:%u,su-name.value,
+   su-sg_of_su-sg_fsm_state);
+   if (su-list_of_susi == NULL) {
+   avd_sg_app_su_inst_func(avd_cb, su-sg_of_su);
+   return;
+   }
+   SaAmfHAStateT ha_state;
+   if (ng-saAmfNGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN)
+   ha_state = SA_AMF_HA_QUIESCING;
+   else 
+   ha_state = SA_AMF_HA_QUIESCED;
+   //change the state for all assignments to quiescing/quiesced.
+   if (avd_susi_mod_send(su-list_of_susi, ha_state) == NCSCC_RC_FAILURE) {
+   LOG_ER(quiescing state transtion failed for 
'%s',su-name.value);
+   return;
+   }
+   avd_sg_su_oper_list_add(avd_cb, su, false);
+   su-sg_of_su-set_fsm_state(AVD_SG_FSM_SG_REALIGN);
+   //Increment node counter for tracking status of ng operation.
+   if (su-list_of_susi-fsm == AVD_SU_SI_STATE_MODIFY) {
+   su-su_on_node-su_cnt_admin_oper++;
+   TRACE(node:%s, su_cnt_admin_oper:%u, 
su-su_on_node-name.value,
+   su-su_on_node-su_cnt_admin_oper);
+   }
+   TRACE_LEAVE();
+   return;
+}
 
 SG_NORED::~SG_NORED() {
 }

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: send commit message after async updates [#371]

2015-03-12 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 03/12/2015 08:12 AM, nagendr...@oracle.com wrote:
   osaf/services/saf/amf/amfd/main.cc |  6 ++
   1 files changed, 6 insertions(+), 0 deletions(-)


 During switchover, if payload is being stopped, Standby Amfd crashes
 in avd_dec_warm_sync_rsp because of counter mismatch.
 Counter mismatch happens because newly Act Amfd updates its
 own counters in avd_node_failover in handle_event_in_failover_state,
 and sends it to its Standby peer, but it doesn't send AVSV_SYNC_COMMIT
 to its Standby peer. Once AVSV_SYNC_COMMIT is received by Standby Amfd,
 it processes those messages and updates its ounter and become in sync
 with Act Amfd.
 Since Act Amfd has updated counter and AVSV_SYNC_COMMIT is not sent, Standby
 Amfd has older counters. Now, if warm sync request comes at Act Amfd at
 this point of time, then Act Amfd fills updated counter and sends it
 to Standby Amfd. Now, Standby Amfd receives warn sync message and compares
 them with its own counter, which is older, because it has not processed
 those aync update as Act Amfd didn't send AVSV_SYNC_COMMIT message.
 Since counters will be out of sync and Standby Amfd will crash.

 So, if Act Amfd sends AVSV_SYNC_COMMIT message, Standby Amfd will
 process sync updates and will have its counters updated. This will avoid
 counters mismatch at Standby Amfd and will avoid the crash.

 diff --git a/osaf/services/saf/amf/amfd/main.cc 
 b/osaf/services/saf/amf/amfd/main.cc
 --- a/osaf/services/saf/amf/amfd/main.cc
 +++ b/osaf/services/saf/amf/amfd/main.cc
 @@ -409,6 +409,12 @@ static void handle_event_in_failover_sta
   avd_node_failover(node);
   }
   }
 + /* Since we are sending lots of async update to its peer from
 +avd_node_failover, let us send commit message from here.
 +Otherwise, if warm sync message comes at this point of time,
 +Standby Amfd will crash. */
 + if (cb-sync_required == true)
 + m_AVSV_SEND_CKPT_UPDT_SYNC(cb, NCS_MBCSV_ACT_UPDATE, 0);
   }
   
   TRACE_LEAVE();


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 6 of 7] amfd: send state change notification for saAmfNGAdminState [#1235]

2015-03-12 Thread Hans Nordebäck
ok, but it should be an enum, not a define./Thanks Hans

On 03/12/2015 01:17 PM, praveen malviya wrote:


 On 12-Mar-15 5:38 PM, Hans Nordebäck wrote:
 Ack, code review only. Question, why is SA_AMF_NTFID_NG_ADMIN_STATE  
 not added to SaAmfNotificationMinorIdT enum? /Thanks HansN

 Since it is not present in spec/saAmf.h, I kept it internal to AMF. I 
 will update it in PR doc.


 Thanks,
 Praveen
 -Original Message-
 From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com]
 Sent: den 2 mars 2015 14:35
 To: Hans Nordebäck; nagendr...@oracle.com; Bertil Engelholm; 
 mathi.naic...@oracle.com
 Cc: opensaf-devel@lists.sourceforge.net
 Subject: [PATCH 6 of 7] amfd: send state change notification for 
 saAmfNGAdminState [#1235]

   osaf/services/saf/amf/amfd/include/ntf.h |  2 ++ 
 osaf/services/saf/amf/amfd/nodegroup.cc  |  3 +++
   2 files changed, 5 insertions(+), 0 deletions(-)


 Patch sends state change notification for saAmfNGAdminState with 
 minorId (0x72) for three admin state values:
 SA_AMF_ADMIN_UNLOCKED =1,
 SA_AMF_ADMIN_LOCKED = 2,
 SA_AMF_ADMIN_SHUTTING_DOWN = 4

 diff --git a/osaf/services/saf/amf/amfd/include/ntf.h 
 b/osaf/services/saf/amf/amfd/include/ntf.h
 --- a/osaf/services/saf/amf/amfd/include/ntf.h
 +++ b/osaf/services/saf/amf/amfd/include/ntf.h
 @@ -39,6 +39,8 @@
   #define OLD_STATE_NA 0
   #define NEW_STATE_NA 0

 +/*For nodegroup admin state notification*/ #define
 +SA_AMF_NTFID_NG_ADMIN_STATE 0x072
   /* Alarms */
   void avd_send_comp_inst_failed_alarm(const SaNameT *comp_name, 
 const SaNameT *node_name);  void 
 avd_send_comp_clean_failed_alarm(const SaNameT *comp_name, const 
 SaNameT *node_name); diff --git 
 a/osaf/services/saf/amf/amfd/nodegroup.cc 
 b/osaf/services/saf/amf/amfd/nodegroup.cc
 --- a/osaf/services/saf/amf/amfd/nodegroup.cc
 +++ b/osaf/services/saf/amf/amfd/nodegroup.cc
 @@ -565,6 +565,9 @@ void avd_ng_admin_state_set(AVD_AMF_NG*
 const_castSaImmAttrNameT(saAmfNGAdminState),
   SA_IMM_ATTR_SAUINT32T, ng-saAmfNGAdminState);
   m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, ng, 
 AVSV_CKPT_NG_ADMIN_STATE);
 +avd_send_admin_state_chg_ntf(ng-name,
 + (SaAmfNotificationMinorIdT)SA_AMF_NTFID_NG_ADMIN_STATE,
 +old_state, ng-saAmfNGAdminState);
   }
   /**
* @brief  Verify if Node is stable for admin operation on 
 Nodegroup etc.




--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfnd: issue remove cbk for assigning csi after successful assignment V2[#1046]

2015-03-10 Thread Hans Nordebäck
Ack, code review only.

/Thanks HansN

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 5 mars 2015 05:07
To: Hans Nordebäck; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfnd: issue remove cbk for assigning csi after 
successful assignment V2[#1046]

 osaf/services/saf/amf/amfnd/comp.cc |  55 
 osaf/services/saf/amf/amfnd/include/avnd_comp.h |   5 ++
 osaf/services/saf/amf/amfnd/sidb.cc |   1 +
 3 files changed, 51 insertions(+), 10 deletions(-)


This is version-2 after removing check on SI for REMOVED state.
This check is not needed as a SI moves to REMOVED state only after all of its 
CSIs are removed.

A user locks a SI and a component faults with comp_restart recovery during 
remove callback on standby SU. After this when user tries to unlock SI, unlock 
operation gets timed out.

When AMFND gets removal of assignment on standby SU (having three comps), 
because of lock operation on SI, it issues removal callback to comp1. While 
comp1 is handling removal callback another healthy component, which is still 
assigned for a CSI of this SI, faults with comp_restart recovery. When comp2 
gets repaired, AMF reassigns CSIs to it. In the meantime, when comp1 responds 
for the removal callback AMFND does not issue removal callback to the CSI of 
comp2 as it is in assigning state.
AMFND goes on and finishes removal in comp3. After successful reassignments in 
comp2, AMFND does not issue removal callback to comp2. Due to this, AMFD did 
not get response from AMFND for successful removal of SI.

Patch fixes the problem by issuing removal callback for a assigning CSI after 
successful assignment.

diff --git a/osaf/services/saf/amf/amfnd/comp.cc 
b/osaf/services/saf/amf/amfnd/comp.cc
--- a/osaf/services/saf/amf/amfnd/comp.cc
+++ b/osaf/services/saf/amf/amfnd/comp.cc
@@ -1558,6 +1558,17 @@ uint32_t avnd_comp_csi_assign_done(AVND_
rc = avnd_su_si_oper_done(cb, comp-su, 
m_AVND_SU_IS_ALL_SI(comp-su) ? NULL : csi-si);
}
}
+
+   /*
+  If this CSI was in assigning state due to component restart 
and that time removal
+  request came from AMFD, AMFND waits for the completion of 
assignment.
+  After successful assignment, AMFND will start removal of CSI.
+*/
+   if ((csi-pending_removal == true) 
+   (csi-si-curr_assign_state == 
AVND_SU_SI_ASSIGN_STATE_REMOVING)) {
+   rc = avnd_comp_csi_remove(cb, csi-comp, csi);
+   csi-pending_removal = false;
+   }
} else {/* assign all the csis belonging to the next 
rank in one shot */
/* get the first csi-record for this comp */
curr_csi = 
m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(comp-csi_list));
@@ -1579,6 +1590,19 @@ done:
TRACE_LEAVE2(%u, rc);
return rc;
 }
+
+static bool all_csis_in_si_removed(const AVND_SU_SI_REC *si) {
+   AVND_COMP_CSI_REC *csi;
+   for (csi = (AVND_COMP_CSI_REC *)m_NCS_DBLIST_FIND_FIRST(si-csi_list);
+   csi; 
+   csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_NEXT(csi-si_dll_node)) 
+{
+
+   if (csi-curr_assign_state != 
AVND_COMP_CSI_ASSIGN_STATE_REMOVED)
+   return false;
+   }
+   return true;
+}
 /**
  * @brief   Checks if all csis of all the sis in this su are in removed 
state
  *
@@ -1679,18 +1703,29 @@ uint32_t avnd_comp_csi_remove_done(AVND_
goto done;
}
else {
-   curr_csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_PREV(csi-si_dll_node);
-
-   /* assign the csi */
-   if (curr_csi)
-   rc = avnd_comp_csi_remove(cb, curr_csi-comp, 
curr_csi);
-   else
-   /* all csis belonging to the si are removed */
+   for (curr_csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_LAST(csi-si-csi_list);
+   curr_csi;
+   curr_csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_PREV(curr_csi-si_dll_node)) {
+   if 
(m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_REMOVED(curr_csi)) 
+   continue;
+   else if 
(m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_REMOVING(curr_csi)) 
+   break;
+   else if 
(m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_ASSIGNING(curr_csi)) {
+   TRACE('%s' is getting assigned, remove 
it after assignment,
+   curr_csi

Re: [devel] [PATCH 1 of 1] amfd: do not assign dependent csi if any sponsor csi is unassigned [#687]

2015-03-10 Thread Hans Nordebäck
Ack, code review only.

/Thanks HansN

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 29 januari 2015 12:26
To: Hans Nordebäck; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: do not assign dependent csi if any sponsor csi is 
unassigned [#687]

 osaf/services/saf/amf/amfd/csi.cc|  31 
 osaf/services/saf/amf/amfd/include/csi.h |   1 +
 osaf/services/saf/amf/amfd/sgproc.cc |  40 
 3 files changed, 72 insertions(+), 0 deletions(-)


A CSI is configured with CSI dependency on multiple sponsor CSIs. When user 
UNLOCKs SUs, AMF is assigning the dependent CSI in the case when only some 
sponsors are assigned.

Even if one sponsor is unassigned, AMF should not assign dependent CSI.
In this particular issue, one sponsor remained unassigned because compcsType 
was not configured for the csType of unassigned sponsor.
At present, AMF does not have mechanism to strictly check the configuration 
from assignment perspective.

AMF will not assign dependent CSI if any sponsor CSI is unassigned.

diff --git a/osaf/services/saf/amf/amfd/csi.cc 
b/osaf/services/saf/amf/amfd/csi.cc
--- a/osaf/services/saf/amf/amfd/csi.cc
+++ b/osaf/services/saf/amf/amfd/csi.cc
@@ -1383,3 +1383,34 @@ bool csi_assignment_validate(AVD_SG *sg)
return true;
return false;
 }
+
+
+/**
+ * @brief   Checks if sponsor CSIs of any CSI are assigned to any comp in 
this SU.
+ *
+ * @param[in]   ptr to CSI.
+ * @param[in]   ptr to SU.
+ *
+ * @return  true/false.
+ */
+bool are_sponsor_csis_assigned_in_su(AVD_CSI *csi, AVD_SU *su) {
+for (AVD_CSI_DEPS *spons_csi = csi-saAmfCSIDependencies; spons_csi != 
NULL;
+spons_csi = spons_csi-csi_dep_next) {
+   bool is_sponsor_assigned = false;
+   
+AVD_CSI *tmp_csi =  
+ csi_db-find(Amf::to_string(spons_csi-csi_dep_name_value));
+
+   //Check if this sponsor csi is assigned to any comp in this su.
+   for (AVD_COMP_CSI_REL *compcsi = tmp_csi-list_compcsi; compcsi;
+   compcsi = compcsi-csi_csicomp_next) {  
+   if (compcsi-comp-su == su)
+   is_sponsor_assigned = true;
+   }
+   //Return false if this sponsor is not assigned to this SU.
+   if (is_sponsor_assigned == false)
+   return false;
+}
+return true;
+}
+
diff --git a/osaf/services/saf/amf/amfd/include/csi.h 
b/osaf/services/saf/amf/amfd/include/csi.h
--- a/osaf/services/saf/amf/amfd/include/csi.h
+++ b/osaf/services/saf/amf/amfd/include/csi.h
@@ -162,5 +162,6 @@ extern void csi_cmplt_delete(struct avd_  extern AVD_CSI 
*csi_create(const SaNameT *csi_name);  extern bool 
csi_assignment_validate(AVD_SG *sg);  extern SaAisErrorT 
csi_assign_hdlr(AVD_CSI *csi);
+extern bool are_sponsor_csis_assigned_in_su(AVD_CSI *dep_csi, AVD_SU 
+*su);
 
 #endif
diff --git a/osaf/services/saf/amf/amfd/sgproc.cc 
b/osaf/services/saf/amf/amfd/sgproc.cc
--- a/osaf/services/saf/amf/amfd/sgproc.cc
+++ b/osaf/services/saf/amf/amfd/sgproc.cc
@@ -36,6 +36,39 @@
 #include clm.h
 #include si_dep.h
 
+
+/**
+ * @brief   While creating compcsi relationship in SUSI, AMF may assign
+ * a dependent csi to a component in the SU when its one or more 
+ *  sponsor csi remains unassigned in the same SU. This function 
+ *  deletes compcsi which belongs to such a dependent csi.
+ *  This function should be used before sending assignment list to 
AMFND.
+ *
+ * @param[in]   ptr to AVD_SU_SI_REL.
+ *
+ */
+
+static void verify_csi_deps_and_delete_invalid_compcsi(AVD_SU_SI_REL *susi)
+{
+   for (AVD_CSI *csi = susi-si-list_of_csi; csi; csi = 
csi-si_list_of_csi_next)
+   {
+   if (are_sponsor_csis_assigned_in_su(csi,susi-su) == false) {
+   for (AVD_COMP_CSI_REL *compcsi = susi-list_of_csicomp; 
compcsi;
+   compcsi = compcsi-susi_csicomp_next) {
+   if (compcsi-csi == csi) {
+   TRACE(sponsor csi unassigned: delete 
compcsi 
+   between '%s' and '%s',
+   
compcsi-comp-comp_info.name.value,
+   
compcsi-csi-name.value);
+   compcsi-csi-assign_flag = false;
+   compcsi-comp-assign_flag = false;
+   
avd_compcsi_from_csi_and_susi_delete(susi, compcsi, true);
+   break

Re: [devel] [PATCH 1 of 1] amfd : support for saAmfNodeFailfastOnInstantiationFailure [964]

2015-03-10 Thread Hans Nordebäck
Ack, code review only. A question, the ticket mentions only 
saAmfNodeFailfastOnInstantiationFailure but the patch also handles 
saAmfNodeFailfastOnTerminationFailure? 

/Thanks HansN

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 24 november 2014 11:43
To: Hans Nordebäck; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd : support for 
saAmfNodeFailfastOnInstantiationFailure [964]

 osaf/services/saf/amf/amfd/comp.cc |  31 ++-  
osaf/services/saf/amf/amfd/node.cc |  23 +++
 osaf/services/saf/amf/amfd/su.cc   |  20 
 3 files changed, 61 insertions(+), 13 deletions(-)


If saAmfNodeFailfastOnInstantiationFailure is set to true and a component 
enters INST_FAILED state, AMF will reboot node hosting this component.
If saAmfNodeFailfastOnInstantiationFailure is set to false and a component 
enters INST_FAILED state, AMF currently failover assignments. AMF will still 
hanndle this case in the same way.

TODO:Handling of INST_FAILED state of SU as per section 4.6 page 212.

diff --git a/osaf/services/saf/amf/amfd/comp.cc 
b/osaf/services/saf/amf/amfd/comp.cc
--- a/osaf/services/saf/amf/amfd/comp.cc
+++ b/osaf/services/saf/amf/amfd/comp.cc
@@ -108,24 +108,29 @@ void avd_comp_pres_state_set(AVD_COMP *c
SA_IMM_ATTR_SAUINT32T, comp-saAmfCompPresenceState);
m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, comp, 
AVSV_CKPT_COMP_PRES_STATE);
 
-   if(comp-saAmfCompPresenceState == SA_AMF_PRESENCE_INSTANTIATION_FAILED)
+   if (comp-saAmfCompPresenceState == 
+SA_AMF_PRESENCE_INSTANTIATION_FAILED)
avd_send_comp_inst_failed_alarm(comp-comp_info.name, 
node-name);
-   else if (comp-saAmfCompPresenceState == 
SA_AMF_PRESENCE_TERMINATION_FAILED) {
+   else if (comp-saAmfCompPresenceState == 
+SA_AMF_PRESENCE_TERMINATION_FAILED)
avd_send_comp_clean_failed_alarm(comp-comp_info.name, 
node-name);
 
+   if ((comp-su-sg_of_su-saAmfSGAutoRepair == true) 
+   (node-saAmfNodeAutoRepair == true) 
+   (((node-saAmfNodeFailfastOnTerminationFailure == true)  
+(comp-saAmfCompPresenceState == 
SA_AMF_PRESENCE_TERMINATION_FAILED)) ||
+((node-saAmfNodeFailfastOnInstantiationFailure == true)  
+ (comp-saAmfCompPresenceState == 
+SA_AMF_PRESENCE_INSTANTIATION_FAILED {
+
saflog(LOG_NOTICE, amfSvcUsrName, %s PresenceState %s = %s,
-   comp-comp_info.name.value, 
avd_pres_state_name[old_state],
-   avd_pres_state_name[pres_state]);
-
-   if ((comp-su-sg_of_su-saAmfSGAutoRepair == true) 
-   (node-saAmfNodeAutoRepair == true) 
-   (node-saAmfNodeFailfastOnTerminationFailure == 
true)) {
-   saflog(LOG_NOTICE, amfSvcUsrName,
-   Ordering reboot of '%s' as repair 
action,
-   node-name.value);
-   avd_d2n_reboot_snd(node);
-   }
+   comp-comp_info.name.value, 
avd_pres_state_name[old_state],
+   avd_pres_state_name[pres_state]);
+   saflog(LOG_NOTICE, amfSvcUsrName,
+   Ordering reboot of '%s' as repair action,
+   node-name.value);
+   LOG_NO(Node Failfast for '%s' as '%s' enters Term/Inst Failed 
state,
+   node-name.value,comp-comp_info.name.value);
+   avd_d2n_reboot_snd(node);
}
+   
 }
 
 void avd_comp_oper_state_set(AVD_COMP *comp, SaAmfOperationalStateT 
oper_state) diff --git a/osaf/services/saf/amf/amfd/node.cc 
b/osaf/services/saf/amf/amfd/node.cc
--- a/osaf/services/saf/amf/amfd/node.cc
+++ b/osaf/services/saf/amf/amfd/node.cc
@@ -493,6 +493,22 @@ static SaAisErrorT node_ccb_completed_mo
rc = SA_AIS_ERR_BAD_OPERATION;
goto done;
}
+   } else if (!strcmp(attribute-attrName, 
saAmfNodeFailfastOnInstantiationFailure)) {
+   if ((attr_mod-modType == SA_IMM_ATTR_VALUES_DELETE) || 
(attribute-attrValues == NULL)) {
+   report_ccb_validation_error(opdata,
+   Invalid 
saAmfNodeFailfastOnInstantiationFailure '%s',
+   opdata-objectName.value);
+   rc = SA_AIS_ERR_BAD_OPERATION;
+   goto done;
+   }
+   uint32_t value = *((SaUint32T 
*)attribute-attrValues[0]);
+   if (value  SA_TRUE) {
+   report_ccb_validation_error(opdata

Re: [devel] [PATCH 1 of 1] amfd: add mutex to sync up among amfd threads [#405, #707]

2015-03-04 Thread Hans Nordebäck
Ack, code reviewed and valgrind tool helgrind run.
A question, if avd_imm_reinit_bg is called with  imm_reinit_mutex taken, there 
will be a deadlock due to the conditional wait on 
imm_reinit_thread_startup_mutex , 
so what is the purpose of the imm_reinit_thread_startup_mutex? /Thanks HansN

-Original Message-
From: nagendr...@oracle.com [mailto:nagendr...@oracle.com] 
Sent: den 26 februari 2015 07:23
To: Hans Nordebäck; praveen.malv...@oracle.com; mathi.naic...@oracle.com; 
Anders Björnerstedt; Anders Widell
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: add mutex to sync up among amfd threads [#405, 
#707]

 osaf/services/saf/amf/amfd/imm.cc  |   30 +-
 osaf/services/saf/amf/amfd/role.cc |  117 ++--
 2 files changed, 125 insertions(+), 22 deletions(-)


If imm returns BAD HANDLE to Amf, Amf reinitializes with imm intf in a separate 
thread.
If role change event comes during imm intf initialization time, ImplSet, 
ImplClear, etc fails with BAD HANDLE.

So, Amf need to take mutex and wait for imm intf initialization.

diff --git a/osaf/services/saf/amf/amfd/imm.cc 
b/osaf/services/saf/amf/amfd/imm.cc
--- a/osaf/services/saf/amf/amfd/imm.cc
+++ b/osaf/services/saf/amf/amfd/imm.cc
@@ -47,6 +47,7 @@
 #include si.h
 #include csi.h
 #include si_dep.h
+#include osaf_utility.h
 
 
 
@@ -54,7 +55,13 @@
  *   DEFINITIONS
  * 
  */
-
+/* mutex for synchronising  imm initialization and role change events. 
+*/ pthread_mutex_t imm_reinit_mutex = PTHREAD_MUTEX_INITIALIZER;
+/* mutex for synchronising  amfd thread and imm initialization thread startup 
+   to make sure that imm initialization thread executes first and take
+   imm_reinit_mutex and then proceeds for initialization. */ static 
+pthread_mutex_t imm_reinit_thread_startup_mutex = 
+PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t 
+imm_reinit_thread_startup_cond = PTHREAD_COND_INITIALIZER;
 //
 // TODO(HANO) Temporary use this function instead of strdup which uses malloc.
 // Later on remove this function and use std::string instead @@ -1637,16 
+1644,23 @@ static void *avd_imm_reinit_bg_thread(vo
uint32_t status;
 
TRACE_ENTER();
+   osaf_mutex_lock_ordie(imm_reinit_mutex);
+   /* Send signal that imm_reinit_mutex has been taken. */
+   osaf_mutex_lock_ordie(imm_reinit_thread_startup_mutex);
+   pthread_cond_signal(imm_reinit_thread_startup_cond);
+   osaf_mutex_unlock_ordie(imm_reinit_thread_startup_mutex);
 
immutilWrapperProfile.errorsAreFatal = 0;
 
if ((rc = immutil_saImmOiInitialize_2(cb-immOiHandle, avd_callbacks, 
immVersion)) != SA_AIS_OK) {
LOG_ER(saImmOiInitialize failed %u, rc);
+   osaf_mutex_unlock_ordie(imm_reinit_mutex);
exit(EXIT_FAILURE);
}
 
if ((rc = immutil_saImmOiSelectionObjectGet(cb-immOiHandle, 
cb-imm_sel_obj)) != SA_AIS_OK) {
LOG_ER(saImmOiSelectionObjectGet failed %u, rc);
+   osaf_mutex_unlock_ordie(imm_reinit_mutex);
exit(EXIT_FAILURE);
}
 
@@ -1654,17 +1668,20 @@ static void *avd_imm_reinit_bg_thread(vo
if (cb-avail_state_avd == SA_AMF_HA_ACTIVE) {
if (avd_imm_impl_set() != SA_AIS_OK) {
LOG_ER(exiting since avd_imm_impl_set failed);
+   osaf_mutex_unlock_ordie(imm_reinit_mutex);
exit(EXIT_FAILURE);
}
} else {
/* become applier and re-read the config */
if (avd_imm_applier_set() != SA_AIS_OK) {
LOG_ER(exiting since avd_imm_applier_set failed);
+   osaf_mutex_unlock_ordie(imm_reinit_mutex);
exit(EXIT_FAILURE);
}
 
if (avd_imm_config_get() != NCSCC_RC_SUCCESS) {
LOG_ER(avd_imm_config_get FAILED);
+   osaf_mutex_unlock_ordie(imm_reinit_mutex);
exit(EXIT_FAILURE);
}
}
@@ -1677,6 +1694,8 @@ static void *avd_imm_reinit_bg_thread(vo
osafassert(status == NCSCC_RC_SUCCESS);
 
LOG_NO(Finished re-initializing with IMM);
+   /* Release mutex taken.*/
+   osaf_mutex_unlock_ordie(imm_reinit_mutex);
TRACE_LEAVE();
return NULL;
 }
@@ -1688,11 +1707,14 @@ void avd_imm_reinit_bg(void)  {
pthread_t thread;
pthread_attr_t attr;
+   int rc = 0;
 
TRACE_ENTER();
 
LOG_NO(Re-initializing with IMM);
 
+   osaf_mutex_lock_ordie(imm_reinit_thread_startup_mutex);
+
(void) saImmOiFinalize(avd_cb-immOiHandle);
 
avd_cb-immOiHandle = 0;
@@ -1703,8 +1725,14 @@ void avd_imm_reinit_bg(void)
 
if (pthread_create(thread, attr, avd_imm_reinit_bg_thread, avd_cb) != 
0) {
LOG_ER(pthread_create FAILED: %s

Re: [devel] [PATCH 1 of 1] amfd: validate parent name of SI and its protecting SG [#1161]

2015-02-25 Thread Hans Nordebäck
Ack, code review only, one minor comment, use strncmp instead of strcmp. 
/Thanks HansN

-Original Message-
From: nagendr...@oracle.com [mailto:nagendr...@oracle.com] 
Sent: den 20 februari 2015 09:24
To: Hans Nordebäck; praveen.malv...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: validate parent name of SI and its protecting SG 
[#1161]

 osaf/services/saf/amf/amfd/si.cc |  13 -
 1 files changed, 12 insertions(+), 1 deletions(-)


If SI and its protecting SG belong to different application, then Amf throws 
errors while assigning SIs to SUs.
This is because there will not be any compcsi matching with SI and its 
protecting SG.
SO, now added validation for making sure SI and its protecting SG belong to the 
same application, else throws errors during SI creation.

diff --git a/osaf/services/saf/amf/amfd/si.cc b/osaf/services/saf/amf/amfd/si.cc
--- a/osaf/services/saf/amf/amfd/si.cc
+++ b/osaf/services/saf/amf/amfd/si.cc
@@ -472,7 +472,7 @@ static int is_config_valid(const SaNameT
SaAisErrorT rc;
SaNameT aname;
SaAmfAdminStateT admstate;
-   char *parent;
+   char *parent, *app;
 
if ((parent = strchr((char*)dn-value, ',')) == NULL) {
report_ccb_validation_error(opdata, No parent to '%s' , 
dn-value); @@ -518,6 +518,17 @@ static int is_config_valid(const SaNameT
}
}
 
+   /* saAmfSIProtectedbySG and SI should belong to the same applicaion. */
+   if ((app = strchr((char*)aname.value, ',')) == NULL) {
+   report_ccb_validation_error(opdata, No parent to '%s' , 
aname.value);
+   return 0;
+   }
+   if (strcmp(parent, ++app)) {
+   report_ccb_validation_error(opdata, SI '%s' and SG '%s' belong 
to different application,
+   dn-value, aname.value);
+   return 0;
+   }
+
if ((immutil_getAttr(const_castSaImmAttrNameT(saAmfSIAdminState), 
attributes, 0, admstate) == SA_AIS_OK) 
!avd_admin_state_is_valid(admstate)) {
report_ccb_validation_error(opdata, Invalid saAmfSIAdminState 
%u for '%s', admstate, dn-value);

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfnd: issue remove cbk for assigning csi after successful assignment [#1046]

2015-02-25 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 13 februari 2015 07:11
To: Hans Nordebäck; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfnd: issue remove cbk for assigning csi after 
successful assignment [#1046]

 osaf/services/saf/amf/amfnd/comp.cc |  56 
 osaf/services/saf/amf/amfnd/include/avnd_comp.h |   5 ++
 osaf/services/saf/amf/amfnd/sidb.cc |   1 +
 3 files changed, 52 insertions(+), 10 deletions(-)


A user locks a SI and a component faults with comp_restart recovery during 
remove callback on standby SU. After this when user tries to unlock SI, unlock 
operation gets timed out.

When AMFND gets removal of assignment on standby SU (having three comps), 
because of lock operation on SI, it issues removal callback to comp1. While 
comp1 is handling removal callback another healthy component, which is still 
assigned for a CSI of this SI, faults with comp_restart recovery. When comp2 
gets repaired, AMF reassigns CSIs to it. In the meantime, when comp1 responds 
for the removal callback AMFND does not issue removal callback to the CSI of 
comp2 as it is in assigning state.
AMFND goes on and finishes removal in comp3. After successful reassignments in 
comp2, AMFND does not issue removal callback to comp2. Due to this, AMFD did 
not get response from AMFND for successful removal of SI.

Patch fixes the problem by issuing removal callback for a assigning CSI after 
successful assignment.

diff --git a/osaf/services/saf/amf/amfnd/comp.cc 
b/osaf/services/saf/amf/amfnd/comp.cc
--- a/osaf/services/saf/amf/amfnd/comp.cc
+++ b/osaf/services/saf/amf/amfnd/comp.cc
@@ -1558,6 +1558,18 @@ uint32_t avnd_comp_csi_assign_done(AVND_
rc = avnd_su_si_oper_done(cb, comp-su, 
m_AVND_SU_IS_ALL_SI(comp-su) ? NULL : csi-si);
}
}
+
+   /*
+  If this CSI was in assigning state due to component restart 
and that time removal
+  request came from AMFD, AMFND waits for the completion of 
assignment.
+  After successful assignment, AMFND will start removal of CSI.
+*/
+   if ((csi-pending_removal == true) 
+   ((csi-si-curr_assign_state == 
AVND_SU_SI_ASSIGN_STATE_REMOVING) ||
+(csi-si-curr_assign_state == 
AVND_SU_SI_ASSIGN_STATE_REMOVED))) {
+   rc = avnd_comp_csi_remove(cb, csi-comp, csi);
+   csi-pending_removal = false;
+   }
} else {/* assign all the csis belonging to the next 
rank in one shot */
/* get the first csi-record for this comp */
curr_csi = 
m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(comp-csi_list));
@@ -1579,6 +1591,19 @@ done:
TRACE_LEAVE2(%u, rc);
return rc;
 }
+
+static bool all_csis_in_si_removed(const AVND_SU_SI_REC *si) {
+   AVND_COMP_CSI_REC *csi;
+   for (csi = (AVND_COMP_CSI_REC *)m_NCS_DBLIST_FIND_FIRST(si-csi_list);
+   csi; 
+   csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_NEXT(csi-si_dll_node)) 
+{
+
+   if (csi-curr_assign_state != 
AVND_COMP_CSI_ASSIGN_STATE_REMOVED)
+   return false;
+   }
+   return true;
+}
 /**
  * @brief   Checks if all csis of all the sis in this su are in removed 
state
  *
@@ -1679,18 +1704,29 @@ uint32_t avnd_comp_csi_remove_done(AVND_
goto done;
}
else {
-   curr_csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_PREV(csi-si_dll_node);
-
-   /* assign the csi */
-   if (curr_csi)
-   rc = avnd_comp_csi_remove(cb, curr_csi-comp, 
curr_csi);
-   else
-   /* all csis belonging to the si are removed */
+   for (curr_csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_LAST(csi-si-csi_list);
+   curr_csi;
+   curr_csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_PREV(curr_csi-si_dll_node)) {
+   if 
(m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_REMOVED(curr_csi)) 
+   continue;
+   else if 
(m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_REMOVING(curr_csi)) 
+   break;
+   else if 
(m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_ASSIGNING(curr_csi)) {
+   TRACE('%s' is getting assigned, remove 
it after assignment,
+   curr_csi-name.value

Re: [devel] [PATCH 1 of 1] amfd: add SG and SU name in error string [#1174]

2015-02-25 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: nagendr...@oracle.com [mailto:nagendr...@oracle.com] 
Sent: den 20 februari 2015 06:51
To: Hans Feldt; Hans Nordebäck; praveen.malv...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: add SG and SU name in error string [#1174]

 osaf/services/saf/amf/amfd/node.cc |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/osaf/services/saf/amf/amfd/node.cc 
b/osaf/services/saf/amf/amfd/node.cc
--- a/osaf/services/saf/amf/amfd/node.cc
+++ b/osaf/services/saf/amf/amfd/node.cc
@@ -1077,7 +1077,8 @@ static void node_admin_op_cb(SaImmOiHand
 
if (su-sg_of_su-sg_fsm_state != AVD_SG_FSM_STABLE) {
report_admin_op_error(immOiHandle, invocation, 
SA_AIS_ERR_TRY_AGAIN, NULL,
-   SG of SU on this node not in STABLE 
state (%s), su-name.value);
+   SG'%s' of SU'%s' on this node not in 
STABLE state,
+   su-sg_of_su-name.value, 
su-name.value);
goto done;
}
su = su-avnd_list_su_next;

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: fix amfd crash during modificaion of si rank and csi deps [#1238]

2015-02-25 Thread Hans Nordebäck
Ack, code review only/Thanks HansN

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: den 23 januari 2015 10:00
To: Hans Nordebäck; nagendr...@oracle.com; Minh Chau H
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: fix amfd crash during modificaion of si rank and 
csi deps [#1238]

 osaf/services/saf/amf/amfd/csi.cc |  15 +--  
osaf/services/saf/amf/amfd/si.cc  |  19 ++-
 2 files changed, 27 insertions(+), 7 deletions(-)


AMFD crashes when a user to tries to modify si rank and csi deps with empty 
values.

Patch fixes issues by:
1)Reverting to the default value for SI rank.
2)By returning BAD_OPERATION for csi deps.

diff --git a/osaf/services/saf/amf/amfd/csi.cc 
b/osaf/services/saf/amf/amfd/csi.cc
--- a/osaf/services/saf/amf/amfd/csi.cc
+++ b/osaf/services/saf/amf/amfd/csi.cc
@@ -564,6 +564,14 @@ static SaAisErrorT csi_ccb_completed_mod
goto done;
}
} else if (!strcmp(attr_mod-modAttr.attrName, 
saAmfCSIDependencies)) {
+   //Reject replacement of CSI deps, only deletion and 
addition are supported. 
+   if (attr_mod-modType == SA_IMM_ATTR_VALUES_REPLACE) {
+   report_ccb_validation_error(opdata,
+   '%s' - replacement of CSI dependency 
is not supported,
+   opdata-objectName.value);
+   goto done;
+   
+   }
const SaNameT *required_dn = (SaNameT*) 
attr_mod-modAttr.attrValues[0];
const AVD_CSI *required_csi = 
csi_db-find(Amf::to_string(required_dn));
 
@@ -626,12 +634,7 @@ static SaAisErrorT csi_ccb_completed_mod
report_ccb_validation_error(opdata, 
only one dep can be removed at a time);
goto done;
}
-   } else {
-   report_ccb_validation_error(opdata,
-   '%s' - change of CSI dependency is not 
supported,
-   opdata-objectName.value);
-   goto done;
-   }
+   }
} else {
report_ccb_validation_error(opdata, Modification of 
attribute '%s' not supported,
attr_mod-modAttr.attrName);
diff --git a/osaf/services/saf/amf/amfd/si.cc b/osaf/services/saf/amf/amfd/si.cc
--- a/osaf/services/saf/amf/amfd/si.cc
+++ b/osaf/services/saf/amf/amfd/si.cc
@@ -713,6 +713,7 @@ static SaAisErrorT si_ccb_completed_modi
AVD_SI *si;
const SaImmAttrModificationT_2 *attr_mod;
int i = 0;
+   bool value_is_deleted;
 
TRACE_ENTER2(CCB ID %llu, '%s', opdata-ccbId, 
opdata-objectName.value);
 
@@ -722,6 +723,16 @@ static SaAisErrorT si_ccb_completed_modi
/* Modifications can only be done for these attributes. */
while ((attr_mod = opdata-param.modify.attrMods[i++]) != NULL) {
const SaImmAttrValuesT_2 *attribute = attr_mod-modAttr;
+   //void *value = NULL;
+
+   if ((attr_mod-modType == SA_IMM_ATTR_VALUES_DELETE) || 
(attribute-attrValues == NULL)) {
+   /* Attribute value is deleted, revert to default value 
*/
+   value_is_deleted = true;
+   } else {
+   /* Attribute value is modified */
+   value_is_deleted = false;
+   //value = attribute-attrValues[0];
+   }
 
if (!strcmp(attribute-attrName, 
saAmfSIPrefActiveAssignments)) {
if (si-sg_of_si-sg_fsm_state != AVD_SG_FSM_STABLE) { 
@@ -751,6 +762,9 @@ static SaAisErrorT si_ccb_completed_modi
break;
}
} else if (!strcmp(attribute-attrName, saAmfSIRank)) {
+   if (value_is_deleted == true)
+   continue;
+   
SaUint32T sirank = 
*(SaUint32T*)attribute-attrValues[0];
 
if (si-saAmfSIRank == (sirank == 0 ? ~0U : sirank)) { 
@@ -1178,7 +1192,10 @@ static void si_ccb_apply_modify_hdlr(Ccb
TRACE(Modified saAmfSINumCurrStandbyAssignments is 
'%u', si-saAmfSINumCurrStandbyAssignments);
si-update_ass_state();
} else if (!strcmp(attribute-attrName, saAmfSIRank)) {
-   si-update_sirank(*((SaUint32T 
*)attr_mod-modAttr.attrValues[0]));
+   if (value_is_deleted == true)
+   si-update_sirank(0

<    1   2   3   4   5   6   7   >