Hi Vu,
I was trying validate patch , the App stream got deleted as expected
after this patch fix ,
whic was not getting deleted as reported in this ticket (#1877)
but getting "WA saImmOiRtObjectDelete returned 12" while deleting why ?
===========================================================================================================
1) Created application stream
SC-1:#immcfg -c SaLogStreamConfig
safLgStrCfg=appstream1,safApp=safLogService -a
saLogStreamPathName=applogs -a saLogStreamMaxLogFileSize=1500 -a
saLogStreamMaxFilesRotated=4 -a saLogStreamFileName=applicationStream1
2) crated headless state ( stooped both controllers )
3) restored form headless state ( restarted both both controllers )
4) checked the App stream & IMM object exist
SC-1: # immlist safLgStrCfg=appstream1,safApp=safLogService
Name Type Value(s)
========================================================================
safLgStrCfg SA_STRING_T
safLgStrCfg=appstream1
saLogStreamSeverityFilter SA_UINT32_T <Empty>
saLogStreamPathName SA_STRING_T applogs
saLogStreamNumOpeners SA_UINT32_T 1 (0x1)
saLogStreamMaxLogFileSize SA_UINT64_T 1500 (0x5dc)
saLogStreamMaxFilesRotated SA_UINT32_T 4 (0x4)
saLogStreamLogFullHaltThreshold SA_UINT32_T 75 (0x4b)
saLogStreamLogFullAction SA_UINT32_T 3 (0x3)
saLogStreamLogFileFormat SA_STRING_T <Empty>
saLogStreamFixedLogRecordSize SA_UINT32_T 150 (0x96)
saLogStreamFileName SA_STRING_T
applicationStream1
saLogStreamCreationTimestamp SA_TIME_T
1466496942638256691 (0x145a0b3312265233, Tue Jun 21 13:45:42 2016)
logStreamDiscardedCounter SA_UINT64_T 0 (0x0)
SaImmAttrImplementerName SA_STRING_T
safLogService
SaImmAttrClassName SA_STRING_T
SaLogStreamConfig
SaImmAttrAdminOwnerName SA_STRING_T <Empty>
5) Deleted the stream
SC-1:# immcfg -d safLgStrCfg=appstream1,safApp=safLogService
While deleting revived following warning :
Jun 21 13:48:35 SC-1 osafimmnd[28957]: NO Ccb 3 COMMITTED
(immcfg_SC-1_29261)
Jun 21 13:48:35 SC-1 osaflogd[28969]: WA saImmOiRtObjectDelete returned
12 for safLgStrCfg=appstream1,safApp=safLogService
6) checked again the App stream & IMM object( App stream got
deleted as this patch fixed the issue reported in this ticket #1877 )
SC-1:# immlist safLgStrCfg=appstream1,safApp=safLogService
error - object or attribute does not exist
===========================================================================================================
-AVM
On 6/14/2016 11:33 AM, Vu Minh Nguyen wrote:
> osaf/services/saf/logsv/lgs/lgs_imm.cc | 54 +++++++++++++++++++++++--------
> tests/logsv/logtest.c | 2 +
> tests/logsv/logtest.h | 1 +
> tests/logsv/tet_Log_recov.c | 57
> ++++++++++++++++++++++++++++++++++
> 4 files changed, 100 insertions(+), 14 deletions(-)
>
>
> logsv supposed there were only three well-known config streams at logsv
> startup.
> But this is not true when headless mode is enabled, so the stream id was
> wrongly assigned to streams.
>
> One more thing, with headless enabled, app streams can be found at startup
> and app stream DN can be named not under `safApp=safLogService`.
> So, searching config objects under the root `safApp=safLogService` could
> miss the config app streams. e.g: app stream with DN "safLgStrCfg=Test"
>
> This patch fix the problem and also add new test suite #12 to test
> if created app stream can be deleted after headless.
>
> diff --git a/osaf/services/saf/logsv/lgs/lgs_imm.cc
> b/osaf/services/saf/logsv/lgs/lgs_imm.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_imm.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_imm.cc
> @@ -144,6 +144,21 @@ static void report_om_error(SaImmOiHandl
> }
>
> /**
> + * Check to see if given DN is well-known stream or notE
> + *
> + * @param dn stream DN
> + * @ret true if well-known stream, false otherwise
> + */
> +static bool is_well_know_stream(const char* dn)
> +{
> + if (strcmp(dn, SA_LOG_STREAM_ALARM) == 0) return true;
> + if (strcmp(dn, SA_LOG_STREAM_NOTIFICATION) == 0) return true;
> + if (strcmp(dn, SA_LOG_STREAM_SYSTEM) == 0) return true;
> +
> + return false;
> +}
> +
> +/**
> * Pack and send a log service config checkpoint using mbcsv
> * @param stream
> *
> @@ -1694,7 +1709,11 @@ static SaAisErrorT stream_ccb_completed_
> log_stream_t *stream = log_stream_get_by_name(name);
>
> if (stream != NULL) {
> - if (stream->streamId < 3) {
> + /**
> + * Use stream name (DN) to regcogize if the stream is
> well-known or not
> + * instead of using streamID. This is to avoid any mishandling
> on streamId.
> + */
> + if (is_well_know_stream(name)) {
> report_oi_error(immOiHandle, opdata->ccbId,
> "Stream delete: well known stream '%s'
> cannot be deleted", name);
> goto done;
> @@ -2713,13 +2732,11 @@ SaAisErrorT lgs_imm_init_configStreams(l
> SaImmSearchHandleT immSearchHandle;
> SaImmSearchParametersT_2 objectSearch;
> SaImmAttrValuesT_2 **attributes;
> + int wellknownStreamId = 0;
> + int appStreamId = 3;
> int streamId = 0;
> SaNameT objectName;
> - SaNameT root_name;
> -
> - strcpy((char *) root_name.value, "safApp=safLogService");
> - root_name.length = sizeof("safApp=safLogService");
> -
> + const char *className = "SaLogStreamConfig";
>
> TRACE_ENTER();
>
> @@ -2735,27 +2752,36 @@ SaAisErrorT lgs_imm_init_configStreams(l
> osaf_abort(0);
> }
>
> - /* Search for all objects of class "SaLogStreamConfig" */
> - objectSearch.searchOneAttr.attrName =
> const_cast<SaImmAttrNameT>("safLgStrCfg");
> + /* Search for all objects of class "SaLogStreamConfig". */
> + /* Should not base on the attribute name `safLgStrCfg` as the user can
> create any class having that name */
> + objectSearch.searchOneAttr.attrName =
> const_cast<SaImmAttrNameT>("SaImmAttrClassName");
> objectSearch.searchOneAttr.attrValueType = SA_IMM_ATTR_SASTRINGT;
> - objectSearch.searchOneAttr.attrValue = NULL;
> -
> - if ((om_rc = immutil_saImmOmSearchInitialize_2(omHandle, &root_name,
> + objectSearch.searchOneAttr.attrValue = &className;
> +
> + /**
> + * Search from root as app stream DN name can be any - maybe not under
> the RDN `safApp=safLogService`
> + * Therefore, searching all class under `safApp=safLogService` might
> miss configurable app stream
> + * eg: app stream with DN `saLgStrCfg=test`
> + */
> + if ((om_rc = immutil_saImmOmSearchInitialize_2(omHandle, NULL,
> SA_IMM_SUBTREE, SA_IMM_SEARCH_ONE_ATTR |
> SA_IMM_SEARCH_GET_NO_ATTR,
> &objectSearch, NULL, /* Get no attributes */
> &immSearchHandle)) == SA_AIS_OK) {
>
> while (immutil_saImmOmSearchNext_2(immSearchHandle,
> &objectName, &attributes) == SA_AIS_OK) {
> - /* Note: Here is creationTimeStamp and severityFilter
> set
> - * Can be recovered if scAbseceAllowed
> + /**
> + * With headless mode enabled, when lgsv restarts,
> there could be other configurable app streams.
> + * It differs from legacy mode in which no app stream
> could be exist at startup.
> + *
> + * With well-known streams, stream ID is in reserved
> numbers [0-2].
> */
> + streamId = is_well_know_stream((char
> *)objectName.value)? wellknownStreamId++:appStreamId++;
> ais_rc = stream_create_and_configure((char*)
> objectName.value,
> &stream, streamId, accessorHandle);
> if (ais_rc != SA_AIS_OK) {
> LOG_WA("stream_create_and_configure failed %d",
> ais_rc);
> goto done;
> }
> - streamId += 1;
> }
> }
>
> diff --git a/tests/logsv/logtest.c b/tests/logsv/logtest.c
> --- a/tests/logsv/logtest.c
> +++ b/tests/logsv/logtest.c
> @@ -505,6 +505,7 @@ int main(int argc, char **argv)
> add_suite_9();
> add_suite_10();
> add_suite_11();
> + add_suite_12();
> test_list();
> exit(0);
> case 'e':
> @@ -535,6 +536,7 @@ int main(int argc, char **argv)
> add_suite_9();
> add_suite_10();
> add_suite_11();
> + add_suite_12();
> break;
> case 'v':
> if (silent_flg == true) {
> diff --git a/tests/logsv/logtest.h b/tests/logsv/logtest.h
> --- a/tests/logsv/logtest.h
> +++ b/tests/logsv/logtest.h
> @@ -98,6 +98,7 @@ void print_t(const char *format, ...) __
> void add_suite_9(void);
> void add_suite_10(void);
> void add_suite_11(void);
> +void add_suite_12(void);
>
> int get_active_sc(void);
> int get_attr_value(SaNameT *inObjName, char *inAttr, void *outValue);
> diff --git a/tests/logsv/tet_Log_recov.c b/tests/logsv/tet_Log_recov.c
> --- a/tests/logsv/tet_Log_recov.c
> +++ b/tests/logsv/tet_Log_recov.c
> @@ -1901,6 +1901,50 @@ done:
> rc = system(command);
> }
>
> +
> +//>
> +// For test suite #12
> +//<
> +/**
> + * Create 02 configurable app streams
> + */
> +void saLogRecov_createCfgAppStreams()
> +{
> + int rc;
> + char command[256];
> +
> + /* DN under RDN safApp=safLogservice */
> + sprintf(command, "immcfg -c SaLogStreamConfig
> safLgStrCfg=testCfgAppStream,safApp=safLogService "
> + "-a saLogStreamFileName=testCfgAppStream -a
> saLogStreamPathName=suite12");
> + rc = system(command);
> + rc_validate(WEXITSTATUS(rc), 0);
> +
> + /* DN not under safApp=safLogService */
> + sprintf(command, "immcfg -c SaLogStreamConfig
> safLgStrCfg=testCfgAppStream1 "
> + "-a saLogStreamFileName=testCfgAppStream1 -a
> saLogStreamPathName=suite12");
> + rc = system(command);
> + rc_validate(WEXITSTATUS(rc), 0);
> +}
> +
> +/**
> + * Create 02 configurable app streams
> + */
> +void saLogRecov_delCfgAppStreams()
> +{
> + int rc;
> + char command[256];
> +
> + /* DN under RDN safApp=safLogservice */
> + sprintf(command, "immcfg -d
> safLgStrCfg=testCfgAppStream,safApp=safLogService ");
> + rc = system(command);
> + rc_validate(WEXITSTATUS(rc), 0);
> +
> + /* DN not under safApp=safLogService */
> + sprintf(command, "immcfg -d safLgStrCfg=testCfgAppStream1");
> + rc = system(command);
> + rc_validate(WEXITSTATUS(rc), 0);
> +}
> +
> /**
> * Test suite 9
> * Testing recovery of "runtime" app streams
> @@ -1997,3 +2041,16 @@ void add_suite_11(void)
> test_case_add(11, saLogRecov_req_node_start, ""); /* Start SC nodes */
> test_case_add(11, saLogRecov_verRtStream_cleanup, "SC nodes started:
> after 10 mins, the stream is cleanup, OK");
> }
> +
> +/**
> + * Test suite 12
> + * Verify created configurable app streams can be deleted after headless.
> + */
> +void add_suite_12(void)
> +{
> + test_suite_add(12, "LOG Server down/up: verify app streams can be
> deleted after headless");
> + test_case_add(12, saLogRecov_createCfgAppStreams, "Create 02
> configurable app streams");
> + test_case_add(12, saLogRecov_req_node_stop, ""); /* Stop SC nodes */
> + test_case_add(12, saLogRecov_req_node_start, ""); /* Start SC nodes */
> + test_case_add(12, saLogRecov_delCfgAppStreams, "SC nodes started:
> delete created app streams");
> +}
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel