Hi Long,

This check is very generic.
During su restart cases, a PI SU having NPI components will send unnecessary enabled events to AMFD. When AMFD will receive this events it will try to assign this SU and can lead to assignments in other than 2N red models cases. I think check should be moved to the event handler of presence state message. Attached is the patch based on this idea.
What do you think?


Thanks
Praveen

On 28-Apr-17 9:42 AM, Long H Buu Nguyen wrote:
---
  src/amf/amfnd/susm.cc | 10 ++++++++++
  1 file changed, 10 insertions(+)

diff --git a/src/amf/amfnd/susm.cc b/src/amf/amfnd/susm.cc
index 52af63b83..04ced426d 100644
--- a/src/amf/amfnd/susm.cc
+++ b/src/amf/amfnd/susm.cc
@@ -1608,6 +1608,16 @@ uint32_t avnd_su_pres_fsm_run(AVND_CB *cb, AVND_SU *su, 
AVND_COMP *comp,
    /* process state change */
    if (prv_st != final_st)
      rc = avnd_su_pres_st_chng_prc(cb, su, prv_st, final_st);
+  else {
+    // If SU has been already instantiated, inform amfd
+    if (SA_AMF_PRESENCE_INSTANTIATED == final_st &&
+        su_all_pi_comps_instantiated(su) == true) {
+      if (m_AVND_SU_OPER_STATE_IS_ENABLED(su)) {
+        TRACE("SU oper state is enabled");
+        rc = avnd_di_oper_send(cb, su, 0);
+      }
+    }
+  }
done:
    TRACE_LEAVE2("%u", rc);

diff --git a/src/amf/amfnd/susm.cc b/src/amf/amfnd/susm.cc
index 04ced42..18b8fc8 100644
--- a/src/amf/amfnd/susm.cc
+++ b/src/amf/amfnd/susm.cc
@@ -1608,16 +1608,6 @@ uint32_t avnd_su_pres_fsm_run(AVND_CB *cb, AVND_SU *su, 
AVND_COMP *comp,
   /* process state change */
   if (prv_st != final_st)
     rc = avnd_su_pres_st_chng_prc(cb, su, prv_st, final_st);
-  else {
-    // If SU has been already instantiated, inform amfd
-    if (SA_AMF_PRESENCE_INSTANTIATED == final_st &&
-        su_all_pi_comps_instantiated(su) == true) {
-      if (m_AVND_SU_OPER_STATE_IS_ENABLED(su)) {
-        TRACE("SU oper state is enabled");
-        rc = avnd_di_oper_send(cb, su, 0);
-      }
-    }
-  }
 
 done:
   TRACE_LEAVE2("%u", rc);
@@ -4133,7 +4123,16 @@ uint32_t avnd_evt_ir_evh(struct avnd_cb_tag *cb, struct 
avnd_evt_tag *evt) {
     }
     TRACE("SU instantiation for PI SUs, running the SU presence state 
FSM:'%s'",
           su->name.c_str());
-    rc = avnd_su_pres_fsm_run(cb, su, 0, AVND_SU_PRES_FSM_EV_INST);
+    // If SU has been already instantiated, inform amfd
+    if ((cb->led_state == AVND_LED_STATE_RED) &&
+        (su->pres == SA_AMF_PRESENCE_INSTANTIATED) &&
+        (su_all_pi_comps_instantiated(su) == true) &&
+        (m_AVND_SU_OPER_STATE_IS_ENABLED(su))) {
+        TRACE("SU oper state is enabled and pres state is instantiated.");
+        rc = avnd_di_oper_send(cb, su, 0);
+    } else {
+        rc = avnd_su_pres_fsm_run(cb, su, 0, AVND_SU_PRES_FSM_EV_INST);
+    }
   } else {
     if (m_AVND_SU_IS_REG_FAILED(su)) {
       /* The SU configuration is bad, we cannot do much other transition to
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to