ack, code review only. Minor comment below. /Thanks HansN On 02/01/2016 07:15 AM, [email protected] wrote: > 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; [HansN] bool is_active() const; (Google style guide) > + 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; > +}
------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
