osaf/libs/common/amf/include/amf_defs.h         |   3 +-
 osaf/services/saf/amf/amfd/comptype.cc          |  16 +++++++++++
 osaf/services/saf/amf/amfnd/compdb.cc           |  35 +++++++++++++++++++++++-
 osaf/services/saf/amf/amfnd/include/avnd_comp.h |   1 +
 4 files changed, 52 insertions(+), 3 deletions(-)


Added support for saAmfCtDefInstantiationLevel

diff --git a/osaf/libs/common/amf/include/amf_defs.h 
b/osaf/libs/common/amf/include/amf_defs.h
--- a/osaf/libs/common/amf/include/amf_defs.h
+++ b/osaf/libs/common/amf/include/amf_defs.h
@@ -254,7 +254,8 @@ typedef enum
    saAmfCtDefClcCliTimeout_ID = 2,
    saAmfCtDefRecoveryOnError_ID = 3,
    saAmfCtDefDisableRestart_ID = 4,
-   saAmfCtDefQuiescingCompleteTimeout_ID = 5           
+   saAmfCtDefQuiescingCompleteTimeout_ID = 5,
+   saAmfCtDefInstantiationLevel_ID = 6           
 } AVSV_AMF_COMPTYPE_ATTR_ID; 
 
 /* Attribute ID enum for the SaAmfHealthcheck class */
diff --git a/osaf/services/saf/amf/amfd/comptype.cc 
b/osaf/services/saf/amf/amfd/comptype.cc
--- a/osaf/services/saf/amf/amfd/comptype.cc
+++ b/osaf/services/saf/amf/amfd/comptype.cc
@@ -461,6 +461,14 @@ static void ccb_apply_modify_hdlr(const 
                                param.value_len = sizeof(*param_val);
                                memcpy(param.value, param_val, param.value_len);
                                param.attr_id = 
saAmfCtDefQuiescingCompleteTimeout_ID;
+                               avd_snd_op_req_msg(avd_cb, *it, &param);
+                       } else if (!strcmp(attribute->attrName, 
"saAmfCtDefInstantiationLevel")) {
+                               SaUint32T *param_val = (SaUint32T 
*)attribute->attrValues[0];
+                               TRACE("saAmfCtDefInstantiationLevel to '%u' for 
compType '%s' on node '%s'", *param_val, 
+                                       opdata->objectName.value, 
(*it)->name.value);
+                               param.value_len = sizeof(*param_val);
+                               memcpy(param.value, param_val, param.value_len);
+                               param.attr_id = saAmfCtDefInstantiationLevel_ID;
                                avd_snd_op_req_msg(avd_cb, *it, &param);        
                        } else if (!strcmp(attribute->attrName, 
"saAmfCtDefRecoveryOnError")) {
                                SaAmfRecommendedRecoveryT *param_val = 
(SaAmfRecommendedRecoveryT *)attribute->attrValues[0];
@@ -576,6 +584,14 @@ static SaAisErrorT ccb_completed_modify_
                                rc = SA_AIS_ERR_BAD_OPERATION;
                                goto done;
                        }
+               } else if (!strcmp(mod->modAttr.attrName, 
"saAmfCtDefInstantiationLevel")) {
+                       uint32_t num_inst = *((SaUint32T 
*)mod->modAttr.attrValues[0]);
+                       if (num_inst == 0) {
+                               report_ccb_validation_error(opdata, 
"Modification of saAmfCtDefInstantiationLevel Fail,"
+                                               " Zero InstantiationLevel");
+                               rc = SA_AIS_ERR_BAD_OPERATION;
+                               goto done;
+                       }
                } else if (strcmp(mod->modAttr.attrName, 
"saAmfCtDefRecoveryOnError") == 0) {
                        uint32_t value = *((SaUint32T 
*)mod->modAttr.attrValues[0]);
                        if ((value < SA_AMF_COMPONENT_RESTART) || (value > 
SA_AMF_NODE_FAILFAST)) {
diff --git a/osaf/services/saf/amf/amfnd/compdb.cc 
b/osaf/services/saf/amf/amfnd/compdb.cc
--- a/osaf/services/saf/amf/amfnd/compdb.cc
+++ b/osaf/services/saf/amf/amfnd/compdb.cc
@@ -912,7 +912,15 @@ uint32_t avnd_comptype_oper_req(AVND_CB 
                        if (strncmp((const char*) comp->saAmfCompType.value, 
comp_type_name, comp->saAmfCompType.length) == 0) {
                                // 3. comptype found, check if component uses 
this comptype attribute value or if 
                                // component has specialized this attribute 
value.
-                               TRACE("comp name: %s , comp_type: %s", 
comp->name.value, comp->saAmfCompType.value);
+                               
+                               AVND_SU *su = m_AVND_SUDB_REC_GET(cb->sudb, 
comp->su->name);
+                               if (!su) {
+                                       LOG_ER("no su in database for the comp 
%s", comp->name.value);
+                                       goto done;
+                               }
+
+                               TRACE("su name: %s , comp name: %s , comp_type: 
%s", comp->su->name.value, 
+                                     comp->name.value, 
comp->saAmfCompType.value);
                                
                                switch (param->attr_id) {
                                case saAmfCtDefCallbackTimeout_ID: {
@@ -980,6 +988,27 @@ uint32_t avnd_comptype_oper_req(AVND_CB 
                                        }
                                        break;
                                }
+                               case saAmfCtDefInstantiationLevel_ID: {         
        
+                                       osafassert(sizeof(SaUint32T) == 
param->value_len);
+                               
+                                       if 
(comp->use_comptype_attr.test(CompInstantiationLevel)) {
+                                               comp->inst_level = *(SaUint32T 
*)(param->value);
+                                               /* Remove from the comp-list 
(maintained by su) */
+                                               rc = 
m_AVND_SUDB_REC_COMP_REM(*su, *comp);
+                                               if (NCSCC_RC_SUCCESS != rc) {
+                                                       LOG_ER("%s: %s remove 
failed", __FUNCTION__, comp->name.value);
+                                                       goto done;
+                                               }
+                               
+                                               (&comp->su_dll_node)->prev = 
NULL;
+                                               (&comp->su_dll_node)->next = 
NULL;
+                               
+                                               /* Add to the comp-list 
(maintained by su) */
+                                               m_AVND_SUDB_REC_COMP_ADD(*su, 
*comp, rc);
+                                               TRACE("comp->inst_level 
modified to '%u'", comp->inst_level);
+                                       }
+                                       break;
+                               }
                                case saAmfCtDefRecoveryOnError_ID: {
                                        SaAmfRecommendedRecoveryT 
saAmfCtDefRecoveryOnError = *((SaAmfRecommendedRecoveryT *) param->value);
                                        
osafassert(sizeof(SaAmfRecommendedRecoveryT) == param->value_len);
@@ -1528,8 +1557,10 @@ static int comp_init(AVND_COMP *comp, co
                const_cast<SaImmAttrNameT>("saAmfNodeSwBundlePathPrefix"),
                &nodeswbundle_name, &path_prefix);
 
-       if 
(immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCompInstantiationLevel"), 
attributes, 0, &comp->inst_level) != SA_AIS_OK)
+       if 
(immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCompInstantiationLevel"), 
attributes, 0, &comp->inst_level) != SA_AIS_OK) {
                comp->inst_level = comptype->saAmfCtDefInstantiationLevel;
+               comp->use_comptype_attr.set(CompInstantiationLevel);
+       }
 
        if 
(immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCompNumMaxInstantiateWithoutDelay"),
 attributes,
                            0, &comp->clc_info.inst_retry_max) != SA_AIS_OK)
diff --git a/osaf/services/saf/amf/amfnd/include/avnd_comp.h 
b/osaf/services/saf/amf/amfnd/include/avnd_comp.h
--- a/osaf/services/saf/amf/amfnd/include/avnd_comp.h
+++ b/osaf/services/saf/amf/amfnd/include/avnd_comp.h
@@ -295,6 +295,7 @@ enum UsedComptypeAttrs {
        DefRecoveryOnError,
        DefDisableRestart,
        DefQuiescingCompleteTimeout,
+        CompInstantiationLevel,
        NumAttrs
 };
 

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to