Hi Thang,

Instead of adding is_presence_msg_processed, which requires a checkpoint to standby, can we make it as a function (or might be *if* statement) that utilizes the pres_state and term_state to (dis)allow the lock-in op?

Thanks

Minh

On 25/11/19 5:50 pm, thang.d.nguyen wrote:
AMFD should not accept lock-in admin op on SU if the presence msg
has already sent to that SU.
---
  src/amf/amfd/sgproc.cc |  1 +
  src/amf/amfd/su.cc     | 13 +++++++++++++
  src/amf/amfd/su.h      |  2 ++
  3 files changed, 16 insertions(+)

diff --git a/src/amf/amfd/sgproc.cc b/src/amf/amfd/sgproc.cc
index ddd825d44..8aeb9ec3c 100644
--- a/src/amf/amfd/sgproc.cc
+++ b/src/amf/amfd/sgproc.cc
@@ -2126,6 +2126,7 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_CB *cb, AVD_SG 
*sg) {
              }
            } else {
              if (avd_snd_presence_msg(cb, i_su, false) == NCSCC_RC_SUCCESS) {
+              i_su->is_presence_msg_processed = true;
                num_try_insvc_su++;
              }
            }
diff --git a/src/amf/amfd/su.cc b/src/amf/amfd/su.cc
index 8c8ef9d4f..494022893 100644
--- a/src/amf/amfd/su.cc
+++ b/src/amf/amfd/su.cc
@@ -51,6 +51,7 @@ void AVD_SU::initialize() {
    term_state = false;
    su_switch = AVSV_SI_TOGGLE_STABLE;
    su_is_external = false;
+  is_presence_msg_processed = false;
    su_act_state = 0;
    sg_of_su = nullptr;
    su_on_node = nullptr;
@@ -810,6 +811,12 @@ void AVD_SU::set_pres_state(SaAmfPresenceStateT 
pres_state) {
       */
      return;
+ if ((pres_state == SA_AMF_PRESENCE_INSTANTIATED) ||
+      (pres_state == SA_AMF_PRESENCE_INSTANTIATION_FAILED) ||
+      (pres_state == SA_AMF_PRESENCE_TERMINATION_FAILED)) {
+    this->is_presence_msg_processed = false;
+  }
+
    osafassert(pres_state <= SA_AMF_PRESENCE_TERMINATION_FAILED);
    TRACE_ENTER2("'%s' %s => %s", name.c_str(),
                 avd_pres_state_name[saAmfSUPresenceState],
@@ -1085,6 +1092,12 @@ void AVD_SU::lock_instantiation(SaImmOiHandleT 
immoi_handle,
      goto done;
    }
+ if (is_presence_msg_processed == true) {
+    report_admin_op_error(immoi_handle, invocation, SA_AIS_ERR_TRY_AGAIN,
+                          nullptr, "'%s' instantiate not done", name.c_str());
+    goto done;
+  }
+
    if (list_of_susi != nullptr) {
      report_admin_op_error(immoi_handle, invocation, SA_AIS_ERR_TRY_AGAIN,
                            nullptr, "SIs still assigned to this SU '%s'",
diff --git a/src/amf/amfd/su.h b/src/amf/amfd/su.h
index 7afc5abee..722c68b9c 100644
--- a/src/amf/amfd/su.h
+++ b/src/amf/amfd/su.h
@@ -87,6 +87,8 @@ class AVD_SU {
bool su_is_external; /* indicates if this SU is external */ + bool is_presence_msg_processed; /* indicate inst msg sent to nd */
+
    int su_act_state;  // not used, kept for EDU, remove later
bool wait_for_contained_to_quiesce;


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

Reply via email to