osaf/services/saf/amf/amfnd/clc.cc | 10 ++++++++++
osaf/services/saf/amf/amfnd/include/avnd_comp.h | 3 ++-
2 files changed, 12 insertions(+), 1 deletions(-)
Currently if two errors happen at once, amfnd calls two clc cleanup
commands in a row, and component fails into INSTANTIATION-FAILED
state
As two clc cleanup commands for same component are called, that means
two flows of component life cycle are running at the same time. After
the first cleanup finishes, amfnd starts clc initiate command. For
the reason mostly due to timing, while amfnd is waiting for the return
of clc initiate, amfnd receives the return of second clc cleanup.
Upon receiving the return of second clc cleanup, the next step is that
amfnd will start another clc initiate if the max retry of clc initiate
is large enough. But if the max retry is 2, component fails into
INSTANTIATION-FALED state, which should not happen.
The cause of this issue is mainly because amfnd lets two clc commands
running concurrently. The second clc command is redundant while the
first one is in progress. Any errors happen during clc command
execution, it should be detected in the first one. The patch avoids
the same clc commands running in a row if amfnd has not got clc_resp
(which indicates timeout/error/ok) from the others.
diff --git a/osaf/services/saf/amf/amfnd/clc.cc
b/osaf/services/saf/amf/amfnd/clc.cc
--- a/osaf/services/saf/amf/amfnd/clc.cc
+++ b/osaf/services/saf/amf/amfnd/clc.cc
@@ -325,6 +325,8 @@ uint32_t avnd_evt_clc_resp_evh(AVND_CB *
TRACE("'%s', command type:%s", comp->name.value,
clc_cmd_type[clc_evt->cmd_type]);
+ comp->clc_info.exec_cmd = AVND_COMP_CLC_CMD_TYPE_NONE;
+
switch (clc_evt->cmd_type) {
case AVND_COMP_CLC_CMD_TYPE_INSTANTIATE:
/*
@@ -2768,6 +2770,14 @@ uint32_t avnd_comp_clc_cmd_execute(AVND_
TRACE_ENTER2("'%s':CLC CLI command
type:'%s'",comp->name.value,clc_cmd_type[cmd_type]);
+ if (comp->clc_info.exec_cmd != cmd_type) {
+ comp->clc_info.exec_cmd = cmd_type;
+ } else {
+ TRACE("Another clc cmd of the same type: '%s' is in progress",
clc_cmd_type[cmd_type]);
+ TRACE_LEAVE2("%u", rc);
+ return rc;
+ }
+
/* the allocated memory is normally freed in comp_clc_resp_callback */
clc_evt = new AVND_CLC_EVT;
memcpy(&clc_evt->comp_name, &comp->name, sizeof(SaNameT));
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
@@ -76,6 +76,7 @@ typedef enum avnd_comp_clc_pres_fsm_ev {
/* clc command type enums */
typedef enum avnd_comp_clc_cmd_type {
+ AVND_COMP_CLC_CMD_TYPE_NONE = 0,
AVND_COMP_CLC_CMD_TYPE_INSTANTIATE = 1,
AVND_COMP_CLC_CMD_TYPE_TERMINATE,
AVND_COMP_CLC_CMD_TYPE_CLEANUP,
@@ -108,7 +109,7 @@ typedef struct avnd_comp_clc_info {
/*
* current command execution info
- * TODO: not used anymore, should be removed completely
+ * TODO: cmd_exec_ctxt is not used, to be removed
*/
AVND_COMP_CLC_CMD_TYPE exec_cmd; /* command in execution */
NCS_EXEC_HDL cmd_exec_ctxt; /* command execution context */
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel