G'day Gary,
I see you were adding the XML file dynamically with "immcfg -f". I
hadn't tried that. I hadn't tried killing the sample app, either.
Here is a patch that should fix both issues. Apply it on top of the
latest big one I sent.
Alex
On 08/13/2018 10:37 PM, Gary Lee wrote:
__________________________________________________________________
NOTICE: This email was received from an EXTERNAL sender
__________________________________________________________________
Hi Alex
I modified AppConfig-container.xml and changed saAmfSgtRedundancyModel
from 4 (NwayAct) to 1 (2N).
The xml still loads and I could unlock, resulting in:
root@SC-1:/var/log# immlist safVersion=1,safSgType=Container
Name Type
Value(s)
=======================================================================
=
safVersion SA_STRING_T
safVersion=1
saAmfSgtValidSuTypes SA_NAME_T
safVersion=1,safSuType=Container (32)
saAmfSgtRedundancyModel SA_UINT32_T 1 (0x1)
safSISU=safSu=SU2\,safSg=Container\,safApp=Container,safSi=Container,sa
fApp=Container
saAmfSISUHAState=STANDBY(2)
saAmfSISUHAReadinessState=READY_FOR_ASSIGNMENT(1)
safSISU=safSu=SU1\,safSg=Container\,safApp=Container,safSi=Container,sa
fApp=Container
saAmfSISUHAState=ACTIVE(1)
saAmfSISUHAReadinessState=READY_FOR_ASSIGNMENT(1)
Also, have you tried killing the amf_container_demo binary?
Thanks
Gary
On 14/08/18 05:00, Alex Jones wrote:
Hi Gary,
I just resubmitted a new patch which breaks out the different
components, and addresses the other comments here. But, #2
(rejecting all but NWay-active for container) should already be in
there. Is there a specific test you ran that didn't work?
Alex
On 08/13/2018 02:43 AM, Gary Lee wrote:
_______________________________________________________________
NOTICE: This email was received from an EXTERNAL sender
_______________________________________________________________
Hi Alex
Some initial comments:
0. Is it possible to split up the patch into amfd / amfnd / common /
samples. Just makes it easier to reply inline.
1. Please compile the container demo by default, and make
amf_container_script world executable.
Eg.
diff --git a/samples/amf/Makefile.am b/samples/amf/Makefile.am
index 447dedd..7ebf9c3 100644
--- a/samples/amf/Makefile.am
+++ b/samples/amf/Makefile.am
@@ -19,5 +19,5 @@ include $(top_srcdir)/Makefile.common
MAINTAINERCLEANFILES = Makefile.in
-SUBDIRS = sa_aware non_sa_aware wrapper proxy api_demo
+SUBDIRS = sa_aware non_sa_aware wrapper proxy api_demo container
diff --git a/samples/amf/container/amf_container_script
b/samples/amf/container/amf_container_script
old mode 100644
new mode 100755
diff --git a/samples/configure.ac b/samples/configure.ac
index 7cf803e..9765d54 100644
--- a/samples/configure.ac
+++ b/samples/configure.ac
@@ -67,6 +67,7 @@ AC_CONFIG_FILES([ \
amf/wrapper/Makefile \
amf/proxy/Makefile \
amf/api_demo/Makefile \
+ amf/container/Makefile \
cpsv/Makefile \
cpsv/ckpt_demo/Makefile \
cpsv/ckpt_track_demo/Makefile \
2. We should probably reject CCBs that set saAmfSgtRedundancyModel
to anything other than NWayActive, for Containers.
3. Do we need to bump the msg format version to
AVSV_AVD_AVND_MSG_FMT_VER_8? An old amfnd will assert if it gets an
AVSV_D2N_CONTAINED_SU_MSG_INFO msg.
Thanks
Gary
diff --git a/src/amf/amfd/comp.cc b/src/amf/amfd/comp.cc
index 571ac34fb..d8cbcf2ae 100644
--- a/src/amf/amfd/comp.cc
+++ b/src/amf/amfd/comp.cc
@@ -328,6 +328,31 @@ done:
TRACE_LEAVE();
}
+static bool get_container_redundancy_model_from_ccb(
+ CcbUtilOperationData_t *opdata,
+ const std::string& sg_name,
+ SaAmfRedundancyModelT& model) {
+ SaNameT aname, sgtypeName;
+ bool status(false);
+
+ osaf_extended_name_alloc(sg_name.c_str(), &aname);
+ CcbUtilOperationData_t *ccbSgOpData(ccbutil_getCcbOpDataByDN(opdata->ccbId, &aname)),
+ *ccbSgTypeOpData(nullptr);
+
+ if (ccbSgOpData && ccbSgOpData->operationType == CCBUTIL_CREATE &&
+ immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfSGType"),
+ ccbSgOpData->param.create.attrValues,
+ 0, &sgtypeName) == SA_AIS_OK &&
+ (ccbSgTypeOpData = ccbutil_getCcbOpDataByDN(opdata->ccbId, &sgtypeName)) &&
+ immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfSgtRedundancyModel"),
+ ccbSgTypeOpData->param.create.attrValues,
+ 0, &model) == SA_AIS_OK) {
+ status = true;
+ }
+
+ return status;
+}
+
/**
* Validate configuration attributes for an AMF Comp object
* @param comp
@@ -420,6 +445,38 @@ static int is_config_valid(const std::string &dn,
}
}
+ // container comp can only be in SG which is NWay-Active
+ if ((comptype && IS_COMP_CONTAINER(comptype->saAmfCtCompCategory)) ||
+ (ccbCompTypeOpData &&
+ ccbCompTypeOpData->operationType == CCBUTIL_CREATE &&
+ immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCtCompCategory"),
+ ccbCompTypeOpData->param.create.attrValues,
+ 0, &value) == SA_AIS_OK &&
+ value & SA_AMF_COMP_CONTAINER)) {
+ std::string sg_name;
+
+ avsv_sanamet_init(dn, sg_name, "safSg");
+ AVD_SG *sg(sg_db->find(sg_name));
+
+ SaAmfRedundancyModelT saAmfSgtRedundancyModel(SA_AMF_NO_REDUNDANCY_MODEL);
+
+ if (sg && sg->sg_type)
+ saAmfSgtRedundancyModel = sg->sg_type->saAmfSgtRedundancyModel;
+ else if (!get_container_redundancy_model_from_ccb(
+ opdata, sg_name, saAmfSgtRedundancyModel)) {
+ report_ccb_validation_error(
+ opdata, "'%s' does not exist in existing model or in CCB",
+ sg_name.c_str());
+ return 0;
+ }
+
+ if (saAmfSgtRedundancyModel != SA_AMF_N_WAY_ACTIVE_REDUNDANCY_MODEL) {
+ report_ccb_validation_error(
+ opdata, "Container component '%s' must be in SG which has "
+ "NWay-Active redundancy model", dn.c_str());
+ return 0;
+ }
+ }
#if 0
if ((comp->comp_info.category == AVSV_COMP_TYPE_SA_AWARE) && (comp->comp_info.init_len == 0)) {
diff --git a/src/amf/amfd/ndproc.cc b/src/amf/amfd/ndproc.cc
index eb5d2b3d8..9d6f0e1e4 100644
--- a/src/amf/amfd/ndproc.cc
+++ b/src/amf/amfd/ndproc.cc
@@ -1077,6 +1077,8 @@ void avd_data_update_req_evh(AVD_CL_CB *cb, AVD_EVT *evt) {
su, static_cast<SaAmfPresenceStateT>(l_val));
}
+ SaAmfPresenceStateT oldState(su->saAmfSUPresenceState);
+
su->set_pres_state(static_cast<SaAmfPresenceStateT>(l_val));
/* In the Quiesced node, ncs 2N SU is the spare SU so it's not
@@ -1126,6 +1128,11 @@ void avd_data_update_req_evh(AVD_CL_CB *cb, AVD_EVT *evt) {
avd_sg_su_si_mod_snd(cb, container_su, SA_AMF_HA_QUIESCED);
container_su->wait_for_contained_to_quiesce = false;
}
+ } else if (su->container() &&
+ l_val == SA_AMF_PRESENCE_INSTANTIATED &&
+ oldState == SA_AMF_PRESENCE_RESTARTING) {
+ // container restarted, need to restart contained components
+ su->instantiate_associated_contained_sus();
}
} else {
/* log error that a the value len is invalid */
diff --git a/src/amf/amfd/node.cc b/src/amf/amfd/node.cc
index b5ff0eab3..f6016c826 100644
--- a/src/amf/amfd/node.cc
+++ b/src/amf/amfd/node.cc
@@ -1693,8 +1693,6 @@ void AVD_AVND::instantiate_contained_sus(AVD_SU *container_su,
(su->su_on_node->node_state == AVD_AVND_STATE_NCS_INIT)) &&
((su->su_on_node->saAmfNodeAdminState != SA_AMF_ADMIN_LOCKED_INSTANTIATION) &&
(su->sg_of_su->saAmfSGAdminState != SA_AMF_ADMIN_LOCKED_INSTANTIATION)) &&
- ((su->saAmfSUOperState == SA_AMF_OPERATIONAL_ENABLED) ||
- (su->sg_of_su->sg_ncs_spec == true)) &&
(su->sg_of_su->saAmfSGNumPrefInserviceSUs >
sg_instantiated_su_count(su->sg_of_su))) {
if (avd_instantiate_contained_su(avd_cb, container_su, su, false) == NCSCC_RC_SUCCESS) {
diff --git a/src/amf/amfd/sg.cc b/src/amf/amfd/sg.cc
index 83af5292b..5732834e4 100644
--- a/src/amf/amfd/sg.cc
+++ b/src/amf/amfd/sg.cc
@@ -497,14 +497,6 @@ SaAisErrorT avd_sg_config_get(const std::string &app_dn, AVD_APP *app) {
error = SA_AIS_ERR_FAILED_OPERATION;
goto done2;
}
-
- if ((sg->any_container_su() == true) &&
- (sg->sg_redundancy_model != SA_AMF_N_WAY_ACTIVE_REDUNDANCY_MODEL)) {
- LOG_ER("%s: red model for container sg must be N-Way Active: %u",
- sg->name.c_str(),sg->sg_redundancy_model);
- error = SA_AIS_ERR_FAILED_OPERATION;
- goto done2;
- }
}
if (rc == SA_AIS_ERR_NOT_EXIST) {
diff --git a/src/amf/amfnd/comp.cc b/src/amf/amfnd/comp.cc
index 21abb310c..c898870a0 100644
--- a/src/amf/amfnd/comp.cc
+++ b/src/amf/amfnd/comp.cc
@@ -411,10 +411,11 @@ uint32_t avnd_evt_mds_ava_dn_evh(AVND_CB *cb, AVND_EVT *evt) {
comp = avnd_compdb_rec_get_next(cb->compdb, name)) {
name = comp->name;
if (0 == memcmp(&comp->reg_dest, &mds_evt->mds_dest, sizeof(MDS_DEST))) {
- /* proxied component can't have mds down event */
- if (m_AVND_COMP_TYPE_IS_PROXIED(comp))
+ /* proxied or contained component can't have mds down event */
+ if (m_AVND_COMP_TYPE_IS_PROXIED(comp) ||
+ m_AVND_COMP_TYPE_IS_CONTAINED(comp)) {
continue;
- else
+ } else
break;
} else {
comp = nullptr;
@@ -2776,6 +2777,28 @@ uint32_t comp_restart_initiate(AVND_COMP *comp) {
rc = avnd_comp_curr_info_del(cb, comp);
if (NCSCC_RC_SUCCESS != rc) goto done;
+ if (comp->container()) {
+ // reset contained comps for this container
+ AVND_COMP_CSI_REC *curr_csi(m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(
+ m_NCS_DBLIST_FIND_FIRST(&comp->csi_list)));
+ const std::string& containerCsi(curr_csi->name);
+
+ for (auto &it : cb->compdb) {
+ if (it.second->contained() &&
+ it.second->saAmfCompContainerCsi == containerCsi) {
+ rc = avnd_comp_curr_info_del(cb, it.second);
+ if (NCSCC_RC_SUCCESS != rc) goto done;
+
+ // unregister the contained comp
+ rc = avnd_comp_unreg_prc(cb, it.second, nullptr);
+
+ avnd_comp_pres_state_set(cb, it.second, SA_AMF_PRESENCE_UNINSTANTIATED);
+
+ avnd_su_pres_state_set(cb, it.second->su, SA_AMF_PRESENCE_UNINSTANTIATED);
+ }
+ }
+ }
+
if (!comp->su->suMaintenanceCampaign.empty() && !comp->admin_oper) {
LOG_NO("not restarting comp because maintenance campaign is set: %s",
comp->su->suMaintenanceCampaign.c_str());
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
