[devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-07-22 Thread Vu Minh Nguyen
 osaf/services/saf/ntfsv/ntfs/NtfLogger.cc |  51 +++---
 1 files changed, 13 insertions(+), 38 deletions(-)


Remove the part of code that truncates the long DN.

diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc 
b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
--- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
+++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
@@ -21,6 +21,7 @@
  */
 #include 
 
+#include "osaf_utility.h"
 #include "saAis.h"
 #include "saLog.h"
 #include "NtfAdmin.hh"
@@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
notif->getNotificationId(),
SA_LOG_RECORD_WRITE_ACK,
&logRecord);
-if (SA_AIS_OK != errorCode) {
-  LOG_NO("Failed to log an alarm or security alarm notification (%d)", 
errorCode);
-  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode == 
SA_AIS_ERR_BAD_HANDLE) {
-LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or SA_AIS_ERR_BAD_HANDLE; 
exiting (%d)...", errorCode);
-exit(EXIT_FAILURE);
-  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
-/* Retry to log truncated notificationObject/notifyingObject because
- * LOG Service has not supported long dn in Opensaf 4.5
- */
-char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
-memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
-SaNameT shortdn_notificationObject, shortdn_notifyingObject;
-if (osaf_is_an_extended_name(ntfHeader->notificationObject)) {
-  strncpy(short_dn, 
osaf_extended_name_borrow(ntfHeader->notificationObject)
-  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
-  osaf_extended_name_lend(short_dn, &shortdn_notificationObject);
-  logRecord.logHeader.ntfHdr.notificationObject = 
&shortdn_notificationObject;
-}
-if (osaf_is_an_extended_name(ntfHeader->notifyingObject)) {
-  strncpy(short_dn, 
osaf_extended_name_borrow(ntfHeader->notifyingObject)
-  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
-  osaf_extended_name_lend(short_dn, &shortdn_notifyingObject);
-  logRecord.logHeader.ntfHdr.notifyingObject = 
&shortdn_notifyingObject;
-}
-if (short_dn[0] != '\0') {
-  LOG_NO("Retry to log the truncated 
notificationObject/notifyingObject");
-  if ((errorCode = saLogWriteLogAsync(alarmStreamHandle,
-  notif->getNotificationId(),
-  SA_LOG_RECORD_WRITE_ACK,
-  &logRecord)) != SA_AIS_OK) {
-LOG_ER("Failed to log the truncated 
notificationObject/notifyingObject (%d)"
-   , errorCode);
-  }
-}
-  }
-  goto end;
+switch (errorCode) {
+case SA_AIS_OK:
+   break;
+
+/* LOGsv is busy. Put the notification to queue and re-send next time */
+case SA_AIS_ERR_TRY_AGAIN:
+case SA_AIS_ERR_TIMEOUT:
+   TRACE("Failed to log notification (ret: %d). Try next time.", 
errorCode);
+   break;
+
+default:
+   osaf_abort(errorCode);
 }
   }
 
-end:
   TRACE_LEAVE();
-
   return errorCode;
 }
 

--
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-11 Thread Vu Minh Nguyen
 osaf/services/saf/ntfsv/ntfs/NtfLogger.cc   |   51 +-
 tests/ntfsv/tet_longDnObject_notification.c |  188 +++-
 2 files changed, 196 insertions(+), 43 deletions(-)


Remove the part of code that truncates the long DN.
And update the long DN test suite (#36) to make sure full record logged.

diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc 
b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
--- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
+++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
@@ -21,6 +21,7 @@
  */
 #include 
 
+#include "osaf_utility.h"
 #include "saAis.h"
 #include "saLog.h"
 #include "NtfAdmin.hh"
@@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
notif->getNotificationId(),
SA_LOG_RECORD_WRITE_ACK,
&logRecord);
-if (SA_AIS_OK != errorCode) {
-  LOG_NO("Failed to log an alarm or security alarm notification (%d)", 
errorCode);
-  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode == 
SA_AIS_ERR_BAD_HANDLE) {
-LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or SA_AIS_ERR_BAD_HANDLE; 
exiting (%d)...", errorCode);
-exit(EXIT_FAILURE);
-  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
-/* Retry to log truncated notificationObject/notifyingObject because
- * LOG Service has not supported long dn in Opensaf 4.5
- */
-char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
-memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
-SaNameT shortdn_notificationObject, shortdn_notifyingObject;
-if (osaf_is_an_extended_name(ntfHeader->notificationObject)) {
-  strncpy(short_dn, 
osaf_extended_name_borrow(ntfHeader->notificationObject)
-  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
-  osaf_extended_name_lend(short_dn, &shortdn_notificationObject);
-  logRecord.logHeader.ntfHdr.notificationObject = 
&shortdn_notificationObject;
-}
-if (osaf_is_an_extended_name(ntfHeader->notifyingObject)) {
-  strncpy(short_dn, 
osaf_extended_name_borrow(ntfHeader->notifyingObject)
-  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
-  osaf_extended_name_lend(short_dn, &shortdn_notifyingObject);
-  logRecord.logHeader.ntfHdr.notifyingObject = 
&shortdn_notifyingObject;
-}
-if (short_dn[0] != '\0') {
-  LOG_NO("Retry to log the truncated 
notificationObject/notifyingObject");
-  if ((errorCode = saLogWriteLogAsync(alarmStreamHandle,
-  notif->getNotificationId(),
-  SA_LOG_RECORD_WRITE_ACK,
-  &logRecord)) != SA_AIS_OK) {
-LOG_ER("Failed to log the truncated 
notificationObject/notifyingObject (%d)"
-   , errorCode);
-  }
-}
-  }
-  goto end;
+switch (errorCode) {
+case SA_AIS_OK:
+   break;
+
+/* LOGsv is busy. Put the notification to queue and re-send next time */
+case SA_AIS_ERR_TRY_AGAIN:
+case SA_AIS_ERR_TIMEOUT:
+   TRACE("Failed to log notification (ret: %d). Try next time.", 
errorCode);
+   break;
+
+default:
+   osaf_abort(errorCode);
 }
   }
 
-end:
   TRACE_LEAVE();
-
   return errorCode;
 }
 
diff --git a/tests/ntfsv/tet_longDnObject_notification.c 
b/tests/ntfsv/tet_longDnObject_notification.c
--- a/tests/ntfsv/tet_longDnObject_notification.c
+++ b/tests/ntfsv/tet_longDnObject_notification.c
@@ -19,6 +19,7 @@
  */
 #include 
 #include 
+#include 
 #include "tet_ntf.h"
 #include "tet_ntf_common.h"
 //#include "util.h"
@@ -57,6 +58,166 @@ static SaNtfSecurityAlarmNotificationT m
 extern void saAisNameLend(SaConstStringT value, SaNameT* name);
 extern SaConstStringT saAisNameBorrow(const SaNameT* name);
 
+//>
+// For backup and restore IMM attribute values.
+//<
+
+#define MAX_DATA 256
+typedef struct {
+   char name[MAX_DATA];
+   char val[MAX_DATA];
+   int val_is_num;
+} attrinfo_t;
+
+typedef struct {
+   attrinfo_t *attr;
+   size_t size;
+} attrlist_t;
+
+typedef struct {
+   attrlist_t *alist;
+   char dn[MAX_DATA];
+} imminfo_t;
+
+static void getVal(imminfo_t *info)
+{
+   FILE *fp = NULL;
+   attrinfo_t *tmp = NULL;
+   char attrValue[MAX_DATA] = {0};
+   char command[MAX_DATA] = {0};
+   size_t s = info->alist->size;
+
+   tmp = info->alist->attr;
+   while (s) {
+   sprintf(command, "immlist -a %s %s "
+   "| awk -F \"=\" '{print $2}' ", tmp->name,
+   info->dn);
+   fp = popen(command, "r");
+   while (fgets(attrValue, sizeof(attrValue) - 1, fp) != NULL) {};
+   pclose(fp);
+   strtok(attrValue, "\n");
+   strncpy(tmp->val, attrValue, MAX_DATA);
+   s--;
+

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-07-24 Thread minh chau
Hi Vu,

The patch looks good. Can I test this patch after #1315 is pushed? I run 
into osaf_abort() for now.

Thanks,
Minh

On 22/07/16 21:16, Vu Minh Nguyen wrote:
>   osaf/services/saf/ntfsv/ntfs/NtfLogger.cc |  51 
> +++---
>   1 files changed, 13 insertions(+), 38 deletions(-)
>
>
> Remove the part of code that truncates the long DN.
>
> diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc 
> b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> @@ -21,6 +21,7 @@
>*/
>   #include 
>   
> +#include "osaf_utility.h"
>   #include "saAis.h"
>   #include "saLog.h"
>   #include "NtfAdmin.hh"
> @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
>  notif->getNotificationId(),
>  SA_LOG_RECORD_WRITE_ACK,
>  &logRecord);
> -if (SA_AIS_OK != errorCode) {
> -  LOG_NO("Failed to log an alarm or security alarm notification (%d)", 
> errorCode);
> -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode == 
> SA_AIS_ERR_BAD_HANDLE) {
> -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or SA_AIS_ERR_BAD_HANDLE; 
> exiting (%d)...", errorCode);
> -exit(EXIT_FAILURE);
> -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
> -/* Retry to log truncated notificationObject/notifyingObject because
> - * LOG Service has not supported long dn in Opensaf 4.5
> - */
> -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
> -memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
> -SaNameT shortdn_notificationObject, shortdn_notifyingObject;
> -if (osaf_is_an_extended_name(ntfHeader->notificationObject)) {
> -  strncpy(short_dn, 
> osaf_extended_name_borrow(ntfHeader->notificationObject)
> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> -  osaf_extended_name_lend(short_dn, &shortdn_notificationObject);
> -  logRecord.logHeader.ntfHdr.notificationObject = 
> &shortdn_notificationObject;
> -}
> -if (osaf_is_an_extended_name(ntfHeader->notifyingObject)) {
> -  strncpy(short_dn, 
> osaf_extended_name_borrow(ntfHeader->notifyingObject)
> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> -  osaf_extended_name_lend(short_dn, &shortdn_notifyingObject);
> -  logRecord.logHeader.ntfHdr.notifyingObject = 
> &shortdn_notifyingObject;
> -}
> -if (short_dn[0] != '\0') {
> -  LOG_NO("Retry to log the truncated 
> notificationObject/notifyingObject");
> -  if ((errorCode = saLogWriteLogAsync(alarmStreamHandle,
> -  notif->getNotificationId(),
> -  SA_LOG_RECORD_WRITE_ACK,
> -  &logRecord)) != SA_AIS_OK) {
> -LOG_ER("Failed to log the truncated 
> notificationObject/notifyingObject (%d)"
> -   , errorCode);
> -  }
> -}
> -  }
> -  goto end;
> +switch (errorCode) {
> +case SA_AIS_OK:
> + break;
> +
> +/* LOGsv is busy. Put the notification to queue and re-send next time */
> +case SA_AIS_ERR_TRY_AGAIN:
> +case SA_AIS_ERR_TIMEOUT:
> + TRACE("Failed to log notification (ret: %d). Try next time.", 
> errorCode);
> + break;
> +
> +default:
> + osaf_abort(errorCode);
>   }
> }
>   
> -end:
> TRACE_LEAVE();
> -
> return errorCode;
>   }
>   
>


--
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-04 Thread Vu Minh Nguyen
Hi,

F.Y.I: #1315 was pushed. You now can test this patch. 

Regards, Vu

> -Original Message-
> From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> Sent: Monday, July 25, 2016 9:59 AM
> To: 'minh chau' ; 'praveen malviya'
> ; 'Lennart Lund'
> 
> Cc: 'opensaf-devel@lists.sourceforge.net'  de...@lists.sourceforge.net>
> Subject: RE: [PATCH 1 of 1] ntfsv: refactor logging long dn notification
> [#1585]
> 
> Hi Minh,
> 
> Yes.
> 
> By the way, I would attach patches of #1315 which was acked/tested by
> Mahesh just in case you want to test #1585 now.
> 
> Regards, Vu
> 
> > -Original Message-
> > From: minh chau [mailto:minh.c...@dektech.com.au]
> > Sent: Monday, July 25, 2016 8:24 AM
> > To: Vu Minh Nguyen ; praveen malviya
> > ; Lennart Lund
> > 
> > Cc: opensaf-devel@lists.sourceforge.net
> > Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn notification
> > [#1585]
> >
> > Hi Vu,
> >
> > The patch looks good. Can I test this patch after #1315 is pushed? I run
> > into osaf_abort() for now.
> >
> > Thanks,
> > Minh
> >
> > On 22/07/16 21:16, Vu Minh Nguyen wrote:
> > >   osaf/services/saf/ntfsv/ntfs/NtfLogger.cc |  51
+++---
> --
> > --
> > >   1 files changed, 13 insertions(+), 38 deletions(-)
> > >
> > >
> > > Remove the part of code that truncates the long DN.
> > >
> > > diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > @@ -21,6 +21,7 @@
> > >*/
> > >   #include 
> > >
> > > +#include "osaf_utility.h"
> > >   #include "saAis.h"
> > >   #include "saLog.h"
> > >   #include "NtfAdmin.hh"
> > > @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
> > >  notif->getNotificationId(),
> > >  SA_LOG_RECORD_WRITE_ACK,
> > >  &logRecord);
> > > -if (SA_AIS_OK != errorCode) {
> > > -  LOG_NO("Failed to log an alarm or security alarm notification
(%d)",
> > errorCode);
> > > -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode ==
> > SA_AIS_ERR_BAD_HANDLE) {
> > > -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or
> > SA_AIS_ERR_BAD_HANDLE; exiting (%d)...", errorCode);
> > > -exit(EXIT_FAILURE);
> > > -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
> > > -/* Retry to log truncated notificationObject/notifyingObject
> because
> > > - * LOG Service has not supported long dn in Opensaf 4.5
> > > - */
> > > -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
> > > -memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
> > > -SaNameT shortdn_notificationObject, shortdn_notifyingObject;
> > > -if (osaf_is_an_extended_name(ntfHeader->notificationObject))
{
> > > -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
> > >notificationObject)
> > > -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> > > -  osaf_extended_name_lend(short_dn,
> &shortdn_notificationObject);
> > > -  logRecord.logHeader.ntfHdr.notificationObject =
> > &shortdn_notificationObject;
> > > -}
> > > -if (osaf_is_an_extended_name(ntfHeader->notifyingObject)) {
> > > -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
> > >notifyingObject)
> > > -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> > > -  osaf_extended_name_lend(short_dn,
&shortdn_notifyingObject);
> > > -  logRecord.logHeader.ntfHdr.notifyingObject =
> > &shortdn_notifyingObject;
> > > -}
> > > -if (short_dn[0] != '\0') {
> > > -  LOG_NO("Retry to log the truncated
> > notificationObject/notifyingObject");
> > > -  if ((errorCode = saLogWriteLogAsync(alarmStreamHandle,
> > > -
notif->getNotificationId(),
> > > -
SA_LOG_RECORD_WRITE_ACK,
> > > -  &logRecord)) !=
SA_AIS_OK) {
> > > -LOG_ER("Failed to log the truncated
> > notificationObject/notifyingObject (%d)"
> > > -   , errorCode);
> > > -  }
> > > -}
> > > -  }
> > > -  goto end;
> > > +switch (errorCode) {
> > > +case SA_AIS_OK:
> > > + break;
> > > +
> > > +/* LOGsv is busy. Put the notification to queue and re-send next
time
> */
> > > +case SA_AIS_ERR_TRY_AGAIN:
> > > +case SA_AIS_ERR_TIMEOUT:
> > > + TRACE("Failed to log notification (ret: %d). Try next time.",
> > errorCode);
> > > + break;
> > > +
> > > +default:
> > > + osaf_abort(errorCode);
> > >   }
> > > }
> > >
> > > -end:
> > > TRACE_LEAVE();
> > > -
> > > return errorCode;
> > >   }
> > >
> > >



--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
http

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-04 Thread praveen malviya
Hi Vu,

TWith this patch Ntf will not perform any truncation on long dn while 
saflogging alrams.Is it with the log service (after supporting long dn) 
also or log service is performing any truncation before logging?


Thanks,
Praveen

On 22-Jul-16 4:46 PM, Vu Minh Nguyen wrote:
>  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc |  51 
> +++---
>  1 files changed, 13 insertions(+), 38 deletions(-)
>
>
> Remove the part of code that truncates the long DN.
>
> diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc 
> b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> @@ -21,6 +21,7 @@
>   */
>  #include 
>
> +#include "osaf_utility.h"
>  #include "saAis.h"
>  #include "saLog.h"
>  #include "NtfAdmin.hh"
> @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
> notif->getNotificationId(),
> SA_LOG_RECORD_WRITE_ACK,
> &logRecord);
> -if (SA_AIS_OK != errorCode) {
> -  LOG_NO("Failed to log an alarm or security alarm notification (%d)", 
> errorCode);
> -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode == 
> SA_AIS_ERR_BAD_HANDLE) {
> -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or SA_AIS_ERR_BAD_HANDLE; 
> exiting (%d)...", errorCode);
> -exit(EXIT_FAILURE);
> -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
> -/* Retry to log truncated notificationObject/notifyingObject because
> - * LOG Service has not supported long dn in Opensaf 4.5
> - */
> -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
> -memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
> -SaNameT shortdn_notificationObject, shortdn_notifyingObject;
> -if (osaf_is_an_extended_name(ntfHeader->notificationObject)) {
> -  strncpy(short_dn, 
> osaf_extended_name_borrow(ntfHeader->notificationObject)
> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> -  osaf_extended_name_lend(short_dn, &shortdn_notificationObject);
> -  logRecord.logHeader.ntfHdr.notificationObject = 
> &shortdn_notificationObject;
> -}
> -if (osaf_is_an_extended_name(ntfHeader->notifyingObject)) {
> -  strncpy(short_dn, 
> osaf_extended_name_borrow(ntfHeader->notifyingObject)
> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> -  osaf_extended_name_lend(short_dn, &shortdn_notifyingObject);
> -  logRecord.logHeader.ntfHdr.notifyingObject = 
> &shortdn_notifyingObject;
> -}
> -if (short_dn[0] != '\0') {
> -  LOG_NO("Retry to log the truncated 
> notificationObject/notifyingObject");
> -  if ((errorCode = saLogWriteLogAsync(alarmStreamHandle,
> -  notif->getNotificationId(),
> -  SA_LOG_RECORD_WRITE_ACK,
> -  &logRecord)) != SA_AIS_OK) {
> -LOG_ER("Failed to log the truncated 
> notificationObject/notifyingObject (%d)"
> -   , errorCode);
> -  }
> -}
> -  }
> -  goto end;
> +switch (errorCode) {
> +case SA_AIS_OK:
> + break;
> +
> +/* LOGsv is busy. Put the notification to queue and re-send next time */
> +case SA_AIS_ERR_TRY_AGAIN:
> +case SA_AIS_ERR_TIMEOUT:
> + TRACE("Failed to log notification (ret: %d). Try next time.", 
> errorCode);
> + break;
> +
> +default:
> + osaf_abort(errorCode);
>  }
>}
>
> -end:
>TRACE_LEAVE();
> -
>return errorCode;
>  }
>
>

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


Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-04 Thread Vu Minh Nguyen
Hi Praveen,

Truncation is removed as LOG supports Long DN now. Means, NTF would not get
INVALID_PARAM if logging longdn-contained notifications.

Regards, Vu

> -Original Message-
> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> Sent: Thursday, August 4, 2016 8:24 PM
> To: Vu Minh Nguyen ; minh chau
> ; Lennart Lund 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn notification
> [#1585]
> 
> Hi Vu,
> 
> TWith this patch Ntf will not perform any truncation on long dn while
> saflogging alrams.Is it with the log service (after supporting long dn)
> also or log service is performing any truncation before logging?
> 
> 
> Thanks,
> Praveen
> 
> On 22-Jul-16 4:46 PM, Vu Minh Nguyen wrote:
> >  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc |  51
+++--
> -
> >  1 files changed, 13 insertions(+), 38 deletions(-)
> >
> >
> > Remove the part of code that truncates the long DN.
> >
> > diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > @@ -21,6 +21,7 @@
> >   */
> >  #include 
> >
> > +#include "osaf_utility.h"
> >  #include "saAis.h"
> >  #include "saLog.h"
> >  #include "NtfAdmin.hh"
> > @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
> > notif->getNotificationId(),
> > SA_LOG_RECORD_WRITE_ACK,
> > &logRecord);
> > -if (SA_AIS_OK != errorCode) {
> > -  LOG_NO("Failed to log an alarm or security alarm notification
(%d)",
> errorCode);
> > -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode ==
> SA_AIS_ERR_BAD_HANDLE) {
> > -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or
> SA_AIS_ERR_BAD_HANDLE; exiting (%d)...", errorCode);
> > -exit(EXIT_FAILURE);
> > -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
> > -/* Retry to log truncated notificationObject/notifyingObject
because
> > - * LOG Service has not supported long dn in Opensaf 4.5
> > - */
> > -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
> > -memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
> > -SaNameT shortdn_notificationObject, shortdn_notifyingObject;
> > -if (osaf_is_an_extended_name(ntfHeader->notificationObject)) {
> > -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
> >notificationObject)
> > -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> > -  osaf_extended_name_lend(short_dn,
&shortdn_notificationObject);
> > -  logRecord.logHeader.ntfHdr.notificationObject =
> &shortdn_notificationObject;
> > -}
> > -if (osaf_is_an_extended_name(ntfHeader->notifyingObject)) {
> > -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
> >notifyingObject)
> > -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> > -  osaf_extended_name_lend(short_dn, &shortdn_notifyingObject);
> > -  logRecord.logHeader.ntfHdr.notifyingObject =
> &shortdn_notifyingObject;
> > -}
> > -if (short_dn[0] != '\0') {
> > -  LOG_NO("Retry to log the truncated
> notificationObject/notifyingObject");
> > -  if ((errorCode = saLogWriteLogAsync(alarmStreamHandle,
> > -
notif->getNotificationId(),
> > -  SA_LOG_RECORD_WRITE_ACK,
> > -  &logRecord)) !=
SA_AIS_OK) {
> > -LOG_ER("Failed to log the truncated
> notificationObject/notifyingObject (%d)"
> > -   , errorCode);
> > -  }
> > -}
> > -  }
> > -  goto end;
> > +switch (errorCode) {
> > +case SA_AIS_OK:
> > +   break;
> > +
> > +/* LOGsv is busy. Put the notification to queue and re-send next
time */
> > +case SA_AIS_ERR_TRY_AGAIN:
> > +case SA_AIS_ERR_TIMEOUT:
> > +   TRACE("Failed to log notification (ret: %d). Try next time.",
> errorCode);
> > +   break;
> > +
> > +default:
> > +   osaf_abort(errorCode);
> >  }
> >}
> >
> > -end:
> >TRACE_LEAVE();
> > -
> >return errorCode;
> >  }
> >
> >


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


Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-09 Thread praveen malviya
Hi Vu,

This patch is doing that. My question was any truncation being done from 
log service after taking a long Dn notificaion from NTF.

For example: When executed first ntf long dn test: ntftest 36 1

LOG service logs these notification in saLogAlarm_20160809_165614.log as:
  10 0x146920b67187c6f0 0x146920b67187c6f0 0x4001 
AA BB "this is 
additional text info"
  11 0x146920b67187c6f0 0x146920b67187c6f0 0x4001 AMF BLABLA Component 
 AMF BLABLA Entity  "this is additional text info"

In the first notification above, notification and notifying objects are 
truncated. Do we need to increase the size of log service record?

Thanks,
Praveen

On 05-Aug-16 8:40 AM, Vu Minh Nguyen wrote:
> Hi Praveen,
>
> Truncation is removed as LOG supports Long DN now. Means, NTF would not get
> INVALID_PARAM if logging longdn-contained notifications.
>
> Regards, Vu
>
>> -Original Message-
>> From: praveen malviya [mailto:praveen.malv...@oracle.com]
>> Sent: Thursday, August 4, 2016 8:24 PM
>> To: Vu Minh Nguyen ; minh chau
>> ; Lennart Lund 
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn notification
>> [#1585]
>>
>> Hi Vu,
>>
>> TWith this patch Ntf will not perform any truncation on long dn while
>> saflogging alrams.Is it with the log service (after supporting long dn)
>> also or log service is performing any truncation before logging?
>>
>>
>> Thanks,
>> Praveen
>>
>> On 22-Jul-16 4:46 PM, Vu Minh Nguyen wrote:
>>>  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc |  51
> +++--
>> -
>>>  1 files changed, 13 insertions(+), 38 deletions(-)
>>>
>>>
>>> Remove the part of code that truncates the long DN.
>>>
>>> diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
>> b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
>>> --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
>>> +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
>>> @@ -21,6 +21,7 @@
>>>   */
>>>  #include 
>>>
>>> +#include "osaf_utility.h"
>>>  #include "saAis.h"
>>>  #include "saLog.h"
>>>  #include "NtfAdmin.hh"
>>> @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
>>> notif->getNotificationId(),
>>> SA_LOG_RECORD_WRITE_ACK,
>>> &logRecord);
>>> -if (SA_AIS_OK != errorCode) {
>>> -  LOG_NO("Failed to log an alarm or security alarm notification
> (%d)",
>> errorCode);
>>> -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode ==
>> SA_AIS_ERR_BAD_HANDLE) {
>>> -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or
>> SA_AIS_ERR_BAD_HANDLE; exiting (%d)...", errorCode);
>>> -exit(EXIT_FAILURE);
>>> -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
>>> -/* Retry to log truncated notificationObject/notifyingObject
> because
>>> - * LOG Service has not supported long dn in Opensaf 4.5
>>> - */
>>> -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
>>> -memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
>>> -SaNameT shortdn_notificationObject, shortdn_notifyingObject;
>>> -if (osaf_is_an_extended_name(ntfHeader->notificationObject)) {
>>> -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
>>> notificationObject)
>>> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
>>> -  osaf_extended_name_lend(short_dn,
> &shortdn_notificationObject);
>>> -  logRecord.logHeader.ntfHdr.notificationObject =
>> &shortdn_notificationObject;
>>> -}
>>> -if (osaf_is_an_extended_name(ntfHeader->notifyingObject)) {
>>> -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
>>> notifyingObject)
>>> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
>>> -  osaf_extended_name_lend(short_dn, &shortdn_notifyingObject);
>>> -  logRecord.logHeader.ntfHdr.notifyingObject =
>> &shortdn_notifyingObject;
>>> -}
>>> -if (short_dn[0] != '\0') {
>>> -  LOG_NO("Retry to log the truncated
>> notificationObject/notifyingObject");
>>> -  if ((errorCode = saLogWriteLogAsync(alarmStreamHandle,
>>> -
> notif->getNotificationId(),
>>> -  SA_LOG_RECORD_WRITE_ACK,
>>> -  &logRecord)) !=
> SA_AIS_OK) {
>>> -LOG_ER("Failed to log the truncated
>> notificationObject/notifyingObject (%d)"
>>> -   , errorCode);
>>> -  }
>>> -}
>>> -  }
>>> -  goto end;
>>> +switch (errorCode) {
>>> +case SA_AIS_OK:
>>> +   break;
>>> +
>>> +/* LOGsv is busy. Put the notification to queue and re-send next
> time */
>>> +case SA_AIS_ERR_TRY_AGAIN:
>>> +case SA_AIS_ERR_TIMEOUT:
>>> +   TRACE("Failed to log notification (ret: %d). Try next time.",
>> errorCode);
>>> +   break;
>>> +
>>> +default:
>>> +  

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-09 Thread Vu Minh Nguyen
Hi Praveen,

The notification and notifying objects are truncated because we did not 
change default attribute values before running test. 

Following changes should be done before running test:
1) The field size of @No and @Ng tokens in `saLogStreamLogFileFormat`
In default, the field-size value is 30. Means, the notification and
notifying objects are limited to 30 characters.
For long DN test, we should remove  the . E.g: change default
"@No30" to "@No".

2) The fixed log record size - `saLogStreamFixedLogRecordSize`
In default, its value is 200. A whole log record is limited to this number
of characters.
We should change it to 0, means variable log record size. 

3) Max log record size - `logMaxLogrecsize` in class ` OpenSafLogConfig`
In default, max log record size is limited to 1024 characters. 
We should change it to a bigger number. Max value is 65535.

Example:
# immcfg -a saLogStreamFixedLogRecordSize=0 -a saLogStreamLogFileFormat="@Cr
@Ct @Nt @Ne6 @No @Ng \"@Cb\"" safLgStrCfg=saLogAlarm,safApp=safLogService
# immcfg -a logMaxLogrecsize=65535 logConfig=1,safApp=safLogService

We can consider to put these information into the ~/tests/ntfsv/README file.

Regards, Vu

> -Original Message-
> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> Sent: Tuesday, August 9, 2016 6:46 PM
> To: Vu Minh Nguyen ; 'minh chau'
> ; 'Lennart Lund' 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn notification
> [#1585]
> 
> Hi Vu,
> 
> This patch is doing that. My question was any truncation being done from
> log service after taking a long Dn notificaion from NTF.
> 
> For example: When executed first ntf long dn test: ntftest 36 1
> 
> LOG service logs these notification in saLogAlarm_20160809_165614.log as:
>   10 0x146920b67187c6f0 0x146920b67187c6f0 0x4001
> AA
> BB "this is
> additional text info"
>   11 0x146920b67187c6f0 0x146920b67187c6f0 0x4001 AMF BLABLA
> Component
>  AMF BLABLA Entity  "this is additional text info"
> 
> In the first notification above, notification and notifying objects are
> truncated. Do we need to increase the size of log service record?
> 
> Thanks,
> Praveen
> 
> On 05-Aug-16 8:40 AM, Vu Minh Nguyen wrote:
> > Hi Praveen,
> >
> > Truncation is removed as LOG supports Long DN now. Means, NTF would
> not get
> > INVALID_PARAM if logging longdn-contained notifications.
> >
> > Regards, Vu
> >
> >> -Original Message-
> >> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> >> Sent: Thursday, August 4, 2016 8:24 PM
> >> To: Vu Minh Nguyen ; minh chau
> >> ; Lennart Lund
> 
> >> Cc: opensaf-devel@lists.sourceforge.net
> >> Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn
notification
> >> [#1585]
> >>
> >> Hi Vu,
> >>
> >> TWith this patch Ntf will not perform any truncation on long dn while
> >> saflogging alrams.Is it with the log service (after supporting long dn)
> >> also or log service is performing any truncation before logging?
> >>
> >>
> >> Thanks,
> >> Praveen
> >>
> >> On 22-Jul-16 4:46 PM, Vu Minh Nguyen wrote:
> >>>  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc |  51
> > +++--
> >> -
> >>>  1 files changed, 13 insertions(+), 38 deletions(-)
> >>>
> >>>
> >>> Remove the part of code that truncates the long DN.
> >>>
> >>> diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> >> b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> >>> --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> >>> +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> >>> @@ -21,6 +21,7 @@
> >>>   */
> >>>  #include 
> >>>
> >>> +#include "osaf_utility.h"
> >>>  #include "saAis.h"
> >>>  #include "saLog.h"
> >>>  #include "NtfAdmin.hh"
> >>> @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
> >>> notif->getNotificationId(),
> >>> SA_LOG_RECORD_WRITE_ACK,
> >>> &logRecord);
> >>> -if (SA_AIS_OK != errorCode) {
> >>> -  LOG_NO("Failed to log an alarm or security alarm notification
> > (%d)",
> >> errorCode);
> >>> -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode ==
> >> SA_AIS_ERR_BAD_HANDLE) {
> >>> -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or
> >> SA_AIS_ERR_BAD_HANDLE; exiting (%d)...", errorCode);
> >>> -exit(EXIT_FAILURE);
> >>> -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
> >>> -/* Retry to log truncated notificationObject/notifyingObject
> > because
> >>> - * LOG Service has not supported long dn in Opensaf 4.5
> >>> - */
> >>> -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
> >>> -memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
> >>> -SaNameT shortdn_notificationObject, shortdn_notifyingObject;
> >>> -if (osaf_is_an_extended_name(ntfHeader->notificationObject))
{
> >>> -  strncpy(short

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-09 Thread praveen malviya
Hi Vu,

Thanks for the information.
I think your suggested information must go in README file.
Ack from me.

Thanks,
Praveen


On 10-Aug-16 8:46 AM, Vu Minh Nguyen wrote:
> Hi Praveen,
>
> The notification and notifying objects are truncated because we did not
> change default attribute values before running test.
>
> Following changes should be done before running test:
> 1) The field size of @No and @Ng tokens in `saLogStreamLogFileFormat`
> In default, the field-size value is 30. Means, the notification and
> notifying objects are limited to 30 characters.
> For long DN test, we should remove  the . E.g: change default
> "@No30" to "@No".
>
> 2) The fixed log record size - `saLogStreamFixedLogRecordSize`
> In default, its value is 200. A whole log record is limited to this number
> of characters.
> We should change it to 0, means variable log record size.
>
> 3) Max log record size - `logMaxLogrecsize` in class ` OpenSafLogConfig`
> In default, max log record size is limited to 1024 characters.
> We should change it to a bigger number. Max value is 65535.
>
> Example:
> # immcfg -a saLogStreamFixedLogRecordSize=0 -a saLogStreamLogFileFormat="@Cr
> @Ct @Nt @Ne6 @No @Ng \"@Cb\"" safLgStrCfg=saLogAlarm,safApp=safLogService
> # immcfg -a logMaxLogrecsize=65535 logConfig=1,safApp=safLogService
>
> We can consider to put these information into the ~/tests/ntfsv/README file.
>
> Regards, Vu
>
>> -Original Message-
>> From: praveen malviya [mailto:praveen.malv...@oracle.com]
>> Sent: Tuesday, August 9, 2016 6:46 PM
>> To: Vu Minh Nguyen ; 'minh chau'
>> ; 'Lennart Lund' 
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn notification
>> [#1585]
>>
>> Hi Vu,
>>
>> This patch is doing that. My question was any truncation being done from
>> log service after taking a long Dn notificaion from NTF.
>>
>> For example: When executed first ntf long dn test: ntftest 36 1
>>
>> LOG service logs these notification in saLogAlarm_20160809_165614.log as:
>>   10 0x146920b67187c6f0 0x146920b67187c6f0 0x4001
>> AA
>> BB "this is
>> additional text info"
>>   11 0x146920b67187c6f0 0x146920b67187c6f0 0x4001 AMF BLABLA
>> Component
>>  AMF BLABLA Entity  "this is additional text info"
>>
>> In the first notification above, notification and notifying objects are
>> truncated. Do we need to increase the size of log service record?
>>
>> Thanks,
>> Praveen
>>
>> On 05-Aug-16 8:40 AM, Vu Minh Nguyen wrote:
>>> Hi Praveen,
>>>
>>> Truncation is removed as LOG supports Long DN now. Means, NTF would
>> not get
>>> INVALID_PARAM if logging longdn-contained notifications.
>>>
>>> Regards, Vu
>>>
 -Original Message-
 From: praveen malviya [mailto:praveen.malv...@oracle.com]
 Sent: Thursday, August 4, 2016 8:24 PM
 To: Vu Minh Nguyen ; minh chau
 ; Lennart Lund
>> 
 Cc: opensaf-devel@lists.sourceforge.net
 Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn
> notification
 [#1585]

 Hi Vu,

 TWith this patch Ntf will not perform any truncation on long dn while
 saflogging alrams.Is it with the log service (after supporting long dn)
 also or log service is performing any truncation before logging?


 Thanks,
 Praveen

 On 22-Jul-16 4:46 PM, Vu Minh Nguyen wrote:
>  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc |  51
>>> +++--
 -
>  1 files changed, 13 insertions(+), 38 deletions(-)
>
>
> Remove the part of code that truncates the long DN.
>
> diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
 b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> @@ -21,6 +21,7 @@
>   */
>  #include 
>
> +#include "osaf_utility.h"
>  #include "saAis.h"
>  #include "saLog.h"
>  #include "NtfAdmin.hh"
> @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
> notif->getNotificationId(),
> SA_LOG_RECORD_WRITE_ACK,
> &logRecord);
> -if (SA_AIS_OK != errorCode) {
> -  LOG_NO("Failed to log an alarm or security alarm notification
>>> (%d)",
 errorCode);
> -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode ==
 SA_AIS_ERR_BAD_HANDLE) {
> -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or
 SA_AIS_ERR_BAD_HANDLE; exiting (%d)...", errorCode);
> -exit(EXIT_FAILURE);
> -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
> -/* Retry to log truncated notificationObject/notifyingObject
>>> because
> - * LOG Service has not supported long dn in Opensaf 4.5
> - */
> -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-09 Thread Lennart Lund
Hi

Why not make this part of the test cases? Change the configuration IMM 
attributes, run the test case and change back again to clean up

Thanks
Lennart

> -Original Message-
> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> Sent: den 10 augusti 2016 07:53
> To: Vu Minh Nguyen ; Minh Hon Chau
> ; Lennart Lund 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn notification 
> [#1585]
> 
> Hi Vu,
> 
> Thanks for the information.
> I think your suggested information must go in README file.
> Ack from me.
> 
> Thanks,
> Praveen
> 
> 
> On 10-Aug-16 8:46 AM, Vu Minh Nguyen wrote:
> > Hi Praveen,
> >
> > The notification and notifying objects are truncated because we did not
> > change default attribute values before running test.
> >
> > Following changes should be done before running test:
> > 1) The field size of @No and @Ng tokens in `saLogStreamLogFileFormat`
> > In default, the field-size value is 30. Means, the notification and
> > notifying objects are limited to 30 characters.
> > For long DN test, we should remove  the . E.g: change default
> > "@No30" to "@No".
> >
> > 2) The fixed log record size - `saLogStreamFixedLogRecordSize`
> > In default, its value is 200. A whole log record is limited to this number
> > of characters.
> > We should change it to 0, means variable log record size.
> >
> > 3) Max log record size - `logMaxLogrecsize` in class ` OpenSafLogConfig`
> > In default, max log record size is limited to 1024 characters.
> > We should change it to a bigger number. Max value is 65535.
> >
> > Example:
> > # immcfg -a saLogStreamFixedLogRecordSize=0 -a
> saLogStreamLogFileFormat="@Cr
> > @Ct @Nt @Ne6 @No @Ng \"@Cb\""
> safLgStrCfg=saLogAlarm,safApp=safLogService
> > # immcfg -a logMaxLogrecsize=65535 logConfig=1,safApp=safLogService
> >
> > We can consider to put these information into the ~/tests/ntfsv/README
> file.
> >
> > Regards, Vu
> >
> >> -Original Message-
> >> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> >> Sent: Tuesday, August 9, 2016 6:46 PM
> >> To: Vu Minh Nguyen ; 'minh chau'
> >> ; 'Lennart Lund'
> 
> >> Cc: opensaf-devel@lists.sourceforge.net
> >> Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn notification
> >> [#1585]
> >>
> >> Hi Vu,
> >>
> >> This patch is doing that. My question was any truncation being done from
> >> log service after taking a long Dn notificaion from NTF.
> >>
> >> For example: When executed first ntf long dn test: ntftest 36 1
> >>
> >> LOG service logs these notification in saLogAlarm_20160809_165614.log
> as:
> >>   10 0x146920b67187c6f0 0x146920b67187c6f0 0x4001
> >> AA
> >> BB "this is
> >> additional text info"
> >>   11 0x146920b67187c6f0 0x146920b67187c6f0 0x4001 AMF BLABLA
> >> Component
> >>  AMF BLABLA Entity  "this is additional text info"
> >>
> >> In the first notification above, notification and notifying objects are
> >> truncated. Do we need to increase the size of log service record?
> >>
> >> Thanks,
> >> Praveen
> >>
> >> On 05-Aug-16 8:40 AM, Vu Minh Nguyen wrote:
> >>> Hi Praveen,
> >>>
> >>> Truncation is removed as LOG supports Long DN now. Means, NTF would
> >> not get
> >>> INVALID_PARAM if logging longdn-contained notifications.
> >>>
> >>> Regards, Vu
> >>>
>  -Original Message-
>  From: praveen malviya [mailto:praveen.malv...@oracle.com]
>  Sent: Thursday, August 4, 2016 8:24 PM
>  To: Vu Minh Nguyen ; minh chau
>  ; Lennart Lund
> >> 
>  Cc: opensaf-devel@lists.sourceforge.net
>  Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn
> > notification
>  [#1585]
> 
>  Hi Vu,
> 
>  TWith this patch Ntf will not perform any truncation on long dn while
>  saflogging alrams.Is it with the log service (after supporting long dn)
>  also or log service is performing any truncation before logging?
> 
> 
>  Thanks,
>  Praveen
> 
>  On 22-Jul-16 4:46 PM, Vu Minh Nguyen wrote:
> >  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc |  51
> >>> +++--
>  -
> >  1 files changed, 13 insertions(+), 38 deletions(-)
> >
> >
> > Remove the part of code that truncates the long DN.
> >
> > diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
>  b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > @@ -21,6 +21,7 @@
> >   */
> >  #include 
> >
> > +#include "osaf_utility.h"
> >  #include "saAis.h"
> >  #include "saLog.h"
> >  #include "NtfAdmin.hh"
> > @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
> > notif->getNotificationId(),
> > SA_LOG_RECORD_WRITE_ACK,
> > 

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-10 Thread Vu Minh Nguyen
Hi Lennart,

Ok. I will put them into test cases. And will send the update out for review
after done. Thanks.

Regards, Vu

> -Original Message-
> From: Lennart Lund [mailto:lennart.l...@ericsson.com]
> Sent: Wednesday, August 10, 2016 1:56 PM
> To: praveen malviya ; Vu Minh Nguyen
> ; Minh Hon Chau
> 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [PATCH 1 of 1] ntfsv: refactor logging long dn notification
> [#1585]
> 
> Hi
> 
> Why not make this part of the test cases? Change the configuration IMM
> attributes, run the test case and change back again to clean up
> 
> Thanks
> Lennart
> 
> > -Original Message-
> > From: praveen malviya [mailto:praveen.malv...@oracle.com]
> > Sent: den 10 augusti 2016 07:53
> > To: Vu Minh Nguyen ; Minh Hon Chau
> > ; Lennart Lund
> 
> > Cc: opensaf-devel@lists.sourceforge.net
> > Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn notification
> [#1585]
> >
> > Hi Vu,
> >
> > Thanks for the information.
> > I think your suggested information must go in README file.
> > Ack from me.
> >
> > Thanks,
> > Praveen
> >
> >
> > On 10-Aug-16 8:46 AM, Vu Minh Nguyen wrote:
> > > Hi Praveen,
> > >
> > > The notification and notifying objects are truncated because we did
not
> > > change default attribute values before running test.
> > >
> > > Following changes should be done before running test:
> > > 1) The field size of @No and @Ng tokens in `saLogStreamLogFileFormat`
> > > In default, the field-size value is 30. Means, the notification and
> > > notifying objects are limited to 30 characters.
> > > For long DN test, we should remove  the . E.g: change
default
> > > "@No30" to "@No".
> > >
> > > 2) The fixed log record size - `saLogStreamFixedLogRecordSize`
> > > In default, its value is 200. A whole log record is limited to this
number
> > > of characters.
> > > We should change it to 0, means variable log record size.
> > >
> > > 3) Max log record size - `logMaxLogrecsize` in class `
OpenSafLogConfig`
> > > In default, max log record size is limited to 1024 characters.
> > > We should change it to a bigger number. Max value is 65535.
> > >
> > > Example:
> > > # immcfg -a saLogStreamFixedLogRecordSize=0 -a
> > saLogStreamLogFileFormat="@Cr
> > > @Ct @Nt @Ne6 @No @Ng \"@Cb\""
> > safLgStrCfg=saLogAlarm,safApp=safLogService
> > > # immcfg -a logMaxLogrecsize=65535 logConfig=1,safApp=safLogService
> > >
> > > We can consider to put these information into the ~/tests/ntfsv/README
> > file.
> > >
> > > Regards, Vu
> > >
> > >> -Original Message-
> > >> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> > >> Sent: Tuesday, August 9, 2016 6:46 PM
> > >> To: Vu Minh Nguyen ; 'minh chau'
> > >> ; 'Lennart Lund'
> > 
> > >> Cc: opensaf-devel@lists.sourceforge.net
> > >> Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn
notification
> > >> [#1585]
> > >>
> > >> Hi Vu,
> > >>
> > >> This patch is doing that. My question was any truncation being done
> from
> > >> log service after taking a long Dn notificaion from NTF.
> > >>
> > >> For example: When executed first ntf long dn test: ntftest 36 1
> > >>
> > >> LOG service logs these notification in
> saLogAlarm_20160809_165614.log
> > as:
> > >>   10 0x146920b67187c6f0 0x146920b67187c6f0 0x4001
> > >> AA
> > >> BB "this is
> > >> additional text info"
> > >>   11 0x146920b67187c6f0 0x146920b67187c6f0 0x4001 AMF BLABLA
> > >> Component
> > >>  AMF BLABLA Entity  "this is additional text
info"
> > >>
> > >> In the first notification above, notification and notifying objects
are
> > >> truncated. Do we need to increase the size of log service record?
> > >>
> > >> Thanks,
> > >> Praveen
> > >>
> > >> On 05-Aug-16 8:40 AM, Vu Minh Nguyen wrote:
> > >>> Hi Praveen,
> > >>>
> > >>> Truncation is removed as LOG supports Long DN now. Means, NTF
> would
> > >> not get
> > >>> INVALID_PARAM if logging longdn-contained notifications.
> > >>>
> > >>> Regards, Vu
> > >>>
> >  -Original Message-
> >  From: praveen malviya [mailto:praveen.malv...@oracle.com]
> >  Sent: Thursday, August 4, 2016 8:24 PM
> >  To: Vu Minh Nguyen ; minh chau
> >  ; Lennart Lund
> > >> 
> >  Cc: opensaf-devel@lists.sourceforge.net
> >  Subject: Re: [PATCH 1 of 1] ntfsv: refactor logging long dn
> > > notification
> >  [#1585]
> > 
> >  Hi Vu,
> > 
> >  TWith this patch Ntf will not perform any truncation on long dn
while
> >  saflogging alrams.Is it with the log service (after supporting long
dn)
> >  also or log service is performing any truncation before logging?
> > 
> > 
> >  Thanks,
> >  Praveen
> > 
> >  On 22-Jul-16 4:46 PM, Vu Minh Nguyen wrote:
> > >  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc |  51
> > >>> +++--
> >  -
> > >  1 files changed, 13 insertions(+), 38 deletions(-)
> > >
> > >
> > > Remove

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-15 Thread Vu Minh Nguyen
Hi all,

Do you have any comments on the updated patch (update test code)? Thanks.

Regards, Vu

> -Original Message-
> From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> Sent: Thursday, August 11, 2016 3:33 PM
> To: praveen malviya ; Lennart Lund
> ; Minh Hon Chau
> 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn
notification
> [#1585]
> 
>  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc   |   51 +-
>  tests/ntfsv/tet_longDnObject_notification.c |  188
> +++-
>  2 files changed, 196 insertions(+), 43 deletions(-)
> 
> 
> Remove the part of code that truncates the long DN.
> And update the long DN test suite (#36) to make sure full record logged.
> 
> diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> @@ -21,6 +21,7 @@
>   */
>  #include 
> 
> +#include "osaf_utility.h"
>  #include "saAis.h"
>  #include "saLog.h"
>  #include "NtfAdmin.hh"
> @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
> notif->getNotificationId(),
> SA_LOG_RECORD_WRITE_ACK,
> &logRecord);
> -if (SA_AIS_OK != errorCode) {
> -  LOG_NO("Failed to log an alarm or security alarm notification
(%d)",
> errorCode);
> -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode ==
> SA_AIS_ERR_BAD_HANDLE) {
> -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or
> SA_AIS_ERR_BAD_HANDLE; exiting (%d)...", errorCode);
> -exit(EXIT_FAILURE);
> -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
> -/* Retry to log truncated notificationObject/notifyingObject
because
> - * LOG Service has not supported long dn in Opensaf 4.5
> - */
> -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
> -memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
> -SaNameT shortdn_notificationObject, shortdn_notifyingObject;
> -if (osaf_is_an_extended_name(ntfHeader->notificationObject)) {
> -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
> >notificationObject)
> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> -  osaf_extended_name_lend(short_dn, &shortdn_notificationObject);
> -  logRecord.logHeader.ntfHdr.notificationObject =
> &shortdn_notificationObject;
> -}
> -if (osaf_is_an_extended_name(ntfHeader->notifyingObject)) {
> -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
> >notifyingObject)
> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> -  osaf_extended_name_lend(short_dn, &shortdn_notifyingObject);
> -  logRecord.logHeader.ntfHdr.notifyingObject =
> &shortdn_notifyingObject;
> -}
> -if (short_dn[0] != '\0') {
> -  LOG_NO("Retry to log the truncated
> notificationObject/notifyingObject");
> -  if ((errorCode = saLogWriteLogAsync(alarmStreamHandle,
> -  notif->getNotificationId(),
> -  SA_LOG_RECORD_WRITE_ACK,
> -  &logRecord)) != SA_AIS_OK)
{
> -LOG_ER("Failed to log the truncated
> notificationObject/notifyingObject (%d)"
> -   , errorCode);
> -  }
> -}
> -  }
> -  goto end;
> +switch (errorCode) {
> +case SA_AIS_OK:
> + break;
> +
> +/* LOGsv is busy. Put the notification to queue and re-send next time
*/
> +case SA_AIS_ERR_TRY_AGAIN:
> +case SA_AIS_ERR_TIMEOUT:
> + TRACE("Failed to log notification (ret: %d). Try next time.",
> errorCode);
> + break;
> +
> +default:
> + osaf_abort(errorCode);
>  }
>}
> 
> -end:
>TRACE_LEAVE();
> -
>return errorCode;
>  }
> 
> diff --git a/tests/ntfsv/tet_longDnObject_notification.c
> b/tests/ntfsv/tet_longDnObject_notification.c
> --- a/tests/ntfsv/tet_longDnObject_notification.c
> +++ b/tests/ntfsv/tet_longDnObject_notification.c
> @@ -19,6 +19,7 @@
>   */
>  #include 
>  #include 
> +#include 
>  #include "tet_ntf.h"
>  #include "tet_ntf_common.h"
>  //#include "util.h"
> @@ -57,6 +58,166 @@ static SaNtfSecurityAlarmNotificationT m
>  extern void saAisNameLend(SaConstStringT value, SaNameT* na

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-16 Thread praveen malviya
Ack.

Thanks,
Praveen

On 11-Aug-16 2:03 PM, Vu Minh Nguyen wrote:
>  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc   |   51 +-
>  tests/ntfsv/tet_longDnObject_notification.c |  188 
> +++-
>  2 files changed, 196 insertions(+), 43 deletions(-)
>
>
> Remove the part of code that truncates the long DN.
> And update the long DN test suite (#36) to make sure full record logged.
>
> diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc 
> b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> @@ -21,6 +21,7 @@
>   */
>  #include 
>
> +#include "osaf_utility.h"
>  #include "saAis.h"
>  #include "saLog.h"
>  #include "NtfAdmin.hh"
> @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
> notif->getNotificationId(),
> SA_LOG_RECORD_WRITE_ACK,
> &logRecord);
> -if (SA_AIS_OK != errorCode) {
> -  LOG_NO("Failed to log an alarm or security alarm notification (%d)", 
> errorCode);
> -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode == 
> SA_AIS_ERR_BAD_HANDLE) {
> -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or SA_AIS_ERR_BAD_HANDLE; 
> exiting (%d)...", errorCode);
> -exit(EXIT_FAILURE);
> -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
> -/* Retry to log truncated notificationObject/notifyingObject because
> - * LOG Service has not supported long dn in Opensaf 4.5
> - */
> -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
> -memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
> -SaNameT shortdn_notificationObject, shortdn_notifyingObject;
> -if (osaf_is_an_extended_name(ntfHeader->notificationObject)) {
> -  strncpy(short_dn, 
> osaf_extended_name_borrow(ntfHeader->notificationObject)
> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> -  osaf_extended_name_lend(short_dn, &shortdn_notificationObject);
> -  logRecord.logHeader.ntfHdr.notificationObject = 
> &shortdn_notificationObject;
> -}
> -if (osaf_is_an_extended_name(ntfHeader->notifyingObject)) {
> -  strncpy(short_dn, 
> osaf_extended_name_borrow(ntfHeader->notifyingObject)
> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> -  osaf_extended_name_lend(short_dn, &shortdn_notifyingObject);
> -  logRecord.logHeader.ntfHdr.notifyingObject = 
> &shortdn_notifyingObject;
> -}
> -if (short_dn[0] != '\0') {
> -  LOG_NO("Retry to log the truncated 
> notificationObject/notifyingObject");
> -  if ((errorCode = saLogWriteLogAsync(alarmStreamHandle,
> -  notif->getNotificationId(),
> -  SA_LOG_RECORD_WRITE_ACK,
> -  &logRecord)) != SA_AIS_OK) {
> -LOG_ER("Failed to log the truncated 
> notificationObject/notifyingObject (%d)"
> -   , errorCode);
> -  }
> -}
> -  }
> -  goto end;
> +switch (errorCode) {
> +case SA_AIS_OK:
> + break;
> +
> +/* LOGsv is busy. Put the notification to queue and re-send next time */
> +case SA_AIS_ERR_TRY_AGAIN:
> +case SA_AIS_ERR_TIMEOUT:
> + TRACE("Failed to log notification (ret: %d). Try next time.", 
> errorCode);
> + break;
> +
> +default:
> + osaf_abort(errorCode);
>  }
>}
>
> -end:
>TRACE_LEAVE();
> -
>return errorCode;
>  }
>
> diff --git a/tests/ntfsv/tet_longDnObject_notification.c 
> b/tests/ntfsv/tet_longDnObject_notification.c
> --- a/tests/ntfsv/tet_longDnObject_notification.c
> +++ b/tests/ntfsv/tet_longDnObject_notification.c
> @@ -19,6 +19,7 @@
>   */
>  #include 
>  #include 
> +#include 
>  #include "tet_ntf.h"
>  #include "tet_ntf_common.h"
>  //#include "util.h"
> @@ -57,6 +58,166 @@ static SaNtfSecurityAlarmNotificationT m
>  extern void saAisNameLend(SaConstStringT value, SaNameT* name);
>  extern SaConstStringT saAisNameBorrow(const SaNameT* name);
>
> +//>
> +// For backup and restore IMM attribute values.
> +//<
> +
> +#define MAX_DATA 256
> +typedef struct {
> + char name[MAX_DATA];
> + char val[MAX_DATA];
> + int val_is_num;
> +} attrinfo_t;
> +
> +typedef struct {
> + attrinfo_t *attr;
> + size_t size;
> +} attrlist_t;
> +
> +typedef struct {
> + attrlist_t *alist;
> + char dn[MAX_DATA];
> +} imminfo_t;
> +
> +static void getVal(imminfo_t *info)
> +{
> + FILE *fp = NULL;
> + attrinfo_t *tmp = NULL;
> + char attrValue[MAX_DATA] = {0};
> + char command[MAX_DATA] = {0};
> + size_t s = info->alist->size;
> +
> + tmp = info->alist->attr;
> + while (s) {
> + sprintf(command, "immlist -a %s %s "
> + "| awk -F \"=\" '{print $2}' ", tmp->name,
> +  

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-22 Thread minh chau
Hi Vu,

Ack from me (tested)

Thanks,
Minh

On 16/08/16 13:30, Vu Minh Nguyen wrote:
> Hi all,
>
> Do you have any comments on the updated patch (update test code)? Thanks.
>
> Regards, Vu
>
>> -Original Message-
>> From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
>> Sent: Thursday, August 11, 2016 3:33 PM
>> To: praveen malviya ; Lennart Lund
>> ; Minh Hon Chau
>> 
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn
> notification
>> [#1585]
>>
>>   osaf/services/saf/ntfsv/ntfs/NtfLogger.cc   |   51 +-
>>   tests/ntfsv/tet_longDnObject_notification.c |  188
>> +++-
>>   2 files changed, 196 insertions(+), 43 deletions(-)
>>
>>
>> Remove the part of code that truncates the long DN.
>> And update the long DN test suite (#36) to make sure full record logged.
>>
>> diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
>> b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
>> --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
>> +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
>> @@ -21,6 +21,7 @@
>>*/
>>   #include 
>>
>> +#include "osaf_utility.h"
>>   #include "saAis.h"
>>   #include "saLog.h"
>>   #include "NtfAdmin.hh"
>> @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
>>  notif->getNotificationId(),
>>  SA_LOG_RECORD_WRITE_ACK,
>>  &logRecord);
>> -if (SA_AIS_OK != errorCode) {
>> -  LOG_NO("Failed to log an alarm or security alarm notification
> (%d)",
>> errorCode);
>> -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode ==
>> SA_AIS_ERR_BAD_HANDLE) {
>> -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or
>> SA_AIS_ERR_BAD_HANDLE; exiting (%d)...", errorCode);
>> -exit(EXIT_FAILURE);
>> -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
>> -/* Retry to log truncated notificationObject/notifyingObject
> because
>> - * LOG Service has not supported long dn in Opensaf 4.5
>> - */
>> -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
>> -memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
>> -SaNameT shortdn_notificationObject, shortdn_notifyingObject;
>> -if (osaf_is_an_extended_name(ntfHeader->notificationObject)) {
>> -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
>>> notificationObject)
>> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
>> -  osaf_extended_name_lend(short_dn, &shortdn_notificationObject);
>> -  logRecord.logHeader.ntfHdr.notificationObject =
>> &shortdn_notificationObject;
>> -}
>> -if (osaf_is_an_extended_name(ntfHeader->notifyingObject)) {
>> -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
>>> notifyingObject)
>> -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
>> -  osaf_extended_name_lend(short_dn, &shortdn_notifyingObject);
>> -  logRecord.logHeader.ntfHdr.notifyingObject =
>> &shortdn_notifyingObject;
>> -}
>> -if (short_dn[0] != '\0') {
>> -  LOG_NO("Retry to log the truncated
>> notificationObject/notifyingObject");
>> -  if ((errorCode = saLogWriteLogAsync(alarmStreamHandle,
>> -  notif->getNotificationId(),
>> -  SA_LOG_RECORD_WRITE_ACK,
>> -  &logRecord)) != SA_AIS_OK)
> {
>> -LOG_ER("Failed to log the truncated
>> notificationObject/notifyingObject (%d)"
>> -   , errorCode);
>> -  }
>> -}
>> -  }
>> -  goto end;
>> +switch (errorCode) {
>> +case SA_AIS_OK:
>> +break;
>> +
>> +/* LOGsv is busy. Put the notification to queue and re-send next time
> */
>> +case SA_AIS_ERR_TRY_AGAIN:
>> +case SA_AIS_ERR_TIMEOUT:
>> +TRACE("Failed to log notification (ret: %d). Try next time.",
>> errorCode);
>> +break;
>> +
>> +default:
>> +osaf_abort(errorCode);
>>   }
>> }
>>
>> -end:
>> TRACE_LEAVE();
>> -
>> return errorCode;
>>   }
>>

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-22 Thread Lennart Lund
Hi Vu

Ack with comments:
It seems as if you have integrated the manual steps by adding some functions 
for handling data in IMM but it's very cryptic.
It's hard to see what "environment" that is backed up, restored and setup. This 
should be made more clear. Since the functions used for this are not 
generically handling any environment the names could be changed to reflect what 
they actually do, also variables used could have more descriptive names instead 
of aData, CData etc. Also a comment summarizing what's going on would not be 
out of place...

Thanks
Lennart

> -Original Message-
> From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> Sent: den 22 augusti 2016 10:49
> To: Lennart Lund ; Minh Hon Chau
> 
> Subject: RE: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn 
> notification
> [#1585]
> 
> Hi Lennart, Minh
> 
> Here is the patch just in  case.
> 
> If  you have no comment, I will push it today. Thanks. :)
> 
> Regards, Vu
> 
> > -Original Message-
> > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> > Sent: Tuesday, August 16, 2016 10:30 AM
> > To: 'praveen malviya' ; 'Lennart Lund'
> > ; 'Minh Hon Chau'
> > 
> > Cc: 'opensaf-devel@lists.sourceforge.net'  > de...@lists.sourceforge.net>
> > Subject: RE: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn
> > notification [#1585]
> >
> > Hi all,
> >
> > Do you have any comments on the updated patch (update test code)?
> > Thanks.
> >
> > Regards, Vu
> >
> > > -Original Message-
> > > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> > > Sent: Thursday, August 11, 2016 3:33 PM
> > > To: praveen malviya ; Lennart Lund
> > > ; Minh Hon Chau
> > > 
> > > Cc: opensaf-devel@lists.sourceforge.net
> > > Subject: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn
> notification
> > > [#1585]
> > >
> > >  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc   |   51 +-
> > >  tests/ntfsv/tet_longDnObject_notification.c |  188
> > > +++-
> > >  2 files changed, 196 insertions(+), 43 deletions(-)
> > >
> > >
> > > Remove the part of code that truncates the long DN.
> > > And update the long DN test suite (#36) to make sure full record logged.
> > >
> > > diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > @@ -21,6 +21,7 @@
> > >   */
> > >  #include 
> > >
> > > +#include "osaf_utility.h"
> > >  #include "saAis.h"
> > >  #include "saLog.h"
> > >  #include "NtfAdmin.hh"
> > > @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
> > > notif->getNotificationId(),
> > > SA_LOG_RECORD_WRITE_ACK,
> > > &logRecord);
> > > -if (SA_AIS_OK != errorCode) {
> > > -  LOG_NO("Failed to log an alarm or security alarm notification
> (%d)",
> > > errorCode);
> > > -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode ==
> > > SA_AIS_ERR_BAD_HANDLE) {
> > > -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or
> > > SA_AIS_ERR_BAD_HANDLE; exiting (%d)...", errorCode);
> > > -exit(EXIT_FAILURE);
> > > -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
> > > -/* Retry to log truncated notificationObject/notifyingObject
> because
> > > - * LOG Service has not supported long dn in Opensaf 4.5
> > > - */
> > > -char short_dn[SA_MAX_UNEXTENDED_NAME_LENGTH];
> > > -memset(&short_dn, 0, SA_MAX_UNEXTENDED_NAME_LENGTH);
> > > -SaNameT shortdn_notificationObject, shortdn_notifyingObject;
> > > -if (osaf_is_an_extended_name(ntfHeader->notificationObject)) {
> > > -  strncpy(short_dn, osaf_extended_name_borrow(ntfHeader-
> > > >notificationObject)
> > > -  , SA_MAX_UNEXTENDED_NAME_LENGTH - 1);
> > > -  osaf_extended_name_lend(short_dn,
> &shortdn_notificationObject);
> > > -  logRecord.logHeader.ntfHdr.notificationObject =
> > > &shortdn_notificationObject;
> > &g

Re: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn notification [#1585]

2016-08-22 Thread Vu Minh Nguyen
Thanks Lennart. I have added comments to make the code more
clear/understandable.

Regards, Vu

> -Original Message-
> From: Lennart Lund [mailto:lennart.l...@ericsson.com]
> Sent: Monday, August 22, 2016 6:14 PM
> To: Vu Minh Nguyen ; Minh Hon Chau
> 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn
> notification [#1585]
> 
> Hi Vu
> 
> Ack with comments:
> It seems as if you have integrated the manual steps by adding some
functions
> for handling data in IMM but it's very cryptic.
> It's hard to see what "environment" that is backed up, restored and setup.
> This should be made more clear. Since the functions used for this are not
> generically handling any environment the names could be changed to reflect
> what they actually do, also variables used could have more descriptive
> names instead of aData, CData etc. Also a comment summarizing what's
> going on would not be out of place...
> 
> Thanks
> Lennart
> 
> > -Original Message-
> > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> > Sent: den 22 augusti 2016 10:49
> > To: Lennart Lund ; Minh Hon Chau
> > 
> > Subject: RE: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn
> notification
> > [#1585]
> >
> > Hi Lennart, Minh
> >
> > Here is the patch just in  case.
> >
> > If  you have no comment, I will push it today. Thanks. :)
> >
> > Regards, Vu
> >
> > > -Original Message-
> > > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> > > Sent: Tuesday, August 16, 2016 10:30 AM
> > > To: 'praveen malviya' ; 'Lennart Lund'
> > > ; 'Minh Hon Chau'
> > > 
> > > Cc: 'opensaf-devel@lists.sourceforge.net'  > > de...@lists.sourceforge.net>
> > > Subject: RE: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn
> > > notification [#1585]
> > >
> > > Hi all,
> > >
> > > Do you have any comments on the updated patch (update test code)?
> > > Thanks.
> > >
> > > Regards, Vu
> > >
> > > > -Original Message-
> > > > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> > > > Sent: Thursday, August 11, 2016 3:33 PM
> > > > To: praveen malviya ; Lennart Lund
> > > > ; Minh Hon Chau
> > > > 
> > > > Cc: opensaf-devel@lists.sourceforge.net
> > > > Subject: [devel] [PATCH 1 of 1] ntfsv: refactor logging long dn
> > notification
> > > > [#1585]
> > > >
> > > >  osaf/services/saf/ntfsv/ntfs/NtfLogger.cc   |   51 +-
> > > >  tests/ntfsv/tet_longDnObject_notification.c |  188
> > > > +++-
> > > >  2 files changed, 196 insertions(+), 43 deletions(-)
> > > >
> > > >
> > > > Remove the part of code that truncates the long DN.
> > > > And update the long DN test suite (#36) to make sure full record
logged.
> > > >
> > > > diff --git a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > > b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > > --- a/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > > +++ b/osaf/services/saf/ntfsv/ntfs/NtfLogger.cc
> > > > @@ -21,6 +21,7 @@
> > > >   */
> > > >  #include 
> > > >
> > > > +#include "osaf_utility.h"
> > > >  #include "saAis.h"
> > > >  #include "saLog.h"
> > > >  #include "NtfAdmin.hh"
> > > > @@ -232,48 +233,22 @@ SaAisErrorT NtfLogger::logNotification(N
> > > > notif->getNotificationId(),
> > > > SA_LOG_RECORD_WRITE_ACK,
> > > > &logRecord);
> > > > -if (SA_AIS_OK != errorCode) {
> > > > -  LOG_NO("Failed to log an alarm or security alarm notification
> > (%d)",
> > > > errorCode);
> > > > -  if (errorCode == SA_AIS_ERR_LIBRARY || errorCode ==
> > > > SA_AIS_ERR_BAD_HANDLE) {
> > > > -LOG_ER("Fatal error SA_AIS_ERR_LIBRARY or
> > > > SA_AIS_ERR_BAD_HANDLE; exiting (%d)...", errorCode);
> > > > -exit(EXIT_FAILURE);
> > > > -  } else if (errorCode == SA_AIS_ERR_INVALID_PARAM) {
> > > > -/* Retry to log truncated
notificationObject/notifyingObje