Re: [devel] [PATCH 1/1] amf: fix no active assignment even one in-service SU can be assigned [#3020]

2019-08-08 Thread Tran Thuan
Hi bro.Minh,

I am fine with rename that original function.
Please update and help push.
Thank you.

Best Regards,
ThuanTr

-Original Message-
From: Minh Hon Chau  
Sent: Friday, August 9, 2019 10:13 AM
To: thuan.tran ; gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] amf: fix no active assignment even one in-service SU 
can be assigned [#3020]

Hi Thuan,

ack with minor comments.

Thanks

Minh

On 18/3/19 7:04 pm, thuan.tran wrote:
> AMFD should try assign SI active for other in-service SUs if fail to 
> assign for current in-service SU
> ---
>   src/amf/amfd/sg_2n_fsm.cc | 75 
> +--
>   1 file changed, 46 insertions(+), 29 deletions(-)
>
> diff --git a/src/amf/amfd/sg_2n_fsm.cc b/src/amf/amfd/sg_2n_fsm.cc 
> index 91ffc63..ba0f72e 100644
> --- a/src/amf/amfd/sg_2n_fsm.cc
> +++ b/src/amf/amfd/sg_2n_fsm.cc
> @@ -630,6 +630,43 @@ done:
>   }
>   
>   
> /*
> 
> + * Function: avd_sg_2n_assign_si
> + *
> + * Purpose:  This function choose and assign SIs in the SG that dont have
> + *   active assignment.
> + *
> + * Input: cb - the AVD control block
> + *sg - The pointer to the service group.
> + *su - The pointer to the service unit to be assigned ACTIVE.
> + *
> + * Returns: True if assign succeed, otherwise return false
> + *
> + 
> +*
> +*/ static bool avd_sg_2n_assign_si(AVD_CL_CB *cb, AVD_SG *sg, 
> +AVD_SU *su) {
[M]: This function only creates active assignment, the name could be 
avd_sg_2n_assign_act_si (or you can come up another name) to suggest what it is 
actually doing inside. And add TRACE_ENTER()/LEAVE().
> +  bool l_flag = false;
> +  AVD_SU_SI_REL *tmp_susi;
> +  /* choose and assign SIs in the SG that dont have active assignment 
> +*/
> +  for (const auto _si : sg->list_of_si) {
> +if ((i_si->saAmfSIAdminState == SA_AMF_ADMIN_UNLOCKED) &&
> +(i_si->list_of_csi != nullptr) &&
> +(i_si->si_dep_state != AVD_SI_SPONSOR_UNASSIGNED) &&
> +(i_si->si_dep_state != AVD_SI_UNASSIGNING_DUE_TO_DEP) &&
> +(i_si->si_dep_state != AVD_SI_READY_TO_UNASSIGN) &&
> +(i_si->list_of_sisu == AVD_SU_SI_REL_NULL) &&
> +(su->saAmfSUNumCurrActiveSIs < sg->saAmfSGMaxActiveSIsperSU)) {
> +  /* found a SI that needs active assignment. */
> +  if (avd_new_assgn_susi(cb, su, i_si, SA_AMF_HA_ACTIVE, false,
> + _susi) == NCSCC_RC_SUCCESS) {
> +l_flag = true;
> +  } else {
> +LOG_ER("%s:%u: %s", __FILE__, __LINE__, i_si->name.c_str());
> +  }
> +}
> +  }
> +  return l_flag;
> +}
> +
> +/
> +*
>* Function: avd_sg_2n_su_chose_asgn
>*
>* Purpose:  This function will identify the current active SU.
> @@ -675,7 +712,10 @@ static AVD_SU *avd_sg_2n_su_chose_asgn(AVD_CL_CB *cb, 
> AVD_SG *sg) {
>   for (const auto  : sg->list_of_su) {
> if (iter->saAmfSuReadinessState == SA_AMF_READINESS_IN_SERVICE) {
>   a_su = iter;
> -break;
> +l_flag = avd_sg_2n_assign_si(cb, sg, a_su);
> +if (l_flag == true) {
> +  break;
> +}
> }
>   }
>   
> @@ -683,36 +723,13 @@ static AVD_SU *avd_sg_2n_su_chose_asgn(AVD_CL_CB *cb, 
> AVD_SG *sg) {
> TRACE("No in service SUs available in the SG");
> goto done;
>   }
> -  } else { /* if (a_susi == AVD_SU_SI_REL_NULL) */
> -
> +  } else { /* if (a_susi != AVD_SU_SI_REL_NULL) */
>   a_su = a_susi->su;
> -  }
> -
> -  if (a_su->saAmfSuReadinessState != SA_AMF_READINESS_IN_SERVICE) {
> -TRACE("The current active SU is OOS so return");
> -goto done;
> -  }
> -
> -  /* check if any more active SIs can be assigned to this SU */
> -  l_flag = false;
> -
> -  /* choose and assign SIs in the SG that dont have active assignment 
> */
> -  for (const auto _si : sg->list_of_si) {
> -if ((i_si->saAmfSIAdminState == SA_AMF_ADMIN_UNLOCKED) &&
> -(i_si->list_of_csi != nullptr) &&
> -(i_si->si_dep_state != AVD_SI_SPONSOR_UNASSIGNED) &&
> -(i_si->si_dep_state != AVD_SI_UNASSIGNING_DUE_TO_DEP) &&
> -(i_si->si_dep_state != AVD_SI_READY_TO_UNASSIGN) &&
> -(i_si->list_of_sisu == AVD_SU_SI_REL_NULL) &&
> -(a_su->saAmfSUNumCurrActiveSIs < sg->saAmfSGMaxActiveSIsperSU)) {
> -  /* found a SI that needs active assignment. */
> -  if (avd_new_assgn_susi(cb, a_su, i_si, SA_AMF_HA_ACTIVE, false,
> - _susi) == NCSCC_RC_SUCCESS) {
> -l_flag = true;
> -  } else {
> -LOG_ER("%s:%u: %s", __FILE__, __LINE__, i_si->name.c_str());
> -  }
> +if (a_su->saAmfSuReadinessState != SA_AMF_READINESS_IN_SERVICE) {
> +  TRACE("The current active SU is OOS so return");
> +  

Re: [devel] [PATCH 1/1] scripts: use tipc instead of obsolute tipc-config in opensaf_reboot [#3066]

2019-08-08 Thread Thang Nguyen
Hi Vu,

I have a comment in line.

B.R
/Thang

-Original Message-
From: Vu Minh Nguyen  
Sent: Friday, August 9, 2019 9:47 AM
To: anders.wid...@ericsson.com; gary@dektech.com.au;
thang.d.ngu...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen

Subject: [PATCH 1/1] scripts: use tipc instead of obsolute tipc-config in
opensaf_reboot [#3066]

---
 scripts/opensaf_reboot  | 11 ++-
 src/nid/configure_tipc.in   |  1 -
 tools/cluster_sim_uml/build_uml |  4 ++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/scripts/opensaf_reboot b/scripts/opensaf_reboot index
9623c39a8..be635a442 100644
--- a/scripts/opensaf_reboot
+++ b/scripts/opensaf_reboot
@@ -128,6 +128,15 @@ temp_node_id=`cat "$NODE_ID_FILE"`  temp_node_id=`echo
"$temp_node_id" |sed -e 's:^0[bBxX]::'| sed -e 's:^:0x:'`
self_node_id=`printf "%d" $temp_node_id`
 
+tipc=$(which tipc 2> /dev/null)
+tipc_config=$(which tipc-config 2> /dev/null)
+
+if [ -x "${tipc}" ]; then
+   tipc_config="${pkglibdir}"/tipc-config
+fi
+
+unset tipc
+
[THANG]: I think no need.
 # If no argument is provided, forcing node reboot immediately without log
# flushing, process terminating, disk un-mounting.
 # If clm cluster reboot requested argument one and two are set but not
used, @@ -149,7 +158,7 @@ else
 
 # Isolate the node
 if [ "$MDS_TRANSPORT" = "TIPC" ]; then
-   tipc-config -bd eth:$TIPC_ETH_IF
+   ${tipc_config} -bd=eth:$TIPC_ETH_IF
[THANG]: Can add like this ?
---
+   tipc=$(which tipc 2> /dev/null)
+   if [ -x "${tipc}" ]; then
+   tipc bearer disable media eth device $TIPC_ETH_IF
+   else
+   tipc-config -bd eth:$TIPC_ETH_IF
+   fi
---
 else
$icmd pkill -STOP osafdtmd
 fi
diff --git a/src/nid/configure_tipc.in b/src/nid/configure_tipc.in index
b13a685f3..73dd1cbe0 100644
--- a/src/nid/configure_tipc.in
+++ b/src/nid/configure_tipc.in
@@ -69,7 +69,6 @@ if [ "$#" -lt "1" ] || [ "$#" -gt "4" ]
  exit 1
 fi
 
-# Make sure tipc-config is available, either in path or in default location
tipc=$(which tipc 2> /dev/null)  tipc_config=$(which tipc-config 2>
/dev/null)
 
diff --git a/tools/cluster_sim_uml/build_uml
b/tools/cluster_sim_uml/build_uml index 8e48bb5a5..edbe01c5d 100755
--- a/tools/cluster_sim_uml/build_uml
+++ b/tools/cluster_sim_uml/build_uml
@@ -225,11 +225,11 @@ cmd_create_rootfs()
 
 install -m 755 $archive/scripts/*.rc etc/init.d
 cp $scripts/profile etc
-cp $scripts/reboot $scripts/shutdown $opensaf_home/scripts/tipc-config
usr/sbin
+cp $scripts/reboot $scripts/shutdown usr/sbin
 mkdir -p root/www/cgi-bin
 cp $scripts/rshd root/www/cgi-bin
 cp $scripts/rsh $scripts/rcp $scripts/sudo usr/bin
-chmod +x usr/sbin/shutdown usr/sbin/tipc-config root/www/cgi-bin/rshd
usr/bin/rsh usr/bin/rcp usr/bin/sudo
+chmod +x usr/sbin/shutdown root/www/cgi-bin/rshd usr/bin/rsh 
+ usr/bin/rcp usr/bin/sudo
 
 echo "Copy some needed extra programs (bash, ...)"
 install /bin/bash usr/bin
--
2.17.1




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


Re: [devel] [PATCH 1/1] amf: fix no active assignment even one in-service SU can be assigned [#3020]

2019-08-08 Thread Minh Hon Chau

Hi Thuan,

ack with minor comments.

Thanks

Minh

On 18/3/19 7:04 pm, thuan.tran wrote:

AMFD should try assign SI active for other in-service SUs if fail to assign
for current in-service SU
---
  src/amf/amfd/sg_2n_fsm.cc | 75 +--
  1 file changed, 46 insertions(+), 29 deletions(-)

diff --git a/src/amf/amfd/sg_2n_fsm.cc b/src/amf/amfd/sg_2n_fsm.cc
index 91ffc63..ba0f72e 100644
--- a/src/amf/amfd/sg_2n_fsm.cc
+++ b/src/amf/amfd/sg_2n_fsm.cc
@@ -630,6 +630,43 @@ done:
  }
  
  /*

+ * Function: avd_sg_2n_assign_si
+ *
+ * Purpose:  This function choose and assign SIs in the SG that dont have
+ *   active assignment.
+ *
+ * Input: cb - the AVD control block
+ *sg - The pointer to the service group.
+ *su - The pointer to the service unit to be assigned ACTIVE.
+ *
+ * Returns: True if assign succeed, otherwise return false
+ *
+ **/
+static bool avd_sg_2n_assign_si(AVD_CL_CB *cb, AVD_SG *sg, AVD_SU *su) {
[M]: This function only creates active assignment, the name could be 
avd_sg_2n_assign_act_si (or you can come up another name) to suggest 
what it is actually doing inside. And add TRACE_ENTER()/LEAVE().

+  bool l_flag = false;
+  AVD_SU_SI_REL *tmp_susi;
+  /* choose and assign SIs in the SG that dont have active assignment */
+  for (const auto _si : sg->list_of_si) {
+if ((i_si->saAmfSIAdminState == SA_AMF_ADMIN_UNLOCKED) &&
+(i_si->list_of_csi != nullptr) &&
+(i_si->si_dep_state != AVD_SI_SPONSOR_UNASSIGNED) &&
+(i_si->si_dep_state != AVD_SI_UNASSIGNING_DUE_TO_DEP) &&
+(i_si->si_dep_state != AVD_SI_READY_TO_UNASSIGN) &&
+(i_si->list_of_sisu == AVD_SU_SI_REL_NULL) &&
+(su->saAmfSUNumCurrActiveSIs < sg->saAmfSGMaxActiveSIsperSU)) {
+  /* found a SI that needs active assignment. */
+  if (avd_new_assgn_susi(cb, su, i_si, SA_AMF_HA_ACTIVE, false,
+ _susi) == NCSCC_RC_SUCCESS) {
+l_flag = true;
+  } else {
+LOG_ER("%s:%u: %s", __FILE__, __LINE__, i_si->name.c_str());
+  }
+}
+  }
+  return l_flag;
+}
+
+/*
   * Function: avd_sg_2n_su_chose_asgn
   *
   * Purpose:  This function will identify the current active SU.
@@ -675,7 +712,10 @@ static AVD_SU *avd_sg_2n_su_chose_asgn(AVD_CL_CB *cb, 
AVD_SG *sg) {
  for (const auto  : sg->list_of_su) {
if (iter->saAmfSuReadinessState == SA_AMF_READINESS_IN_SERVICE) {
  a_su = iter;
-break;
+l_flag = avd_sg_2n_assign_si(cb, sg, a_su);
+if (l_flag == true) {
+  break;
+}
}
  }
  
@@ -683,36 +723,13 @@ static AVD_SU *avd_sg_2n_su_chose_asgn(AVD_CL_CB *cb, AVD_SG *sg) {

TRACE("No in service SUs available in the SG");
goto done;
  }
-  } else { /* if (a_susi == AVD_SU_SI_REL_NULL) */
-
+  } else { /* if (a_susi != AVD_SU_SI_REL_NULL) */
  a_su = a_susi->su;
-  }
-
-  if (a_su->saAmfSuReadinessState != SA_AMF_READINESS_IN_SERVICE) {
-TRACE("The current active SU is OOS so return");
-goto done;
-  }
-
-  /* check if any more active SIs can be assigned to this SU */
-  l_flag = false;
-
-  /* choose and assign SIs in the SG that dont have active assignment */
-  for (const auto _si : sg->list_of_si) {
-if ((i_si->saAmfSIAdminState == SA_AMF_ADMIN_UNLOCKED) &&
-(i_si->list_of_csi != nullptr) &&
-(i_si->si_dep_state != AVD_SI_SPONSOR_UNASSIGNED) &&
-(i_si->si_dep_state != AVD_SI_UNASSIGNING_DUE_TO_DEP) &&
-(i_si->si_dep_state != AVD_SI_READY_TO_UNASSIGN) &&
-(i_si->list_of_sisu == AVD_SU_SI_REL_NULL) &&
-(a_su->saAmfSUNumCurrActiveSIs < sg->saAmfSGMaxActiveSIsperSU)) {
-  /* found a SI that needs active assignment. */
-  if (avd_new_assgn_susi(cb, a_su, i_si, SA_AMF_HA_ACTIVE, false,
- _susi) == NCSCC_RC_SUCCESS) {
-l_flag = true;
-  } else {
-LOG_ER("%s:%u: %s", __FILE__, __LINE__, i_si->name.c_str());
-  }
+if (a_su->saAmfSuReadinessState != SA_AMF_READINESS_IN_SERVICE) {
+  TRACE("The current active SU is OOS so return");
+  goto done;
  }
+l_flag = avd_sg_2n_assign_si(cb, sg, a_su);
}
  
/* if any assignments have been done return the SU */



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


[devel] [PATCH 0/1] Review Request for scripts: use tipc instead of obsolute tipc-config in opensaf_reboot [#3066]

2019-08-08 Thread Vu Minh Nguyen
Summary: scripts: use tipc instead of obsolute tipc-config in opensaf_reboot 
[#3066]
Review request for Ticket(s): 3066
Peer Reviewer(s): Anders, Gary, Thang
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3066
Base revision: 6a330733244d0497fcc9524bfcae0bb523549e16
Personal repository: git://git.code.sf.net/u/winhvu/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 n
 Tests   n
 Other   y

NOTE: Patch(es) contain lines longer than 80 characers

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

revision 7b839ea48b0c48802a13ce2713b4b1daf9e274c0
Author: Vu Minh Nguyen 
Date:   Thu, 8 Aug 2019 11:45:41 +0700

scripts: use tipc instead of obsolute tipc-config in opensaf_reboot [#3066]



Complete diffstat:
--
 scripts/opensaf_reboot  | 11 ++-
 src/nid/configure_tipc.in   |  1 -
 tools/cluster_sim_uml/build_uml |  4 ++--
 3 files changed, 12 insertions(+), 4 deletions(-)


Testing Commands:
-
*** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES ***


Testing, Expected Results:
--
*** PASTE COMMAND OUTPUTS / TEST RESULTS ***


Conditions of Submission:
-
Ack from peer reviewers


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
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] imm: Fix Object ID and Class ID type inconsistency [#2770]

2019-08-08 Thread Thanh Nguyen
In IMM, for PBE, IMM uses the mix type of unsigned int
and signed int for Class ID and Object ID. These data are
stored in sqlite3 data base as 32-bit integers. Cast
is used when reading data back from sqlite3 data base.

Applying Google C++ Style Guide, Class ID and Object
ID are now signed int.

One minor code change in the affected area is implemented
to fix Static Code Checker error.
---
 src/imm/common/immpbe_dump.cc| 44 
 src/imm/common/immpbe_dump.h | 10 -
 src/imm/immpbed/immpbe.h |  2 +-
 src/imm/immpbed/immpbe_daemon.cc | 18 
 4 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/src/imm/common/immpbe_dump.cc b/src/imm/common/immpbe_dump.cc
index e6b3cc5..ee8950d 100644
--- a/src/imm/common/immpbe_dump.cc
+++ b/src/imm/common/immpbe_dump.cc
@@ -150,8 +150,8 @@ static const char *preparedSql[] = {
 static sqlite3_stmt *preparedStmt[SQL_STMT_SIZE] = {NULL};
 
 struct ObjectInfo {
-  unsigned obj_id;
-  unsigned class_id;
+  int obj_id;
+  int class_id;
   char *dn;
 };
 
@@ -569,8 +569,8 @@ void pbeAtomicSwitchFile(const char *filePath, std::string 
localTmpFilename) {
 // Reverse object DN and use the reverse DN as key in sReverseDnMap
 // which is used mainly to collect child objects when we perform cascade 
delete.
 static void reverseAndInsertDn(const std::string ,
-   unsigned obj_id,
-   unsigned class_id) {
+   int obj_id,
+   int class_id) {
   ObjectInfo *info = new ObjectInfo();
   osafassert(info);
 
@@ -596,8 +596,8 @@ static bool prepareLocalData(sqlite3 *dbHandle) {
   sqlite3_stmt *stmt = nullptr;
   int rc;
   bool ret = false;
-  unsigned obj_id;
-  unsigned class_id;
+  int obj_id;
+  int class_id;
   char *class_name;
   std::string dn;
   int count = 0;
@@ -611,7 +611,7 @@ static bool prepareLocalData(sqlite3 *dbHandle) {
   }
 
   while((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
-class_id = static_cast(sqlite3_column_int(stmt, 0));
+class_id = sqlite3_column_int(stmt, 0);
 class_name = const_cast(reinterpret_cast
(sqlite3_column_text(stmt, 1)));
 
@@ -707,7 +707,7 @@ static bool deleteObjectList(sqlite3 *dbHandle,
   sqlite3_stmt *stmt = nullptr;
   int rc = 0;
   bool ret = false;
-  unsigned object_id;
+  int object_id;
 
   TRACE_ENTER();
 
@@ -1225,7 +1225,7 @@ void pbeCleanTmpFiles(std::string localTmpFilename) {
 }
 
 ClassInfo *classToPBE(std::string classNameString, SaImmHandleT immHandle,
-  void *db_handle, unsigned int class_id) {
+  void *db_handle, int class_id) {
   SaImmClassCategoryT classCategory;
   SaImmAttrDefinitionT_2 **attrDefinitions;
   SaAisErrorT errorCode;
@@ -1563,7 +1563,7 @@ static ClassInfo *verifyClassPBE(std::string 
classNameString,
  void *db_handle, bool *badfile) {
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
   int rc = 0;
-  unsigned int class_id = 0;
+  int class_id = 0;
   ClassInfo *classInfo = NULL;
   sqlite3_stmt *stmt;
 
@@ -2479,9 +2479,9 @@ bailout:
 }
 
 int dumpInstancesOfClassToPBE(SaImmHandleT immHandle, ClassMap *classIdMap,
-  std::string className, unsigned int *objIdCount,
+  std::string className, int *objIdCount,
   void *db_handle) {
-  unsigned int obj_count = 0;
+  int obj_count = 0;
   SaImmSearchHandleT searchHandle;
   SaAisErrorT errorCode;
   SaNameT objectName;
@@ -2591,11 +2591,11 @@ bailout:
 }
 
 bool objectToPBE(std::string objectNameString, const SaImmAttrValuesT_2 
**attrs,
- ClassMap *classIdMap, void *db_handle, unsigned int object_id,
+ ClassMap *classIdMap, void *db_handle, int object_id,
  SaImmClassNameT className, SaUint64T ccb_id) {
   std::string valueString;
   std::string classNameString;
-  unsigned int class_id = 0;
+  int class_id = 0;
   ClassInfo *classInfo = NULL;
   int rc = 0;
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
@@ -2752,7 +2752,7 @@ bool dumpClassesToPbe(SaImmHandleT immHandle, ClassMap 
*classIdMap,
   std::list classNameList;
   std::list::iterator it;
   int rc = 0;
-  unsigned int class_id = 0;
+  int class_id = 0;
   char *execErr = NULL;
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
   TRACE_ENTER();
@@ -2847,13 +2847,13 @@ int verifyPbeState(SaImmHandleT immHandle, ClassMap 
*classIdMap,
   }
 
   if (nrows != 1) {
-LOG_ER("Expected 1 row got %u rows (line: %u)", nrows, __LINE__);
+LOG_ER("Expected 1 row got %d rows (line: %u)", nrows, __LINE__);
 badfile = true;
 goto bailout;
   }
 
-  obj_count = strtoul(result[ncols], NULL, 0);
-  TRACE("verifPbeState: obj_count:%u", obj_count);
+  obj_count = strtol(result[ncols], NULL, 0);
+  TRACE("verifPbeState: obj_count:%d", obj_count);
 
   rc = 

[devel] [PATCH 0/1] Review Request for imm: Fix Object ID and Class ID type inconsistency [#2770]

2019-08-08 Thread Thanh Nguyen
Summary: imm: Fix Object ID and Class ID type inconsistency [#2770]
Review request for Ticket(s): 2770
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2770
Base revision: 6a330733244d0497fcc9524bfcae0bb523549e16
Personal repository: git://git.code.sf.net/u/xdtthng/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 n
 Tests   n
 Other   n


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

revision f697ae3e82908632a8bb9265de345143927b5a4f
Author: Thanh Nguyen 
Date:   Fri, 9 Aug 2019 09:59:03 +1000

imm: Fix Object ID and Class ID type inconsistency [#2770]

In IMM, for PBE, IMM uses the mix type of unsigned int
and signed int for Class ID and Object ID. These data are
stored in sqlite3 data base as 32-bit integers. Cast
is used when reading data back from sqlite3 data base.

Applying Google C++ Style Guide, Class ID and Object
ID are now signed int.

One minor code change in the affected area is implemented
to fix Static Code Checker error.



Complete diffstat:
--
 src/imm/common/immpbe_dump.cc| 44 
 src/imm/common/immpbe_dump.h | 10 -
 src/imm/immpbed/immpbe.h |  2 +-
 src/imm/immpbed/immpbe_daemon.cc | 18 
 4 files changed, 36 insertions(+), 38 deletions(-)


Testing Commands:
-
*** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES ***


Testing, Expected Results:
--
*** PASTE COMMAND OUTPUTS / TEST RESULTS ***


Conditions of Submission:
-
*** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC ***


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
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 0/1] Review Request for imm: Fix Object ID and Class ID type inconsistency [#2770]

2019-08-08 Thread Thanh Nguyen
Summary: imm: Fix Object ID and Class ID type inconsistency [#2770]
Review request for Ticket(s): 2770
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2770
Base revision: 6a330733244d0497fcc9524bfcae0bb523549e16
Personal repository: git://git.code.sf.net/u/xdtthng/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 n
 Tests   n
 Other   n


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

revision f697ae3e82908632a8bb9265de345143927b5a4f
Author: Thanh Nguyen 
Date:   Fri, 9 Aug 2019 09:59:03 +1000

imm: Fix Object ID and Class ID type inconsistency [#2770]

In IMM, for PBE, IMM uses the mix type of unsigned int
and signed int for Class ID and Object ID. These data are
stored in sqlite3 data base as 32-bit integers. Cast
is used when reading data back from sqlite3 data base.

Applying Google C++ Style Guide, Class ID and Object
ID are now signed int.

One minor code change in the affected area is implemented
to fix Static Code Checker error.



Complete diffstat:
--
 src/imm/common/immpbe_dump.cc| 44 
 src/imm/common/immpbe_dump.h | 10 -
 src/imm/immpbed/immpbe.h |  2 +-
 src/imm/immpbed/immpbe_daemon.cc | 18 
 4 files changed, 36 insertions(+), 38 deletions(-)


Testing Commands:
-
*** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES ***


Testing, Expected Results:
--
*** PASTE COMMAND OUTPUTS / TEST RESULTS ***


Conditions of Submission:
-
*** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC ***


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
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] imm: Fix Object ID and Class ID type inconsistency [#2770]

2019-08-08 Thread Thanh Nguyen
In IMM, for PBE, IMM uses the mix type of unsigned int
and signed int for Class ID and Object ID. These data are
stored in sqlite3 data base as 32-bit integers. Cast
is used when reading data back from sqlite3 data base.

Applying Google C++ Style Guide, Class ID and Object
ID are now signed int.

One minor code change in the affected area is implemented
to fix Static Code Checker error.
---
 src/imm/common/immpbe_dump.cc| 44 
 src/imm/common/immpbe_dump.h | 10 -
 src/imm/immpbed/immpbe.h |  2 +-
 src/imm/immpbed/immpbe_daemon.cc | 18 
 4 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/src/imm/common/immpbe_dump.cc b/src/imm/common/immpbe_dump.cc
index e6b3cc5..ee8950d 100644
--- a/src/imm/common/immpbe_dump.cc
+++ b/src/imm/common/immpbe_dump.cc
@@ -150,8 +150,8 @@ static const char *preparedSql[] = {
 static sqlite3_stmt *preparedStmt[SQL_STMT_SIZE] = {NULL};
 
 struct ObjectInfo {
-  unsigned obj_id;
-  unsigned class_id;
+  int obj_id;
+  int class_id;
   char *dn;
 };
 
@@ -569,8 +569,8 @@ void pbeAtomicSwitchFile(const char *filePath, std::string 
localTmpFilename) {
 // Reverse object DN and use the reverse DN as key in sReverseDnMap
 // which is used mainly to collect child objects when we perform cascade 
delete.
 static void reverseAndInsertDn(const std::string ,
-   unsigned obj_id,
-   unsigned class_id) {
+   int obj_id,
+   int class_id) {
   ObjectInfo *info = new ObjectInfo();
   osafassert(info);
 
@@ -596,8 +596,8 @@ static bool prepareLocalData(sqlite3 *dbHandle) {
   sqlite3_stmt *stmt = nullptr;
   int rc;
   bool ret = false;
-  unsigned obj_id;
-  unsigned class_id;
+  int obj_id;
+  int class_id;
   char *class_name;
   std::string dn;
   int count = 0;
@@ -611,7 +611,7 @@ static bool prepareLocalData(sqlite3 *dbHandle) {
   }
 
   while((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
-class_id = static_cast(sqlite3_column_int(stmt, 0));
+class_id = sqlite3_column_int(stmt, 0);
 class_name = const_cast(reinterpret_cast
(sqlite3_column_text(stmt, 1)));
 
@@ -707,7 +707,7 @@ static bool deleteObjectList(sqlite3 *dbHandle,
   sqlite3_stmt *stmt = nullptr;
   int rc = 0;
   bool ret = false;
-  unsigned object_id;
+  int object_id;
 
   TRACE_ENTER();
 
@@ -1225,7 +1225,7 @@ void pbeCleanTmpFiles(std::string localTmpFilename) {
 }
 
 ClassInfo *classToPBE(std::string classNameString, SaImmHandleT immHandle,
-  void *db_handle, unsigned int class_id) {
+  void *db_handle, int class_id) {
   SaImmClassCategoryT classCategory;
   SaImmAttrDefinitionT_2 **attrDefinitions;
   SaAisErrorT errorCode;
@@ -1563,7 +1563,7 @@ static ClassInfo *verifyClassPBE(std::string 
classNameString,
  void *db_handle, bool *badfile) {
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
   int rc = 0;
-  unsigned int class_id = 0;
+  int class_id = 0;
   ClassInfo *classInfo = NULL;
   sqlite3_stmt *stmt;
 
@@ -2479,9 +2479,9 @@ bailout:
 }
 
 int dumpInstancesOfClassToPBE(SaImmHandleT immHandle, ClassMap *classIdMap,
-  std::string className, unsigned int *objIdCount,
+  std::string className, int *objIdCount,
   void *db_handle) {
-  unsigned int obj_count = 0;
+  int obj_count = 0;
   SaImmSearchHandleT searchHandle;
   SaAisErrorT errorCode;
   SaNameT objectName;
@@ -2591,11 +2591,11 @@ bailout:
 }
 
 bool objectToPBE(std::string objectNameString, const SaImmAttrValuesT_2 
**attrs,
- ClassMap *classIdMap, void *db_handle, unsigned int object_id,
+ ClassMap *classIdMap, void *db_handle, int object_id,
  SaImmClassNameT className, SaUint64T ccb_id) {
   std::string valueString;
   std::string classNameString;
-  unsigned int class_id = 0;
+  int class_id = 0;
   ClassInfo *classInfo = NULL;
   int rc = 0;
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
@@ -2752,7 +2752,7 @@ bool dumpClassesToPbe(SaImmHandleT immHandle, ClassMap 
*classIdMap,
   std::list classNameList;
   std::list::iterator it;
   int rc = 0;
-  unsigned int class_id = 0;
+  int class_id = 0;
   char *execErr = NULL;
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
   TRACE_ENTER();
@@ -2847,13 +2847,13 @@ int verifyPbeState(SaImmHandleT immHandle, ClassMap 
*classIdMap,
   }
 
   if (nrows != 1) {
-LOG_ER("Expected 1 row got %u rows (line: %u)", nrows, __LINE__);
+LOG_ER("Expected 1 row got %d rows (line: %u)", nrows, __LINE__);
 badfile = true;
 goto bailout;
   }
 
-  obj_count = strtoul(result[ncols], NULL, 0);
-  TRACE("verifPbeState: obj_count:%u", obj_count);
+  obj_count = strtol(result[ncols], NULL, 0);
+  TRACE("verifPbeState: obj_count:%d", obj_count);
 
   rc =