osaf/services/saf/avsv/avnd/avnd_susm.c |  41 +++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 2 deletions(-)


diff --git a/osaf/services/saf/avsv/avnd/avnd_susm.c 
b/osaf/services/saf/avsv/avnd/avnd_susm.c
--- a/osaf/services/saf/avsv/avnd/avnd_susm.c
+++ b/osaf/services/saf/avsv/avnd/avnd_susm.c
@@ -337,6 +337,8 @@
                                }
                        } else {
                                AVND_COMP_CSI_PARAM *csi_param;
+                               AVND_COMP_CSI_REC *csi;
+
                                /* verify if su-si relationship already exists 
*/
                                if (0 == (si = avnd_su_si_rec_get(cb, 
&info->su_name, &info->si_name))) {
                                        LOG_ER("No SUSI Rec exists"); 
@@ -347,9 +349,11 @@
                                csi_param = info->list;
                                osafassert(csi_param);
                                osafassert(!(csi_param->next));
-                               avnd_su_si_csi_rec_add(cb, su, si, csi_param, 
&rc);
+                               csi = avnd_su_si_csi_rec_add(cb, su, si, 
csi_param, &rc);
                                m_AVND_SEND_CKPT_UPDT_ASYNC_ADD(cb, si_rec, 
AVND_CKPT_CSI_REC);
-                               si->single_csi_add_rem_in_si =  
AVSV_SUSI_ACT_ASGN;
+                               si->single_csi_add_rem_in_si = 
AVSV_SUSI_ACT_ASGN;
+                               csi->single_csi_add_rem_in_si = 
AVSV_SUSI_ACT_ASGN;
+                               LOG_NO("Adding CSI '%s'", 
csi_param->csi_name.value);
                        }
                        /* initiate si assignment */
                        if (si)
@@ -533,6 +537,32 @@
        /* initiate the si assignment for npi su */
        if (!m_AVND_SU_IS_PREINSTANTIABLE(su)) {
                TRACE("SU is NPI");
+
+               if ((single_csi == true) && (si->single_csi_add_rem_in_si == 
AVSV_SUSI_ACT_ASGN)) {
+                       // we are adding a CSI to an unlocked SU
+
+                       // first find the newly added unassigned CSI
+                       for (curr_csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_FIRST(&si->csi_list);
+                                       curr_csi != NULL;
+                                       curr_csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_NEXT(&curr_csi->si_dll_node)) {
+
+                               if (curr_csi->single_csi_add_rem_in_si == 
AVSV_SUSI_ACT_ASGN)
+                                       break;
+                       }
+
+                       osafassert(curr_csi);
+
+                       if (si->curr_state == SA_AMF_HA_ACTIVE) {
+                               avnd_su_pres_state_set(su, 
SA_AMF_PRESENCE_INSTANTIATING);
+                               rc = avnd_comp_csi_assign(avnd_cb, 
curr_csi->comp, curr_csi);
+                       } else {
+                               curr_csi->single_csi_add_rem_in_si = 
AVSV_SUSI_ACT_BASE;
+                               rc = avnd_su_si_oper_done(avnd_cb, su, si);
+                       }
+
+                       goto done;
+               }
+
                bool npi_prv_inst = true, npi_curr_inst = true;
                AVND_SU_PRES_FSM_EV su_ev = AVND_SU_PRES_FSM_EV_MAX;
 
@@ -1814,6 +1844,13 @@
                m_AVND_COMP_CSI_CURR_ASSIGN_STATE_SET(curr_csi, 
AVND_COMP_CSI_ASSIGN_STATE_ASSIGNED);
                m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, curr_csi, 
AVND_CKPT_COMP_CSI_CURR_ASSIGN_STATE);
 
+               if (curr_csi->single_csi_add_rem_in_si == AVSV_SUSI_ACT_ASGN) {
+                       // we are adding a single CSI, the comp is instantiated 
so now we're done
+                       curr_csi->single_csi_add_rem_in_si = AVSV_SUSI_ACT_BASE;
+                       avnd_su_pres_state_set(su, 
SA_AMF_PRESENCE_INSTANTIATED);
+                       goto done;
+               }
+
                /* get the next csi */
                curr_csi = (AVND_COMP_CSI_REC 
*)m_NCS_DBLIST_FIND_NEXT(&curr_csi->si_dll_node);
                if (curr_csi) {

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to