osaf/services/saf/amf/amfd/include/si.h | 3 +-
osaf/services/saf/amf/amfd/include/si_dep.h | 3 +-
osaf/services/saf/amf/amfd/si_dep.cc | 79 ++++++++++++++--------------
3 files changed, 43 insertions(+), 42 deletions(-)
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
@@ -155,7 +155,8 @@ public:
bool in_sponsor_list(const AVD_SI_DEP *rec);
void take_action_on_dependents();
void update_self_si_dep_state();
-
+ void take_action();
+ void perform_role_failover();
private:
AVD_SI(const AVD_SI&);
diff --git a/osaf/services/saf/amf/amfd/include/si_dep.h
b/osaf/services/saf/amf/amfd/include/si_dep.h
--- a/osaf/services/saf/amf/amfd/include/si_dep.h
+++ b/osaf/services/saf/amf/amfd/include/si_dep.h
@@ -82,7 +82,8 @@ extern void avd_sidep_update_depstate_su
extern void avd_sidep_update_depstate_si_failover(AVD_SI *si, AVD_SU *su);
extern bool avd_sidep_si_dependency_exists_within_su(const AVD_SU *su);
extern bool avd_sidep_quiesced_done_for_all_dependents(const AVD_SI *si, const
AVD_SU *su);
-extern void sidep_si_take_action(AVD_SI *si);
extern void sidep_process_ready_to_unassign_depstate(AVD_SI *dep_si);
extern void avd_sidep_sg_take_action(AVD_SG *sg);
+
+
#endif
diff --git a/osaf/services/saf/amf/amfd/si_dep.cc
b/osaf/services/saf/amf/amfd/si_dep.cc
--- a/osaf/services/saf/amf/amfd/si_dep.cc
+++ b/osaf/services/saf/amf/amfd/si_dep.cc
@@ -165,7 +165,6 @@ static uint32_t sidep_sg_red_si_process_
static uint32_t sidep_si_dep_state_evt_send(AVD_CL_CB *cb, AVD_SI *si,
AVD_EVT_TYPE evt_type);
static uint32_t sidep_cyclic_dep_find(AVD_SI_DEP *sidep);
static void sidep_si_dep_start_unassign(AVD_CL_CB *cb, AVD_EVT *evt);
-static void sidep_dependentsi_role_failover(AVD_SI *si);
static const char *depstatename[] = {
"",
@@ -753,7 +752,7 @@ void avd_sidep_assign_evh(AVD_CL_CB *cb,
}
if (role_failover_pending == true) {
- sidep_dependentsi_role_failover(dep_si);
+ dep_si->perform_role_failover();
} else {
/*Check sponsors state once agian then take action*/
dep_si->update_self_si_dep_state();
@@ -764,7 +763,7 @@ void avd_sidep_assign_evh(AVD_CL_CB *cb,
}
}
else
- sidep_si_take_action(dep_si);
+ dep_si->take_action();
}
@@ -928,7 +927,7 @@ void AVD_SI::take_action_on_dependents()
if ((dep_si->si_dep_state ==
AVD_SI_FAILOVER_UNDER_PROGRESS) &&
(dep_si->all_sponsors_active() ==
true)) {
dep_si->set_dep_state(AVD_SI_READY_TO_ASSIGN);
- sidep_dependentsi_role_failover(dep_si);
+ dep_si->perform_role_failover();
}
continue;
}
@@ -1363,7 +1362,7 @@ static void sidep_ccb_apply_cb(CcbUtilOp
if (avd_cb->avail_state_avd == SA_AMF_HA_ACTIVE) {
/* Update the SI according to its existing sponsors
state */
dep_si->screen_si_dependencies();
- sidep_si_take_action(dep_si);
+ dep_si->take_action();
}
break;
@@ -1888,16 +1887,16 @@ void avd_sidep_update_depstate_su_rolefa
*
* @return Returns nothing
**/
-static void sidep_dependentsi_role_failover(AVD_SI *si)
+void AVD_SI::perform_role_failover()
{
AVD_SU *stdby_su = NULL, *actv_su = NULL;
AVD_SU_SI_REL *susi;
- TRACE_ENTER2(" for SI '%s'", si->name.value);
+ TRACE_ENTER2(" for SI '%s'", name.value);
- switch (si->sg_of_si->sg_redundancy_model) {
+ switch (sg_of_si->sg_redundancy_model) {
case SA_AMF_2N_REDUNDANCY_MODEL:
- for (susi = si->list_of_sisu;susi != NULL;susi = susi->si_next)
{
+ for (susi = list_of_sisu;susi != NULL;susi = susi->si_next) {
if (susi->state == SA_AMF_HA_STANDBY)
stdby_su = susi->su;
else
@@ -1920,7 +1919,7 @@ static void sidep_dependentsi_role_failo
*/
for (susi = stdby_su->list_of_susi;susi !=
NULL;susi = susi->su_next) {
if (susi->si->spons_si_list) {
- if (si->all_sponsors_active()
== false) {
+ if (all_sponsors_active() ==
false) {
TRACE("SI's sponsors
are not yet assigned");
goto done;
}
@@ -1931,9 +1930,9 @@ static void sidep_dependentsi_role_failo
*/
avd_sg_su_si_mod_snd(avd_cb, stdby_su,
SA_AMF_HA_ACTIVE);
- si->set_dep_state(AVD_SI_ASSIGNED);
+ set_dep_state(AVD_SI_ASSIGNED);
}
- if (si->sg_of_si->su_oper_list.su == NULL) {
+ if (sg_of_si->su_oper_list.su == NULL) {
/* add the SU to the operation list and change
the SG FSM to SG realign. */
avd_sg_su_oper_list_add(avd_cb, stdby_su,
false);
m_AVD_SET_SG_FSM(avd_cb, stdby_su->sg_of_su,
AVD_SG_FSM_SG_REALIGN);
@@ -1941,7 +1940,7 @@ static void sidep_dependentsi_role_failo
}
break;
case SA_AMF_NPM_REDUNDANCY_MODEL:
- for (susi = si->list_of_sisu;susi != NULL;susi = susi->si_next)
{
+ for (susi = list_of_sisu;susi != NULL;susi = susi->si_next) {
if (susi->state == SA_AMF_HA_STANDBY) {
stdby_su = susi->su;
break;
@@ -1953,7 +1952,7 @@ static void sidep_dependentsi_role_failo
*/
for (susi = stdby_su->list_of_susi;susi != NULL;susi =
susi->su_next) {
if (susi->si->spons_si_list) {
- if (si->all_sponsors_active() == false)
{
+ if (all_sponsors_active() == false) {
TRACE("SI's sponsors are not
yet assigned");
goto done;
}
@@ -1964,8 +1963,8 @@ static void sidep_dependentsi_role_failo
*/
avd_sg_su_si_mod_snd(avd_cb, stdby_su,
SA_AMF_HA_ACTIVE);
- si->set_dep_state(AVD_SI_ASSIGNED);
- if (si->sg_of_si->su_oper_list.su == NULL) {
+ set_dep_state(AVD_SI_ASSIGNED);
+ if (sg_of_si->su_oper_list.su == NULL) {
/* add the SU to the operation list and change
the SG FSM to SG realign. */
avd_sg_su_oper_list_add(avd_cb, stdby_su,
false);
m_AVD_SET_SG_FSM(avd_cb, stdby_su->sg_of_su,
AVD_SG_FSM_SG_REALIGN);
@@ -1973,13 +1972,13 @@ static void sidep_dependentsi_role_failo
}
break;
case SA_AMF_N_WAY_REDUNDANCY_MODEL:
- if (si->all_sponsors_active() == true) {
+ if (all_sponsors_active() == true) {
/* identify the most preferred standby su for this si */
- susi = avd_find_preferred_standby_susi(si);
+ susi = avd_find_preferred_standby_susi(this);
if (susi) {
avd_susi_mod_send(susi, SA_AMF_HA_ACTIVE);
- m_AVD_SET_SG_FSM(avd_cb, si->sg_of_si,
AVD_SG_FSM_SG_REALIGN);
- si->set_dep_state(AVD_SI_ASSIGNED);
+ m_AVD_SET_SG_FSM(avd_cb, sg_of_si,
AVD_SG_FSM_SG_REALIGN);
+ set_dep_state(AVD_SI_ASSIGNED);
}
}
break;
@@ -2311,48 +2310,48 @@ done:
* @return Nothing
*
**/
-void sidep_si_take_action(AVD_SI *si)
+void AVD_SI::take_action()
{
- TRACE_ENTER2("si:'%s', si_dep_state:'%s'",si->name.value,
depstatename[si->si_dep_state]);
+ TRACE_ENTER2("si:'%s', si_dep_state:'%s'", name.value,
depstatename[si_dep_state]);
- switch (si->si_dep_state) {
+ switch (si_dep_state) {
case AVD_SI_ASSIGNED:
/* SI is assigned. Assign all the unassigned
dependents*/
- if (si->num_dependents != 0)
- si->take_action_on_dependents();
+ if (num_dependents != 0)
+ take_action_on_dependents();
break;
case AVD_SI_READY_TO_ASSIGN:
/*If this SI is an sponsor, action will be taken on its
dependents post SG stable screening.
*/
- if (si->spons_si_list == NULL) {
- sidep_sg_red_si_process_assignment(avd_cb, si);
+ if (spons_si_list == NULL) {
+ sidep_sg_red_si_process_assignment(avd_cb,
this);
}
else
- sidep_si_dep_state_evt_send(avd_cb, si,
AVD_EVT_ASSIGN_SI_DEP_STATE);
+ sidep_si_dep_state_evt_send(avd_cb, this,
AVD_EVT_ASSIGN_SI_DEP_STATE);
break;
case AVD_SI_READY_TO_UNASSIGN:
/*Unassign this dependent because atleast one sponsor is
unassigned.*/
- if (si->spons_si_list == NULL)
+ if (spons_si_list == NULL)
/*If sponsor SI then unassigned it.*/
- si->unassign_dependent(avd_cb);
+ unassign_dependent(avd_cb);
else
/*For dependent SI start the tolerance timer or
unassign it*/
- sidep_process_ready_to_unassign_depstate(si);
+ sidep_process_ready_to_unassign_depstate(this);
break;
case AVD_SI_SPONSOR_UNASSIGNED:
/*This SI is unassigned so take action on dependents*/
- if (si->num_dependents > 0)
- si->take_action_on_dependents();
+ if (num_dependents > 0)
+ take_action_on_dependents();
break;
case AVD_SI_TOL_TIMER_RUNNING:
/*Action will be taken at the expiry of tolerance
timer.*/
break;
case AVD_SI_UNASSIGNING_DUE_TO_DEP:
- si->unassign_dependent(avd_cb);
+ unassign_dependent(avd_cb);
break;
case AVD_SI_FAILOVER_UNDER_PROGRESS:
/*No action action will taken during failover.*/
@@ -2361,15 +2360,15 @@ void sidep_si_take_action(AVD_SI *si)
/*a SI not participating in SI dependency or
a SI having dependent(s) and no sponsor*/
- if ((si->si_active() == false) &&
- (si->saAmfSIAdminState ==
SA_AMF_ADMIN_UNLOCKED)) {
+ if ((si_active() == false) &&
+ (saAmfSIAdminState == SA_AMF_ADMIN_UNLOCKED)) {
/*This is a SI with no sponsor. Assign it.*/
- sidep_sg_red_si_process_assignment(avd_cb, si);
+ sidep_sg_red_si_process_assignment(avd_cb,
this);
}
- if (si->num_dependents > 0) {
+ if (num_dependents > 0) {
/*This is an unassigned SI with dependents but
no sponsors.
Take action on dependents.*/
- si->take_action_on_dependents();
+ take_action_on_dependents();
}
break;
default:
@@ -2396,7 +2395,7 @@ void avd_sidep_sg_take_action(AVD_SG *sg
for (si = sg->list_of_si; si != NULL; si = si->sg_list_of_si_next) {
if ((si->spons_si_list != NULL) || (si->num_dependents > 0))
- sidep_si_take_action(si);
+ si->take_action();
}
TRACE_LEAVE();
}
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel