If the SU is unlock-in/unlock before the node joins cluster, the SU is 
instantiated
and in unlocked state. However, when the node completes joining the cluster, 
amfd
assumes all applications' SU uninstantiated and starts the instantiation, thus 
the
instantiated/unlocked SU is forgot to give the assignments.

The patch handles the above case by giving assignments to the 
instantiated/unlocked
SU.
---
 src/amf/amfd/sgproc.cc | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/amf/amfd/sgproc.cc b/src/amf/amfd/sgproc.cc
index 8513132..a429bdf 100644
--- a/src/amf/amfd/sgproc.cc
+++ b/src/amf/amfd/sgproc.cc
@@ -1846,10 +1846,28 @@ void avd_sg_app_node_su_inst_func(AVD_CL_CB *cb, 
AVD_AVND *avnd) {
 
   } else if (cb->init_state == AVD_APP_STATE) {
     for (const auto &i_su : avnd->list_of_su) {
-      if ((i_su->term_state == false) &&
-          (i_su->saAmfSUPresenceState == SA_AMF_PRESENCE_UNINSTANTIATED)) {
-        /* Look at the SG and do the instantiations. */
-        avd_sg_app_su_inst_func(cb, i_su->sg_of_su);
+      if (i_su->term_state == false) {
+        /* If SU is UNINSTANTIATED, look at the SG and do the instantiations.
+         * If SU is INSTANTIATED but still OUT_OF_SERVICE, this case can happen
+         * if the SU is unlock() while cluster instantiation.
+         * Otherwise presenceState, amfd will continue from intermediate state
+         */
+        if (i_su->saAmfSUPresenceState == SA_AMF_PRESENCE_UNINSTANTIATED) {
+          avd_sg_app_su_inst_func(cb, i_su->sg_of_su);
+        } else if (i_su->saAmfSUPresenceState ==
+            SA_AMF_PRESENCE_INSTANTIATED) {
+          if (i_su->is_in_service() && i_su->sg_of_su->sg_ncs_spec == false &&
+              i_su->saAmfSuReadinessState == SA_AMF_READINESS_OUT_OF_SERVICE) {
+            i_su->set_readiness_state(SA_AMF_READINESS_IN_SERVICE);
+            if (i_su->sg_of_su->su_insvc(cb, i_su) == NCSCC_RC_FAILURE) {
+              LOG_ER("%s:%d %s", __FUNCTION__, __LINE__, i_su->name.c_str());
+              i_su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE);
+            }
+          }
+        } else {
+          LOG_WA("SU'%s' has unexpected saAmfSUPresenceState:'%d'",
+              i_su->name.c_str(), i_su->saAmfSUPresenceState);
+        }
       }
     }
   }
-- 
2.7.4



_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to