osaf/services/saf/amf/amfd/include/si.h  |   1 +
 osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   7 +++++--
 osaf/services/saf/amf/amfd/si.cc         |  16 +++++++++++++++-
 3 files changed, 21 insertions(+), 3 deletions(-)


When OpenSAF is stopped on one node hosting two application SUs, standby 
assignments
are given for SIs active on the stopped node.

In the reported problem, stopped node consists of active and standby SUs for 
two SIs.
When this node is stopped, AMFD tries to failover the SUs. For the active SU it 
deletes
the SUSI for both SIs. Since failover of this SU is not possible as standby 
assignment
also resides (susi to be deleted) on the stopped node only, AMFD runs new 
assignment logic.
Since no SU is available for active assignment for any SI, AMFD tries for fresh 
standby assignments.
In the logic of assigning standby HA state, AMFD checks if active assignments 
are there by checking
list_of_susi and also check if standby assignment is present. Here it must be 
noted that AMFD
checks only list_of_susi and not the HA state and it assumes that since 
list_of_susi is not null
it means active assignment are there. In the reported problem since both active 
and standby
assignments resides on the stopped node, AMFD gets list_of_susi non-null 
(contains susi for standby
HA state which will be deleted in failover logic of node). Since only one 
susi(assuming it active)
is present AMFD goes for standby assignments.

Patch ensures that before assignning fresh standby HA state, valid active 
assignment for
the SI must be verified because new assignment logic is also invoked during 
recovery phase.

diff --git a/osaf/services/saf/amf/amfd/include/si.h 
b/osaf/services/saf/amf/amfd/include/si.h
--- a/osaf/services/saf/amf/amfd/include/si.h
+++ b/osaf/services/saf/amf/amfd/include/si.h
@@ -143,6 +143,7 @@ public:
        void update_sirank(uint32_t newSiRank);
        bool si_dep_states_check();
         const AVD_SIRANKEDSU *get_si_ranked_su(const std::string &su_name) 
const;
+       bool isActive() const;
 private:
        AVD_SI(const AVD_SI&);
        AVD_SI& operator=(const AVD_SI&);
diff --git a/osaf/services/saf/amf/amfd/sg_npm_fsm.cc 
b/osaf/services/saf/amf/amfd/sg_npm_fsm.cc
--- a/osaf/services/saf/amf/amfd/sg_npm_fsm.cc
+++ b/osaf/services/saf/amf/amfd/sg_npm_fsm.cc
@@ -721,8 +721,11 @@ static AVD_SU *avd_sg_npm_su_chose_asgn(
        while (si_iter != sg->list_of_si.end()) {
                i_si = *si_iter;
 
-               /* verify that the SI has active assignments and needs standby 
assignments. */
-               if ((i_si->list_of_sisu == AVD_SU_SI_REL_NULL) || 
(i_si->list_of_sisu->si_next != AVD_SU_SI_REL_NULL)) {
+               /* verify that the SI has active assignments and needs standby 
assignments.
+                   Also check if active assignment is valid or not.*/
+               if ((i_si->list_of_sisu == AVD_SU_SI_REL_NULL) ||
+                               (i_si->list_of_sisu->si_next != 
AVD_SU_SI_REL_NULL) ||
+                               (i_si->isActive() == false)) {
                        ++si_iter;
                        continue;
                }
diff --git a/osaf/services/saf/amf/amfd/si.cc b/osaf/services/saf/amf/amfd/si.cc
--- a/osaf/services/saf/amf/amfd/si.cc
+++ b/osaf/services/saf/amf/amfd/si.cc
@@ -1499,4 +1499,18 @@ const AVD_SIRANKEDSU *AVD_SI::get_si_ran
   }
 
   return sirankedsu;
-}
\ No newline at end of file
+}
+/**
+ * @brief       Checks whether SI has atleast one valid active assignment.
+ * @return      true/false
+ **/
+bool AVD_SI::isActive() const
+{
+       for (AVD_SU_SI_REL *sisu = list_of_sisu; sisu != nullptr; sisu = 
sisu->si_next) {
+               if ((sisu->state == SA_AMF_HA_ACTIVE) && (sisu->fsm == 
AVD_SU_SI_STATE_ASGND) &&
+                               (sisu->su->saAmfSuReadinessState == 
SA_AMF_READINESS_IN_SERVICE)) {
+                       return true;
+               }
+       }
+       return false;
+}

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to