ack, code review only/Thanks HansN

On 09/19/2018 12:50 AM, Minh Chau wrote:
After split-brain, the assignments can go over the preferred number.
Reboot the node once at time until the current active assignments
is equal to preferred number.
---
  src/amf/amfd/sg_nwayact_fsm.cc | 20 +++++++++++++++++---
  src/amf/amfd/siass.cc          |  5 ++++-
  2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/amf/amfd/sg_nwayact_fsm.cc b/src/amf/amfd/sg_nwayact_fsm.cc
index 68b76f1..f339026 100644
--- a/src/amf/amfd/sg_nwayact_fsm.cc
+++ b/src/amf/amfd/sg_nwayact_fsm.cc
@@ -70,13 +70,27 @@ AVD_SU *avd_sg_nacvred_su_chose_asgn(AVD_CL_CB *cb, AVD_SG 
*sg) {
      if (l_flag == false) {
        break;
      }
-
      /* verify that the SI is ready and needs come more assignments. */
      if ((i_si->saAmfSIAdminState != SA_AMF_ADMIN_UNLOCKED) ||
          (i_si->list_of_csi == nullptr) ||
-        (i_si->pref_active_assignments() <= i_si->curr_active_assignments())) {
+        (i_si->pref_active_assignments() == i_si->curr_active_assignments())) {
        continue;
      }
+    /* After split-brain, the assignments can go over the preferred number.
+     * Reboot the node once at time until the current active assignments
+     * is equal to preferred number
+     */
+    if (i_si->pref_active_assignments() < i_si->curr_active_assignments()) {
+      AVD_SU* over_assigned_su = i_si->list_of_sisu->su;
+      if (over_assigned_su) {
+        LOG_ER("SU '%s' has been over-assigned",
+            over_assigned_su->name.c_str());
+        LOG_EM("Sending node reboot order to '%s'",
+           over_assigned_su->su_on_node->name.c_str());
+        avd_d2n_reboot_snd(over_assigned_su->su_on_node);
+      }
+      goto done;
+    }
/* Cannot be assigned, as sponsors SIs are not in enabled state for this SI
       */
@@ -259,7 +273,7 @@ AVD_SU *avd_sg_nacvred_su_chose_asgn(AVD_CL_CB *cb, AVD_SG 
*sg) {
    }
TRACE_LEAVE();
-
+done:
    if (sg->su_oper_list.empty() == true) {
      return nullptr;
    } else {
diff --git a/src/amf/amfd/siass.cc b/src/amf/amfd/siass.cc
index 267c55c..5844b9a 100644
--- a/src/amf/amfd/siass.cc
+++ b/src/amf/amfd/siass.cc
@@ -258,7 +258,10 @@ void avd_susi_read_headless_cached_rta(AVD_CL_CB *cb) {
        // the last fsm state when AMFD was before headless. This needs
        // AMFND to resend susi_resp message if CSI completes during
        // headless period.
-      susi->fsm = imm_susi_fsm;
+      if (imm_susi_fsm != AVD_SU_SI_STATE_BASE &&
+          imm_susi_fsm != AVD_SU_SI_STATE_ABSENT) {
+        susi->fsm = imm_susi_fsm;
+      }
  #endif
        // Checkpoint to add this SUSI
        m_AVSV_SEND_CKPT_UPDT_ASYNC_ADD(avd_cb, susi, AVSV_CKPT_AVD_SI_ASS);



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to