Hi Hans,
I have tested this version of the patch with 2N, Nored and nway active
models SG. Lock-in and unlock-in operation works fine. As previously
told there is a minor like reported in #1356(reported for lock and
unlock operation).Also if a node is unlocked-in individually when its
nodegroup is still in locked-in state then it is getting instantiated.
attached patch fixes this problem also.
I think this version can be pushed and for the minor problem (like
#1356) a separate ticket can be raised.
Thanks
Praveen
On 13-May-15 6:16 PM, Hans Nordeback wrote:
osaf/services/saf/amf/amfd/include/sg.h | 1 +
osaf/services/saf/amf/amfd/ndproc.cc | 2 +
osaf/services/saf/amf/amfd/nodegroup.cc | 198
++++++++++++++++++++++++++++++++
osaf/services/saf/amf/amfd/sgproc.cc | 20 +++-
4 files changed, 220 insertions(+), 1 deletions(-)
Updated with review comments. Merged the V1 of this patch with Praveens patch.
diff --git a/osaf/services/saf/amf/amfd/include/sg.h
b/osaf/services/saf/amf/amfd/include/sg.h
--- a/osaf/services/saf/amf/amfd/include/sg.h
+++ b/osaf/services/saf/amf/amfd/include/sg.h
@@ -552,6 +552,7 @@ extern bool sg_is_tolerance_timer_runnin
extern void avd_sg_adjust_config(AVD_SG *sg);
extern uint32_t sg_instantiated_su_count(const AVD_SG *sg);
extern bool sg_stable_after_lock_in_or_unlock_in(AVD_SG *sg);
+extern void process_su_si_response_for_ng(AVD_SU *su, SaAisErrorT res);
#endif
diff --git a/osaf/services/saf/amf/amfd/ndproc.cc
b/osaf/services/saf/amf/amfd/ndproc.cc
--- a/osaf/services/saf/amf/amfd/ndproc.cc
+++ b/osaf/services/saf/amf/amfd/ndproc.cc
@@ -784,6 +784,8 @@ void avd_data_update_req_evh(AVD_CL_CB *
node_admin_op_report_to_imm(su,
static_cast<SaAmfPresenceStateT>(l_val));
} else if (su->pend_cbk.invocation !=
0) {
su_admin_op_report_to_imm(su,
static_cast<SaAmfPresenceStateT>(l_val));
+ } else if (su->su_on_node->admin_ng !=
NULL) {
+
process_su_si_response_for_ng(su, SA_AIS_OK);
}
if (l_val ==
SA_AMF_PRESENCE_TERMINATION_FAILED) {
diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -824,6 +824,92 @@ void ng_unlock(AVD_AMF_NG *ng)
}
TRACE_LEAVE2("node_oper_list size:%u",ng->oper_list_size());
}
+
+/**
+ * Set term_state for all pre-inst SUs hosted on the specified node
+ *
+ * @param node
+ */
+static void node_sus_termstate_set(AVD_AVND *node, bool term_state)
+{
+ AVD_SU *su;
+
+ for (su = node->list_of_su; su; su = su->avnd_list_su_next) {
+ if (su->saAmfSUPreInstantiable == true)
+ su->set_term_state(term_state);
+ }
+}
+
+/**
+ * perform unlock-instantiation on NG with honoring saAmfSURank.
+ *
+ * @param cb
+ * @param ng
+ */
+static void ng_admin_unlock_inst(AVD_AMF_NG *ng)
+{
+ uint32_t su_try_inst;
+ std::set<std::string> tmp_sg_list;
+ TRACE_ENTER2("%s", ng->name.value);
+
+ for (std::set<std::string>::const_iterator iter =
ng->saAmfNGNodeList.begin();
+ iter != ng->saAmfNGNodeList.end(); ++iter) {
+ AVD_AVND *node = avd_node_get(*iter);
+ node->su_cnt_admin_oper = 0;
+ if (node->node_info.member == false) {
+ LOG_NO("'%s' UNLOCK_INSTANTIATION: CLM node is not
member", node->name.value);
+ continue;
+ }
+ if (node->saAmfNodeOperState == SA_AMF_OPERATIONAL_DISABLED) {
+ LOG_NO("'%s' UNLOCK_INSTANTIATION: AMF node oper state
disabled", node->name.value);
+ continue;
+ }
+ for (AVD_SU *node_su = node->list_of_su; node_su != NULL; node_su
= node_su->avnd_list_su_next) {
+ /*Instantiate only those SUs in this SG which are
hosted on the Nodes of NG.
+ Also honor saAmfSURank while instantating.
+ */
+ AVD_SG *sg = node_su->sg_of_su;
+
+ std::set<std::string>::const_iterator iter1 ;
+ iter1 = tmp_sg_list.find(Amf::to_string(&sg->name));
+ if (iter1 != tmp_sg_list.end())
+ continue;
+
+ AVD_SU *su = sg->list_of_su;
+ for (su_try_inst = 0; su != NULL; su =
su->sg_list_su_next) {
+ //Continue if this SU is not hosted on the Node
of NG.
+ if
(node_in_nodegroup(Amf::to_string(&su->su_on_node->name), ng) == false)
+ continue;
+
+ if ((su->saAmfSUAdminState !=
SA_AMF_ADMIN_LOCKED_INSTANTIATION) &&
+ (node->saAmfNodeAdminState !=
SA_AMF_ADMIN_LOCKED_INSTANTIATION) &&
+ (su->saAmfSUOperState ==
SA_AMF_OPERATIONAL_ENABLED) &&
+ (su->saAmfSUPresenceState ==
SA_AMF_PRESENCE_UNINSTANTIATED)) {
+ if ((su->saAmfSUPreInstantiable ==
false) ||
+ (node->node_state !=
AVD_AVND_STATE_PRESENT))
+ continue;
+
+ if (sg->saAmfSGNumPrefInserviceSUs >
su_try_inst) {
+ if
(avd_snd_presence_msg(avd_cb, su, false) != NCSCC_RC_SUCCESS) {
+ LOG_NO("Failed to send
Instantiation of '%s'", su->name.value);
+ } else {
+
su->su_on_node->su_cnt_admin_oper++;
+ su_try_inst++;
+ }
+ }
+ }
+ }
+ tmp_sg_list.insert(Amf::to_string(&sg->name));
+ }
+ TRACE("node:'%s', su_cnt_admin_oper:%u",
+ node->name.value, node->su_cnt_admin_oper);
+ if (node->su_cnt_admin_oper > 0)
+ ng->node_oper_list.insert(Amf::to_string(&node->name));
+ }
+ TRACE("node_oper_list size:%u",ng->oper_list_size());
+ TRACE_LEAVE();
+}
+
/**
* Handle admin operations on SaAmfNodeGroup objects.
*
@@ -842,6 +928,118 @@ static void ng_admin_op_cb(SaImmOiHandle
TRACE_ENTER2("'%s', inv:'%llu',
op:'%llu'",ng_name->value,invocation,op_id);
switch(op_id) {
+ case SA_AMF_ADMIN_LOCK_INSTANTIATION:
+ rc = check_ng_stability(ng);
+ if (rc != SA_AIS_OK) {
+ report_admin_op_error(avd_cb->immOiHandle, invocation,
+ SA_AIS_ERR_TRY_AGAIN, NULL,
+ "Some entity is unstable, Operation
cannot "
+ "be performed on '%s'"
+ "Check syslog for entity details",
ng_name->value);
+ goto done;
+ }
+ if (ng->saAmfNGAdminState == SA_AMF_ADMIN_LOCKED_INSTANTIATION)
{
+ report_admin_op_error(avd_cb->immOiHandle, invocation,
SA_AIS_ERR_NO_OP, NULL,
+ "'%s' Invalid Admin Operation LOCK
INSTANTIATION in state %s",
+ ng->name.value,
avd_adm_state_name[ng->saAmfNGAdminState]);
+ goto done;
+ }
+ if (ng->saAmfNGAdminState != SA_AMF_ADMIN_LOCKED) {
+ report_admin_op_error(avd_cb->immOiHandle, invocation,
SA_AIS_ERR_BAD_OPERATION, NULL,
+ "'%s' Invalid Admin Operation
LOCK_INSTANTIATION in state %s",
+ ng->name.value,
avd_adm_state_name[ng->saAmfNGAdminState]);
+ goto done;
+ }
+ rc = check_red_model_service_outage(ng);
+ if (rc != SA_AIS_OK) {
+ report_admin_op_error(avd_cb->immOiHandle, invocation,
+ SA_AIS_ERR_NOT_SUPPORTED, NULL,
+ "SUs of unsupported red models hosted
on '%s'"
+ "Check syslog for entity details",
ng_name->value);
+ goto done;
+ }
+ ng->admin_ng_pend_cbk.invocation = invocation;
+ ng->admin_ng_pend_cbk.admin_oper =
static_cast<SaAmfAdminOperationIdT>(op_id);
+ ng->node_oper_list.clear();
+
+ avd_ng_admin_state_set(ng, SA_AMF_ADMIN_LOCKED_INSTANTIATION);
+ for (std::set<std::string>::const_iterator iter =
ng->saAmfNGNodeList.begin();
+ iter != ng->saAmfNGNodeList.end(); ++iter) {
+ AVD_AVND *node = avd_node_get(*iter);
+ node->su_cnt_admin_oper = 0;
+ node->admin_ng = ng;
+ node_sus_termstate_set(node, true);
+ node_admin_state_set(node,
SA_AMF_ADMIN_LOCKED_INSTANTIATION);
+ }
+ for (std::set<std::string>::const_iterator iter =
ng->saAmfNGNodeList.begin();
+ iter != ng->saAmfNGNodeList.end(); ++iter) {
+ AVD_AVND *node = avd_node_get(*iter);
+ if (node->node_info.member == false) {
+ LOG_NO("'%s' LOCK_INSTANTIATION: CLM node is not
member", node->name.value);
+ continue;
+ }
+ if (node->saAmfNodeOperState ==
SA_AMF_OPERATIONAL_DISABLED) {
+ LOG_NO("'%s' LOCK_INSTANTIATION: AMF node oper state
disabled", node->name.value);
+ continue;
+ }
+ avd_node_admin_lock_instantiation(node);
+ TRACE("node:'%s', su_cnt_admin_oper:%u",
+ node->name.value,
node->su_cnt_admin_oper);
+ if (node->su_cnt_admin_oper > 0)
+
ng->node_oper_list.insert(Amf::to_string(&node->name));
+ }
+ TRACE("node_oper_list size:%u",ng->oper_list_size());
+ if (ng->node_oper_list.empty())
+ ng_complete_admin_op(ng, SA_AIS_OK);
+ break;
+ case SA_AMF_ADMIN_UNLOCK_INSTANTIATION:
+ rc = check_ng_stability(ng);
+ if (rc != SA_AIS_OK) {
+ report_admin_op_error(avd_cb->immOiHandle, invocation,
+ SA_AIS_ERR_TRY_AGAIN, NULL,
+ "Some entity is unstable, Operation
cannot "
+ "be performed on '%s'"
+ "Check syslog for entity details",
ng_name->value);
+ goto done;
+ }
+ if (ng->saAmfNGAdminState == SA_AMF_ADMIN_LOCKED) {
+ report_admin_op_error(avd_cb->immOiHandle, invocation,
SA_AIS_ERR_NO_OP, NULL,
+ "'%s' Already in LOCKED state",
ng->name.value);
+ goto done;
+ }
+
+ if (ng->saAmfNGAdminState != SA_AMF_ADMIN_LOCKED_INSTANTIATION)
{
+ report_admin_op_error(avd_cb->immOiHandle, invocation,
SA_AIS_ERR_BAD_OPERATION, NULL,
+ "'%s' Invalid Admin Operation
UNLOCK_INSTANTIATION in state %s",
+ ng->name.value,
avd_adm_state_name[ng->saAmfNGAdminState]);
+ goto done;
+ }
+ rc = check_red_model_service_outage(ng);
+ if (rc != SA_AIS_OK) {
+ report_admin_op_error(avd_cb->immOiHandle, invocation,
+ SA_AIS_ERR_NOT_SUPPORTED, NULL,
+ "SUs of unsupported red models hosted
on '%s'"
+ "Check syslog for entity details",
ng_name->value);
+ goto done;
+ }
+
+ ng->admin_ng_pend_cbk.invocation = invocation;
+ ng->admin_ng_pend_cbk.admin_oper =
static_cast<SaAmfAdminOperationIdT>(op_id);
+ ng->node_oper_list.clear();
+
+ avd_ng_admin_state_set(ng, SA_AMF_ADMIN_LOCKED);
+ for (std::set<std::string>::const_iterator iter =
ng->saAmfNGNodeList.begin();
+ iter != ng->saAmfNGNodeList.end(); ++iter) {
+ AVD_AVND *node = avd_node_get(*iter);
+ node->su_cnt_admin_oper = 0;
+ node->admin_ng = ng;
+ node_sus_termstate_set(node, false);
+ node_admin_state_set(node, SA_AMF_ADMIN_LOCKED);
+ }
+ ng_admin_unlock_inst(ng);
+ if (ng->node_oper_list.empty())
+ ng_complete_admin_op(ng, SA_AIS_OK);
+ break;
case SA_AMF_ADMIN_LOCK:
rc = check_ng_stability(ng);
if (rc != SA_AIS_OK) {
diff --git a/osaf/services/saf/amf/amfd/sgproc.cc
b/osaf/services/saf/amf/amfd/sgproc.cc
--- a/osaf/services/saf/amf/amfd/sgproc.cc
+++ b/osaf/services/saf/amf/amfd/sgproc.cc
@@ -329,7 +329,7 @@ static void node_complete_admin_op(AVD_A
* @param[in] ptr to SU (AVD_SU).
* @param[in] res(SaAisErrorT).
*/
-static void process_su_si_response_for_ng(AVD_SU *su, SaAisErrorT res)
+void process_su_si_response_for_ng(AVD_SU *su, SaAisErrorT res)
{
TRACE_ENTER2("'%s'",su->name.value);
AVD_AMF_NG *ng = su->su_on_node->admin_ng;
@@ -377,6 +377,24 @@ static void process_su_si_response_for_n
avd_ng_admin_state_set(ng, SA_AMF_ADMIN_LOCKED);
}
}
+ if (ng->saAmfNGAdminState == SA_AMF_ADMIN_LOCKED_INSTANTIATION) {
+ if ((su->saAmfSUPresenceState ==
SA_AMF_PRESENCE_UNINSTANTIATED) ||
+ (su->saAmfSUPresenceState ==
SA_AMF_PRESENCE_TERMINATION_FAILED)) {
+ su->su_on_node->su_cnt_admin_oper--;
+ TRACE("node:'%s', su_cnt_admin_oper:%u",
+
su->su_on_node->name.value,su->su_on_node->su_cnt_admin_oper);
+ }
+ }
+ if ((ng->saAmfNGAdminState == SA_AMF_ADMIN_LOCKED) &&
+ (ng->admin_ng_pend_cbk.admin_oper ==
SA_AMF_ADMIN_UNLOCK_INSTANTIATION)) {
+ if ((su->saAmfSUPresenceState == SA_AMF_PRESENCE_INSTANTIATED)
||
+ (su->saAmfSUPresenceState ==
SA_AMF_PRESENCE_TERMINATION_FAILED) ||
+ (su->saAmfSUPresenceState ==
SA_AMF_PRESENCE_INSTANTIATION_FAILED)) {
+ su->su_on_node->su_cnt_admin_oper--;
+ TRACE("node:'%s', su_cnt_admin_oper:%u",
+
su->su_on_node->name.value,su->su_on_node->su_cnt_admin_oper);
+ }
+ }
/*If no futher SU is undergoing assignment changes, erase node from
nodgroup operation tracking list.*/
if (node->su_cnt_admin_oper == 0) {
diff --git a/osaf/services/saf/amf/amfd/include/node.h
b/osaf/services/saf/amf/amfd/include/node.h
--- a/osaf/services/saf/amf/amfd/include/node.h
+++ b/osaf/services/saf/amf/amfd/include/node.h
@@ -238,4 +238,5 @@ extern void avd_nodeswbundle_constructor
extern void ng_complete_admin_op(AVD_AMF_NG *ng, SaAisErrorT result);
extern void avd_ng_admin_state_set(AVD_AMF_NG* ng, SaAmfAdminStateT state);
extern bool are_all_ngs_in_unlocked_state(const AVD_AVND *node);
+extern bool any_ng_in_locked_in_state(const AVD_AVND *node);
#endif
diff --git a/osaf/services/saf/amf/amfd/node.cc
b/osaf/services/saf/amf/amfd/node.cc
--- a/osaf/services/saf/amf/amfd/node.cc
+++ b/osaf/services/saf/amf/amfd/node.cc
@@ -1299,6 +1299,14 @@ static void node_admin_op_cb(SaImmOiHand
avd_saImmOiAdminOperationResult(immOiHandle,
invocation, SA_AIS_OK);
goto done;
}
+ //If any Nodegroup of node is still in lock-in state then do
not instantiate the node.
+ if (any_ng_in_locked_in_state(node) == true) {
+ TRACE_1("Atleast one Node group of node is in lock-in
state");
+ avd_saImmOiAdminOperationResult(immOiHandle,
invocation, SA_AIS_OK);
+ node->admin_node_pend_cbk.invocation = 0;
+ node->admin_node_pend_cbk.admin_oper =
static_cast<SaAmfAdminOperationIdT>(0);
+ goto done;
+ }
/* now do the unlock_instantiation of the node */
if (NCSCC_RC_SUCCESS == node_admin_unlock_instantiation(node)) {
@@ -1429,6 +1437,22 @@ bool are_all_ngs_in_unlocked_state(const
}
return true;
}
+/**
+ * @brief Checks if any nodegroup of node are is in LOCKED_IN state.
+ * @param ptr to Node (AVD_AVND).
+ * @return true/false
+ */
+bool any_ng_in_locked_in_state(const AVD_AVND *node)
+{
+ for (std::map<std::string, AVD_AMF_NG*>::const_iterator it =
nodegroup_db->begin();
+ it != nodegroup_db->end(); it++) {
+ AVD_AMF_NG *ng = it->second;
+ if ((node_in_nodegroup(Amf::to_string(&node->name), ng) ==
true) &&
+ (ng->saAmfNGAdminState ==
SA_AMF_ADMIN_LOCKED_INSTANTIATION))
+ return true;
+ }
+ return false;
+}
void avd_node_constructor(void)
{
diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -969,6 +969,8 @@ static void ng_admin_op_cb(SaImmOiHandle
node->su_cnt_admin_oper = 0;
node->admin_ng = ng;
node_sus_termstate_set(node, true);
+ if (node->saAmfNodeAdminState != SA_AMF_ADMIN_LOCKED)
+ continue;
node_admin_state_set(node,
SA_AMF_ADMIN_LOCKED_INSTANTIATION);
}
for (std::set<std::string>::const_iterator iter =
ng->saAmfNGNodeList.begin();
@@ -1034,6 +1036,8 @@ static void ng_admin_op_cb(SaImmOiHandle
node->su_cnt_admin_oper = 0;
node->admin_ng = ng;
node_sus_termstate_set(node, false);
+ if (node->saAmfNodeAdminState !=
SA_AMF_ADMIN_LOCKED_INSTANTIATION)
+ continue;
node_admin_state_set(node, SA_AMF_ADMIN_LOCKED);
}
ng_admin_unlock_inst(ng);
diff --git a/osaf/services/saf/amf/amfd/sgproc.cc
b/osaf/services/saf/amf/amfd/sgproc.cc
--- a/osaf/services/saf/amf/amfd/sgproc.cc
+++ b/osaf/services/saf/amf/amfd/sgproc.cc
@@ -1630,7 +1630,8 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_
(i_su->saAmfSUPresenceState ==
SA_AMF_PRESENCE_UNINSTANTIATED) &&
(su_node_ptr->saAmfNodeOperState ==
SA_AMF_OPERATIONAL_ENABLED) &&
(i_su->saAmfSUOperState ==
SA_AMF_OPERATIONAL_ENABLED) &&
- (i_su->term_state == false)) {
+ (i_su->term_state == false) &&
+ (any_ng_in_locked_in_state(su_node_ptr) == false)) {
if (i_su->is_in_service() == true) {
i_su->set_readiness_state(SA_AMF_READINESS_IN_SERVICE);
@@ -1651,7 +1652,8 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_
(su_node_ptr->saAmfNodeOperState ==
SA_AMF_OPERATIONAL_ENABLED) &&
(su_node_ptr->node_info.member == true)
&&
(i_su->saAmfSUOperState ==
SA_AMF_OPERATIONAL_ENABLED) &&
- (i_su->term_state == false)) {
+ (i_su->term_state == false) &&
+ (any_ng_in_locked_in_state(su_node_ptr)
== false)) {
TRACE("%u, %u", sg->saAmfSGNumPrefInserviceSUs,
num_try_insvc_su);
if (sg->saAmfSGNumPrefInserviceSUs >
(sg_instantiated_su_count(i_su->sg_of_su) +
num_try_insvc_su)){
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel