Re: [devel] [PATCH 1/1] log: Log enhance to rotate log file via admin operation [#3022]

2019-04-18 Thread Vu Minh Nguyen
Hi Canh,

Ack with minor comments.

Regards, Vu

> -Original Message-
> From: Canh Van Truong 
> Sent: Tuesday, April 16, 2019 3:27 PM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong
> 
> Subject: [PATCH 1/1] log: Log enhance to rotate log file via admin
operation
> [#3022]
[Vu] might change the slogan to 'log: rotate log file ...'?
> 
> In some cases the Users want to rotate log file at the time althouth
> the file size hasn't been reached MAX FILE SIZE. Log service provides the
> new feature that user can rotate log file via admin operation.
> ---
>  src/ais/include/saLog.h|   3 +-
>  src/log/apitest/tet_LogOiOps.c |  76 
>  src/log/logd/lgs_imm.cc| 258
---
> --
>  src/log/logd/lgs_mbcsv.cc  |  51 ++--
>  src/log/logd/lgs_stream.cc | 153 
>  src/log/logd/lgs_stream.h  |   3 +
>  6 files changed, 342 insertions(+), 202 deletions(-)
> 
> diff --git a/src/ais/include/saLog.h b/src/ais/include/saLog.h
> index 313c8d287..c28750600 100644
> --- a/src/ais/include/saLog.h
> +++ b/src/ais/include/saLog.h
> @@ -196,7 +196,8 @@ extern "C" {
> 
>  /* Admin operation IDs */
>   typedef enum {
> - SA_LOG_ADMIN_CHANGE_FILTER = 1
> + SA_LOG_ADMIN_CHANGE_FILTER = 1,
> + SA_LOG_ADMIN_ROTATE_FILE = 2
>   } saLogAdminOperationIdT;
> 
>  /*
> diff --git a/src/log/apitest/tet_LogOiOps.c
b/src/log/apitest/tet_LogOiOps.c
> index e74cd5331..ea96d86ce 100644
> --- a/src/log/apitest/tet_LogOiOps.c
> +++ b/src/log/apitest/tet_LogOiOps.c
> @@ -5479,6 +5479,78 @@ done:
>  _saLogStreamFixedLogRecordSize,
> SA_IMM_ATTR_SAUINT32T);
>  }
> 
> +//
> +// Test case for verifying the admin operation rotate log file for
> +// configuration application is ok
> +// Steps:
> +// 1. Create configuration app stream
> +// 2. Verify command admin operation rotate log file is ok
> +// 3. Delete configuration app stream
> +//
> +void admin_rotate_log_file(void)
> +{
> + int rc = 0;
> + char command[MAX_DATA];
> + const char *object_dn =
> +
>   "safLgStrCfg=admin_rotate_file,safApp=safLogService";
> +
> + // Create configuration application stream
> + sprintf(command, "immcfg -c SaLogStreamConfig %s "
> + "-a saLogStreamPathName=. "
> + "-a saLogStreamFileName=admin_rotate_file ",
> object_dn);
> + rc = systemCall(command);
> + osaf_nanosleep();
> + if (rc == 0) {
> + // Admin operation rotate log file
> + sprintf(command, "immadm -o 2 %s", object_dn);
> + rc = systemCall(command);
> + rc_validate(rc, 0);
> +
> + // Delete object
> + sprintf(command, "immcfg -d %s", object_dn);
> + systemCall(command);
> + } else {
> + rc_validate(rc, 0);
> + }
> +}
> +
> +//
> +// Test case for verifying the admin operation rotate log file for
> +// configuration application is ok
> +// Steps:
> +// 1. Create configuration app stream
> +// 2. Verify command admin operation rotate log file with param fails
> +// 3. Delete configuration app stream
> +//
> +void admin_rotate_log_file_with_param(void)
> +{
> + int rc = 0;
> + char command[MAX_DATA];
> + const char *object_dn =
> +
>   "safLgStrCfg=admin_rotate_file1,safApp=safLogService";
> +
> + // Create configuration application stream
> + sprintf(command, "immcfg -c SaLogStreamConfig %s"
> + " -a saLogStreamPathName=. "
> + "-a saLogStreamFileName=admin_rotate_file1 ",
> + object_dn);
> + rc = systemCall(command);
> + if (rc == 0) {
> + // Admin operation opId = 2 with parameter
> + sprintf(command, "immadm -o 2 -p "
> + "saLogStreamSeverityFilter:SA_UINT32_T:7 %s
> >"
> + " /dev/null 2>&1 ", object_dn);
> + rc = system(command);
> + rc_validate(WEXITSTATUS(rc), 1);
> +
> + // Delete object
> + sprintf(command, "immcfg -d %s", object_dn);
> + systemCall(command);
> + } else {
> + rc_validate(rc, 0);
> + }
> +}
> +
>  __attribute__((constructor)) static void saOiOperations_constructor(void)
>  {
>   /* Stream objects */
> @@ -5835,4 +5907,8 @@ __attribute__((constructor)) static void
> saOiOperations_constructor(void)
>   test_case_add(
>   6, verLogFileRotate,
>   "Verify that log file is not rotated if file size doesn't reach
max file
> size (ticket1439)");
> + test_case_add(6, admin_rotate_log_file,
> +   "Verify admin operation rotate log file is ok");
> + test_case_add(6, admin_rotate_log_file_with_param,
> +   "Verify admin operation rotate log file with parameter
> fails");
>  }
> 

Re: [devel] [PATCH 1/1] imm: fix coredump on immnd during upgrade [#3030]

2019-04-18 Thread Lennart Lund
Hi Vu,

Ack.

I don't know exactly what this code is doing but I can see that the 
"fs_attr_iter != immObject->mAttrValueMap.end()" is  done only when the 
operationId is 400 or 401 instead of always. The fs_attr_iter variable is only 
used with operationId 400 and 401 so this seems correct.
I cannot see why the OPENSAF_IMM_FLAG_PRT51906_ALLOW is changed. Is this 
related to this problem?
Please give information about this change in the commit message (and maybe as a 
comment in the ticket).
Not tested.

Thanks
Lennart


Från: Vu Minh Nguyen 
Skickat: den 17 april 2019 11:29
Till: Hans Nordebäck; Lennart Lund; Gary Lee
Kopia: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
Ämne: [PATCH 1/1] imm: fix coredump on immnd during upgrade [#3030]

The assertion about the existence of the new added attribute
`saImmFileSystemStatus` should be done if the admOp ID is
either 400 or 401.
---
 src/imm/common/immsv_api.h   | 2 +-
 src/imm/config/immsv_classes.xml | 1 -
 src/imm/immnd/ImmModel.cc| 7 ---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/imm/common/immsv_api.h b/src/imm/common/immsv_api.h
index 3ab3892d1..c37a624ed 100644
--- a/src/imm/common/immsv_api.h
+++ b/src/imm/common/immsv_api.h
@@ -151,7 +151,7 @@ typedef enum {
 #define OPENSAF_IMM_FLAG_PRT50_ALLOW 0x0080
 #define OPENSAF_IMM_FLAG_PRT51_ALLOW 0x0100
 #define OPENSAF_IMM_FLAG_PRT51710_ALLOW 0x0200
-#define OPENSAF_IMM_FLAG_PRT51906_ALLOW 0x0800
+#define OPENSAF_IMM_FLAG_PRT51906_ALLOW 0x0400

 #define OPENSAF_IMM_SERVICE_NAME "safImmService"

diff --git a/src/imm/config/immsv_classes.xml b/src/imm/config/immsv_classes.xml
index c6f448e82..193ccd2e2 100644
--- a/src/imm/config/immsv_classes.xml
+++ b/src/imm/config/immsv_classes.xml
@@ -50,7 +50,6 @@
 saImmFileSystemStatus
 SA_UINT32_T
 SA_RUNTIME
-   SA_RUNTIME
 SA_CACHED
 
 
diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc
index 2cf2649cf..1435690c0 100644
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -13873,9 +13873,6 @@ SaAisErrorT ImmModel::admoImmMngtObject(const 
ImmsvOmAdminOperationInvoke* req,
   valuep = (ImmAttrValue*)avi->second;

   auto fs_attr_iter = immObject->mAttrValueMap.find(saImmFileSystemStatus);
-  osafassert(fs_attr_iter != immObject->mAttrValueMap.end());
-  auto fs_attr_value = fs_attr_iter->second;
-

   if (req->operationId == SA_IMM_ADMIN_EXPORT) { /* Standard */
 err = SA_AIS_ERR_NOT_SUPPORTED;
@@ -13900,11 +13897,15 @@ SaAisErrorT ImmModel::admoImmMngtObject(const 
ImmsvOmAdminOperationInvoke* req,
   } else if (req->operationId == SA_IMM_ADMIN_FS_AVAILABLE) {
 LOG_NO("Received: immadm -o %u safRdn=immManagement,safApp=safImmService",
SA_IMM_ADMIN_FS_AVAILABLE);
+osafassert(fs_attr_iter != immObject->mAttrValueMap.end());
+auto fs_attr_value = fs_attr_iter->second;
 sFileSystemAvailable = true;
 fs_attr_value->setValue_int(1);
   } else if (req->operationId == SA_IMM_ADMIN_FS_UNAVAILABLE) {
 LOG_NO("Received: immadm -o %u safRdn=immManagement,safApp=safImmService",
SA_IMM_ADMIN_FS_UNAVAILABLE);
+osafassert(fs_attr_iter != immObject->mAttrValueMap.end());
+auto fs_attr_value = fs_attr_iter->second;
 sFileSystemAvailable = false;
 fs_attr_value->setValue_int(0);
   } else {
--
2.19.2


___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0/1] Review Request for amf: fix container sample build failure [#3032]

2019-04-18 Thread thuan.tran
Summary: amf: fix container sample build failure [#3032]
Review request for Ticket(s): 3032
Peer Reviewer(s): Alex, Minh, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3032
Base revision: 8e0d4160a6b269463b72a8af088cfb1d4d93fb9b
Personal repository: git://git.code.sf.net/u/thuantr/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesn
 OpenSAF servicesn
 Core libraries  n
 Samples y
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision e6cf94a9b03ab4542bb84a0172806f4f2fb86530
Author: thuan.tran 
Date:   Thu, 18 Apr 2019 13:41:46 +0700

amf: fix container sample build failure [#3032]



Complete diffstat:
--
 samples/amf/container/Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


Testing Commands:
-
N/A

Testing, Expected Results:
--
N/A

Conditions of Submission:
-
N/A

Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  y  y
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.



___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1/1] amf: fix container sample build failure [#3032]

2019-04-18 Thread thuan.tran
---
 samples/amf/container/Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/samples/amf/container/Makefile.am 
b/samples/amf/container/Makefile.am
index 299a947..dc09721 100644
--- a/samples/amf/container/Makefile.am
+++ b/samples/amf/container/Makefile.am
@@ -19,7 +19,7 @@ include $(top_srcdir)/Makefile.common
 MAINTAINERCLEANFILES = Makefile.in
 
 EXTRA_DIST = \
-   amf_container_demo_script \
+   amf_container_script \
AppConfig-container.xml \
AppConfig-contained-2N.xml \
README
@@ -31,7 +31,7 @@ amf_container_demo_CPPFLAGS = \
$(AM_CPPFLAGS)
 
 amf_container_demo_SOURCES = \
-   amf_container_demo.c
+   amf_container.c
 
 amf_container_demo_LDADD = \
@SAF_AIS_AMF_LIBS@
-- 
2.7.4



___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel