osaf/services/saf/amf/amfnd/clc.cc  |  13 +++++++++++++
 osaf/services/saf/amf/amfnd/mds.cc  |   4 +++-
 osaf/services/saf/amf/amfnd/susm.cc |  28 ++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 1 deletions(-)


AMFND does not exit at OpenSAF stop when a NPI application comp faults during 
removal
of assignment.

As a part of OpenSAF shutdwon, AMFND first removes assignment of all application
SIs honoring their ranks. Since application is NPI, AMFND tries to terminate 
the only
application comp hosted on it by launching TERMINATE command. Command fails and 
AMFND
launches clean up of component. Clean up command also fails and both comp and 
SU are
marked TERM_FAILED.  Since no more applicaion SIs remained to perform their 
removal,
AMFND should have continued next phase of shutdown sequence viz clean up of all 
the comps
(PI apps and MW). This sequence was not triggered because when faulted app SU 
was moved to
TERM_FAILED state, AMFND does not trigger removal done logic. Removal done 
logic takes care
of further removal of remaining assigned SIs or clean up of PI app comps or MW 
comps.

Patch ensures when SU is marked TERM_FAILED, AMFND should continue shutdown 
sequence.

diff --git a/osaf/services/saf/amf/amfnd/clc.cc 
b/osaf/services/saf/amf/amfnd/clc.cc
--- a/osaf/services/saf/amf/amfnd/clc.cc
+++ b/osaf/services/saf/amf/amfnd/clc.cc
@@ -1315,6 +1315,19 @@ uint32_t avnd_comp_clc_st_chng_prc(AVND_
                        }
 
                 }
+               //Terminating -> Terminationfailed.
+                if ((prv_st == SA_AMF_PRESENCE_TERMINATING) && (final_st == 
SA_AMF_PRESENCE_TERMINATION_FAILED)) {
+                       /*
+                          Shutdown phase and NPI comp faulted during its 
termination as a part of 
+                          of removal of assignment.
+                        */
+                       csi = 
m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(&comp->csi_list));
+                       if ((m_AVND_IS_SHUTTING_DOWN(cb)) && 
+                               
(m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_REMOVING(csi))) {
+                               TRACE_1("CSI marked Removed.");
+                               m_AVND_COMP_CSI_CURR_ASSIGN_STATE_SET(csi, 
AVND_COMP_CSI_ASSIGN_STATE_REMOVED);
+                       }
+               }
 
        }
 
diff --git a/osaf/services/saf/amf/amfnd/mds.cc 
b/osaf/services/saf/amf/amfnd/mds.cc
--- a/osaf/services/saf/amf/amfnd/mds.cc
+++ b/osaf/services/saf/amf/amfnd/mds.cc
@@ -1416,8 +1416,10 @@ uint32_t avnd_mds_send(AVND_CB *cb, AVND
        case AVND_MSG_AVD:
                send_info->i_to_svc = NCSMDS_SVC_ID_AVD;
                /* Don't send any messages if we are shutting down */
-               if (m_AVND_IS_SHUTTING_DOWN(cb))
+               if (m_AVND_IS_SHUTTING_DOWN(cb)) {
+                       TRACE_1("Shutting down, not sending msg to AMFD.");
                        goto done;
+               }
                break;
 
        case AVND_MSG_AVA:
diff --git a/osaf/services/saf/amf/amfnd/susm.cc 
b/osaf/services/saf/amf/amfnd/susm.cc
--- a/osaf/services/saf/amf/amfnd/susm.cc
+++ b/osaf/services/saf/amf/amfnd/susm.cc
@@ -1884,6 +1884,16 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C
                        /* Send response to Amfd only when there is a pending 
assignment. */
                        if (m_AVND_SU_IS_ASSIGN_PEND(su))
                                rc = avnd_di_susi_resp_send(cb, su, 
m_AVND_SU_IS_ALL_SI(su) ? 0 : si);
+                       /*
+                          During shutdown phase, all comps of NPI SU are 
terminated as a part of 
+                          removal of assignments. If a SU enters in 
TERM_FAILED state then in order
+                          to complete shutdown sequence generate a si-oper 
done indication.
+                        */
+                       if ((si != nullptr) && (m_AVND_IS_SHUTTING_DOWN(cb)) &&
+                               
(m_AVND_SU_SI_CURR_ASSIGN_STATE_IS_REMOVING(si)) && 
+                                       (all_comps_terminated_in_su(su, true) 
== true)) {
+                               rc = avnd_su_si_oper_done(cb, su, si);
+                       }
                }
 
                /* instantiating -> term-failed */
@@ -3911,6 +3921,24 @@ static uint32_t avnd_su_pres_termfailed_
       avnd_su_si_del(cb, su->name);
     }
   }
+
+  //NPI SU case. 
+  if (!m_AVND_SU_IS_PREINSTANTIABLE(su)) {
+    TRACE_1("NPI SU");
+    AVND_SU_SI_REC *si = (AVND_SU_SI_REC 
*)m_NCS_DBLIST_FIND_FIRST(&su->si_list);
+
+    /*
+       During shutdown phase, all comps of NPI SU are terminated as a part of
+       removal of assignments. If a SU enters in TERM_FAILED state then in 
order
+       to complete shutdown sequence generate a si-oper done indication.
+     */
+    if ((si != nullptr) && (m_AVND_IS_SHUTTING_DOWN(cb)) &&
+      (m_AVND_SU_SI_CURR_ASSIGN_STATE_IS_REMOVING(si)) && 
+      (all_comps_terminated_in_su(su, true) == true)) {
+      rc = avnd_su_si_oper_done(cb, su, si);
+    }
+  }
+
   TRACE_LEAVE();
   return rc;
 }

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to