Commit Graph

6 Commits

Author SHA1 Message Date
Erich Cordoba c905ae2c55 Fix indentation and style issues in fmAlarmUtils
Several indentation issues were solved, also some style was applied
to improve code's readability.

cpplint is being used to get all these warnings, however there are
some warnings that were suppressed. This means that this file still
has the following issues:

- line length > 80 characters
- C casting in C++ code
- References that can be const or pointers

These issues will be solved in a next iteration as are more intrusive
with the code.

No functionality changes were done.

Story: 2006425
Task: 36322

Change-Id: I4a2d3bcf9a13e0ce2659cc9a8211fc727b34d80e
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
2019-09-17 00:22:37 -05:00
Shuicheng Lin 6493976162 fix issue: fmClient segfaults on short string parameter
It is due to out of range access violation. Fix it by checking length
before access.

Closes-Bug: 1807986

Change-Id: Iba2b445f50fd98a74d932c9b3f691fc7145274bb
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
2019-01-29 02:25:12 +08:00
SidneyAn 816f45e94d replace strncpy by snprintf
as for strncpy does not guarantee null terminated of dest string,
but snprintf does.

so change code from
    strncpy(buffer, source, sizeof buffer);
  to
    int n = snprintf(buffer, sizeof buffer, "%s", source);
    assert(n >= 0 && n < sizeof buffer);

test case:
  1. a simple test about difference between strncpy and snprintf
  2. use fmClientCli to create an alarm
     mock the init_tables() function so there is no need to
connect to the server.
     add code to dump SFmAlarmDataT to check datas return.
  3. one controller + one compute deploy (virtual)
     success deploy and create an instance.

Closes-Bug: 1794701

Change-Id: I04b4c5c85782ff571e2957e12c47f2f628d2b772
2018-11-03 00:56:57 +08:00
Erich Cordoba 586369fa6d Fix truncate string on STRCP_TO macro.
The macro STRCP_TO copies a c_str into a char buffer, it won't
copy more that sizeof(charb), however, the resulting string will
be truncated. Although this is expected, the resulting string
won't have a NULL terminator.

Story: 2003497
Task: 24774

Change-Id: I249c75af897ba02837ad6d3981d976c291e88aea
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
2018-08-27 10:42:39 -05:00
Tao Liu c8159ea6cb Decouple Fault Management from stx-config
Create fault management REST API service
Create fault management client and CLI shell
Add a python extension for fault management application APIs
Update fault management python APIs to use the python extension
Update fault manager to retrieve the SNMP configuration from the config file

Story: 2002828
Task: 22747

Depends-On: https://review.openstack.org/#/c/592176/
Change-Id: I888d8d23edf75d05d51594ccca55570ae366c848
Signed-off-by: Tao Liu <tao.liu@windriver.com>
2018-08-16 13:23:33 -04:00
Dean Troyer 6cd8940170 StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-05-31 07:36:00 -07:00