When amfnd-payload responds susi assignment response just before both SC
go down, and that response message does not come to director. Therefore,
the status of that assignment could be seen as "modifying" in IMM. When
SC comes back, active amfd will be waiting for that response forever.

Patch checks if a susi assignment response is sent but not-ack just before
both SC come down, amfnd-payload will buffer it in a way as a susi get
assigned during SC absence
---
 src/amf/amfnd/avnd_di.h |  2 +-
 src/amf/amfnd/di.cc     | 85 +++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 70 insertions(+), 17 deletions(-)

diff --git a/src/amf/amfnd/avnd_di.h b/src/amf/amfnd/avnd_di.h
index 07222eb67..d7ccd68fd 100644
--- a/src/amf/amfnd/avnd_di.h
+++ b/src/amf/amfnd/avnd_di.h
@@ -79,7 +79,7 @@ uint32_t avnd_di_pg_act_send(struct avnd_cb_tag *, const 
std::string &,
                              AVSV_PG_TRACK_ACT, bool);
 uint32_t avnd_di_msg_send(struct avnd_cb_tag *, AVND_MSG *);
 void avnd_di_msg_ack_process(struct avnd_cb_tag *, uint32_t);
-void avnd_diq_del(struct avnd_cb_tag *);
+void avnd_diq_rec_check_buffered_msg(struct avnd_cb_tag *);
 AVND_DND_MSG_LIST *avnd_diq_rec_add(struct avnd_cb_tag *cb, AVND_MSG *msg);
 void avnd_diq_rec_del(struct avnd_cb_tag *cb, AVND_DND_MSG_LIST *rec);
 void avnd_diq_rec_send_buffered_msg(struct avnd_cb_tag *cb);
diff --git a/src/amf/amfnd/di.cc b/src/amf/amfnd/di.cc
index e06b9260d..6f0a76cda 100644
--- a/src/amf/amfnd/di.cc
+++ b/src/amf/amfnd/di.cc
@@ -698,8 +698,8 @@ uint32_t avnd_evt_mds_avd_dn_evh(AVND_CB *cb, AVND_EVT 
*evt) {
       }
     }
   } else {
-    TRACE("Delete all pending messages to be sent to AMFD");
-    avnd_diq_del(cb);
+    TRACE("Delete/Buffer pending messages to be sent to AMFD");
+    avnd_diq_rec_check_buffered_msg(cb);
   }
 
   // check for pending messages FROM director
@@ -1271,9 +1271,15 @@ void avnd_di_msg_ack_process(AVND_CB *cb, uint32_t mid) {
 }
 
 /****************************************************************************
-  Name          : avnd_diq_del
+  Name          : avnd_diq_rec_check_buffered_msg
+
+  Description   : The routine buffers messages that are waiting for ack and 
will
+                  resend to AMFD when AMFD is up.
+                  All messages are deleted, except following messages to be
+                  buffered:
+                  - AVSV_N2D_INFO_SU_SI_ASSIGN_MSG
+                  - AVSV_N2D_OPERATION_STATE_MSG
 
-  Description   : This routine clears the AvD msg list.
 
   Arguments     : cb - ptr to the AvND control block
 
@@ -1281,18 +1287,65 @@ void avnd_di_msg_ack_process(AVND_CB *cb, uint32_t mid) 
{
 
   Notes         : None.
 ******************************************************************************/
-void avnd_diq_del(AVND_CB *cb) {
-  AVND_DND_MSG_LIST *rec = 0;
-
-  do {
-    /* pop the record */
-    m_AVND_DIQ_REC_POP(cb, rec);
-    if (!rec) break;
-
-    /* delete the record */
-    avnd_diq_rec_del(cb, rec);
-  } while (1);
-
+void avnd_diq_rec_check_buffered_msg(AVND_CB *cb) {
+  if ((cb->dnd_list.head != nullptr)) {
+    AVND_DND_MSG_LIST *rec = 0;
+    bool found = true;
+    while (found) {
+      found = false;
+      for (rec = cb->dnd_list.head; rec != nullptr;) {
+        osafassert(rec->msg.type == AVND_MSG_AVD);
+        m_AVND_DIQ_REC_POP(cb, rec);
+        // Assignment response had been sent, but not ack because
+        // last controller go down, reset msg_id and will be resent later
+        if (rec->msg.info.avd->msg_type == AVSV_N2D_INFO_SU_SI_ASSIGN_MSG) {
+          if (rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_id != 0) {
+            rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_id = 0;
+            found = true;
+            LOG_NO(
+                "Found not-ack su_si_assign msg for SU:'%s', "
+                "SI:'%s', ha_state:'%u', msg_act:'%u', single_csi:'%u', "
+                "error:'%u', msg_id:'%u'",
+                osaf_extended_name_borrow(&rec->msg.info.avd->msg_info
+                                               .n2d_su_si_assign.su_name),
+                osaf_extended_name_borrow(&rec->msg.info.avd->msg_info
+                                               .n2d_su_si_assign.si_name),
+                rec->msg.info.avd->msg_info.n2d_su_si_assign.ha_state,
+                rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_act,
+                rec->msg.info.avd->msg_info.n2d_su_si_assign
+                    .single_csi,
+                rec->msg.info.avd->msg_info.n2d_su_si_assign.error,
+                rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_id);
+          }
+          m_AVND_DIQ_REC_PUSH(cb, rec);
+          break;
+        } else if (rec->msg.info.avd->msg_type ==
+              AVSV_N2D_OPERATION_STATE_MSG) {
+          if (rec->msg.info.avd->msg_info.n2d_opr_state.msg_id != 0) {
+            rec->msg.info.avd->msg_info.n2d_opr_state.msg_id = 0;
+            found = true;
+            LOG_NO(
+                "Found not-ack oper_state msg for SU:'%s', "
+                "su_oper_state:'%u', node_oper_state:'%u', recovery:'%u'",
+                osaf_extended_name_borrow(&rec->msg.info.avd->msg_info
+                                               .n2d_opr_state.su_name),
+                rec->msg.info.avd->msg_info.n2d_opr_state
+                    .su_oper_state,
+                rec->msg.info.avd->msg_info.n2d_opr_state
+                    .node_oper_state,
+                rec->msg.info.avd->msg_info.n2d_opr_state.rec_rcvr
+                    .raw);
+          }
+          m_AVND_DIQ_REC_PUSH(cb, rec);
+          break;
+        } else {
+          // delete other messages for now
+          avnd_diq_rec_del(cb, rec);
+          rec = cb->dnd_list.head;
+        }
+      }
+    }
+  }
   return;
 }
 
-- 
2.11.0


------------------------------------------------------------------------------
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