Some comments inline with [Praveen].
I think, this change should be tracked in a new enhancement ticket.
Thanks,
Praveen
On 09-Apr-15 7:59 PM, Hans Nordeback wrote:
> osaf/services/saf/amf/amfd/nodegroup.cc | 145
> ++++++++++++++++++++++++++++++++
> 1 files changed, 145 insertions(+), 0 deletions(-)
>
>
> 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
> @@ -811,6 +811,22 @@ 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);
> + }
> +}
> +
[Praveen] Same function in node.cc can be used.
> /**
> * Handle admin operations on SaAmfNodeGroup objects.
> *
> @@ -829,6 +845,135 @@ 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_BAD_OPERATION, NULL,
> + "'%s' Invalid Admin Operation
> LOCK INSTANTIATION in state %s",
> + ng->name.value,
> avd_adm_state_name[ng->saAmfNGAdminState]);
> + goto done;
> + }
[Praveen]Above, NO_OP should be returned instead of
SA_AIS_ERR_BAD_OPERATION .
> + 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);
> +
> + if (node->node_info.member == false) {
> + LOG_NO("'%s' LOCK_INSTANTIATION: CLM node is
> not member", node->name.value);
> +
> avd_saImmOiAdminOperationResult(avd_cb->immOiHandle, invocation, SA_AIS_OK);
> + goto done;
> + }
> +
> + if (node->saAmfNodeOperState ==
> SA_AMF_OPERATIONAL_DISABLED) {
> + LOG_NO("'%s' LOCK_INSTANTIATION: AMF node oper
> state disabled", node->name.value);
> +
> avd_saImmOiAdminOperationResult(avd_cb->immOiHandle, invocation, SA_AIS_OK);
> + goto done;
> + }
[Praveen] for loop should continue in both the above if conditions
without replying to IMM as some nodes may still be in healthy state in
the nodelist.
> + }
> +
> + for (std::set<std::string>::const_iterator iter =
> ng->saAmfNGNodeList.begin();
> + iter != ng->saAmfNGNodeList.end(); ++iter) {
> + AVD_AVND *node = avd_node_get(*iter);
> + avd_node_admin_lock_instantiation(node);
> + }
> +
[Praveen] In avd_node_admin_lock_instantiation() node->su_cnt_admin_oper
will be updated. So before performing the below check,
ng->node_oper_list should be updated. Otherwise AMF will reply to IMM
before the completion of operation.
> + 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_sus_termstate_set(node, false);
> + if (node->node_info.member == false) {
> + LOG_NO("'%s' UNLOCK_INSTANTIATION: CLM node is
> not member", node->name.value);
> +
> avd_saImmOiAdminOperationResult(avd_cb->immOiHandle, invocation, SA_AIS_OK);
> + goto done;
> + }
> +
> + if (node->saAmfNodeOperState ==
> SA_AMF_OPERATIONAL_DISABLED) {
> + LOG_NO("'%s' UNLOCK_INSTANTIATION: AMF node
> oper state disabled", node->name.value);
> +
> avd_saImmOiAdminOperationResult(avd_cb->immOiHandle, invocation, SA_AIS_OK);
> + goto done;
> + }
> + }
[Praveen] for loop should continue in both the above if conditions
without replying to IMM as some nodes may still be in healthy state in
the nodelist.
> +
> + for (std::set<std::string>::const_iterator iter =
> ng->saAmfNGNodeList.begin();
> + iter != ng->saAmfNGNodeList.end(); ++iter) {
> + AVD_AVND *node = avd_node_get(*iter);
> +
> + /* now do the unlock_instantiation of the node */
> + node_admin_unlock_instantiation(node);
> + }
[Praveen] After resetting the term state of all the SUs of nodes in
nodegroup, AMF must instantiate SU honoring the SU rank and honoring the
PrefInserviceSU criteria for the whole nodegroup instead of a single
node. In above for loop since node_admin_unlock_instantiation() is
called for each node, it can lead to instantiation of a lower rank SU of
same SG if a higher rank SU of same SG is hosted on a different node of
nodegroup for which this function will be called in the next iteration.
Here also ng->node_oper_list must be updated based on
node->su_cnt_admin_oper, otherwise AMF will reply to IMM before the
completion of operation.
> +
> + 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) {
>
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel