FM sends alarm information for SNMP trap but it is lacking
Alarm UUID, which needs to identify the alarm.
This fix is adding uuid for all type of trap information.
Closes-bug: 1971626
TEST PLAN:
PASS: Confirm UUID is included in trap information
in log /var/log/fm-manager.log.
[Trap type]
- wrsAlarmCritical
- wrsAlarmMajor
- wrsAlarmMinor
- wrsAlarmWarning
- wrsAlarmMessage
- wrsAlarmClear
- wrsAlarmHierarchicalClear
Signed-off-by: Takamasa Takenaka <takamasa.takenaka@windriver.com>
Change-Id: I3e2b7e4a6a07876ff08e6a13d46d50285465a6b2
Keep the same binary location as on CentOS.
An fm component was updated to produce binaries to correct location,
but fm-common component was missed. Alarms could not be raised by sm.
Tests:
PASS: bootstrap
PASS: unlock
PASS: alarms are raised by sm
Story: 2009101
Task: 44321
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I56eb2a5cd69c643d477fba20a7344cd51be5444d
This commit complements the previous commit with
same topic:
https://review.opendev.org/c/starlingx/fault/+/815381
This particular commit improves the log inside the
python script, considering others possible fails.
Also, some verifications are added in fmDbUtils class
wich calls the script.
Test Plan:
Log in (/var/log/platform.log):
PASS: Log arguments error calling script.
PASS: Log new database connection problems.
PASS: Log Session commit problems.
PASS: Log problems opening "/etc/fm/events.yaml" file.
Log (in /var/log/fm-manager.log):
PASS: Log Problems opening fm_db_sync_event_suppression.py file.
PASS: Log problems running fm_db_sync_event_suppression.py.
PASS: build and install package.
Closes-bug: 1932324
Signed-off-by: fperez <fabrizio.perez@windriver.com>
Change-Id: I913d6d1282bea346f87f73179f0738c0c17d7446
Currently the log is written to syslog, which in turn uses a
socket /dev/log from the platform, but when running in a container
such as in the stx-openstack application this log handler is not
available.
This commit uses an environment variable to be set on the
fm-rest-api deployment definition to determine if it must the syslog
handler, which is the case when running on the platform, or write the
log to standard output, which is the case when running inside a
container.
Closes-Bug: 1951579
Signed-off-by: Heitor Matsui <HeitorVieira.Matsui@windriver.com>
Change-Id: I3f2fe2953fb26ad1759f3bc10a358cb9d093192f
A commit introducing a new file broke the debian build, complaining the
file is not installed.
Add to .install, so it is packaged.
Depends-On: https://review.opendev.org/c/starlingx/fault/+/815381
Story: 2009101
Task: 43090
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I4e0652918d7db251b54ede75cfac83d4b18c6ec4
Fix lintian error when building Debian package.
Story: 2009101
Task: 43090
Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I16fabf0b1ca86484ba525461ed2aa0cd53e27ac7
This commit changes the log when FmManager
calls fm_db_sync_event_suppression.py python script.
The logInfo function is not used anymore to write
on /var/log/platform.log. Instead, fm_log.py is used.
This solves the permissions issues between the python
script and platform.log
Besides, others possible fails are logged.
Test Plan:
PASS: Log on platform.log from the python script.
PASS: Log differents log levels.
PASS: Log arguments error.
PASS: Log database connection problems.
PASS: build and install rpm package
Closes-bug: 1932324
Signed-off-by: fperez <fabrizio.perez@windriver.com>
Change-Id: I07c6340e7e9b61fc0f8f8d62e5d5cd7565f265cd
Convert fm-common to use the new debian packaging infrastructure.
Story: 2009101
Task: 43090
Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I4c53d8b446504a4ef7ac407fa063f6a328e1dc3d
Debian point release 11.1 was done over the weekend which caused
fm-common's Makefile to only detect python2.7 rather than python3.9.
Make sure we are only detecting the os release and not the version
number.
Task: 2009101
Story: 43601
Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I387b0a5436048dc13576d658aa34b5b0db5271ac
PyString_FromString has been removed from python3.9,
use PyUnicode_FromString instead since its backwards
compatible with python2.7.
Story: 2009101
Task: 43219
Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I9535e0f36d56dd5ae15c1ffea27fdf0877de0484
Add support for Debian bullseye and python3.9 support.
Tested by compiling on both Centos7 and Debian bullseye.
Story: 2009101
Task: 43052
Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I91e40dbe4df6ca0ed7951d47733ebf34856ae3ac
1. change python2 rpms to python3 version.
2. update Cpython code to use new API in python3
Test:
Could pass rpm package build for fm-common
Story: 2007065
Task: 37942
Change-Id: Ie0490118bcc891c2e994b3eeb6efab24ac7951cb
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
(cherry picked from commit a2af71b867)
According with python 3 migration rules:
PyMODINIT_FUNC init<yourmodulename>(void)
has changed to below in Python 3:
PyMODINIT_FUNC PyInit_<yourmodulename>(void)
otherwise there is below issue:
CRITICAL sysinv [-] Unhandled error: ImportError: dynamic module does not define module export function (PyInit_fm_core)
ERROR sysinv Traceback (most recent call last):
ERROR sysinv File "/usr/bin/sysinv-puppet", line 10, in <module>
Story: 2008454
Task: 41440
Signed-off-by: Haiqing Bai <haiqing.bai@windriver.com>
Change-Id: Id51da7f328b41ec389cf2e073db7ff6617398339
(cherry picked from commit cd1487e1a5)
Fixed a typo for accessing a configuration resource.
Fixed a python3 script called by fmManager on initialization. It was
modifying a dictionary while parsing it using an iterator, which doesn't
guarantee all initial elements are visited. The fm database
event_suppression table was left in a bad state, thus alarm list and
alarm summary were empty.
Tests:
- build and deploy from iso
- tested with the fm_api_test.py provided in the repo
- tested some of the commands by raising a config out of date and
targeting the raised alarm
- fm alarm-list, alarm-delete, alarm-show, alarm-summary, event-list,
event-show, event-suppress-list, event-suppress, event-unsuppress,
event-unsuppress-all produce relevant output
Story: 2008454
Task: 42632
Depends-On: I2d0f4c2c85ea8057258d56632a102b2eac7db388
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: Ib3d5276c4a669a3f3f123470c31edf7a07751eaa
(cherry picked from commit c18a7865c6)
Fix compilation error on python2.
Story: 2006796
Task: 42877
Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I55de8687ed3ea844a2099974a1845f6326b77a5a
(cherry picked from commit 085feb6096)
python 2.7 zuul jobs such as py27 and pylint could fail
when trying to import bandit using the new pip
since bandit 1.7 was released Dec 12 and is python3 only.
The cpp file header was only changed in this review to
trigger the appropriate zuul jobs.
Partial-Bug: #1907678
Change-Id: Idb1e97d16773d36027d29f4eb100d8b453a8069f
Signed-off-by: albailey <Al.Bailey@windriver.com>
Now a service outside of Fault is in charge
of trap generation, this new service manages
the SNMP configuration trap destinations,
communities, users etc.
For this reason the code that reads and stores
the SNMP configuration from fm.conf is removed.
Story: 2008132
Task: 41419
Depends-On: https://review.opendev.org/765381
Change-Id: If27f4f04f9dfc37e7404d593e3b337cbbb361552
Signed-off-by: Pablo Bovina <pablo.bovina@windriver.com>
In the current implementation "Fault" is responsible
for the generation and dispatch of traps.
This logic is removed from it, leaving only the
responsibility of sending the metadata of a trap
to a service dedicated to generating and sending them.
The fm.conf file will contain the IP and port values
of the service.
Story: 2008132
Task: 40867
Depends-On: https://review.opendev.org/761217
Change-Id: I575dfa2329f11821404ca4cb1d539e5189444b4e
Signed-off-by: Pablo Bovina <pablo.bovina@windriver.com>
Checks for key, will not log to /var/log/fm-manager.log
if key is password or connection, these fields contain
sensitive information.
Partial-Bug: 1896116
Change-Id: Ide879ecf3b81133c26f20b0854e796998429f279
Signed-off-by: Lu Yao Chen <luyao.chen@windriver.com>
This update changed the TIS_PATCH_VER to use the PKG_GITREVCOUNT
variable to auto-version the packages.
Adds an upper constraint to fm-rest-api to pass zuul.
Story: 2006740
Task: 39842
Change-Id: I4a180f1395ff9764ecc9d617a514e265db670b9c
Signed-off-by: Teresa Ho <teresa.ho@windriver.com>
1. Rename Titanium Cloud to StarlingX for .spec files
2. Rename Titanium Cloud to StarlingX for .service file
Test:
After the de-brand change, bootimage.iso has built in the flock layer
and installed on the dev machine to validate the changes.
Please note, doing de-brand changes in batches, this is batch2 changes.
Change-Id: I63ab8cda38c45240198f37d1f30c95e0b02da3e1
Story: 2006387
Task: 36204
Signed-off-by: Sharath Kumar K <sharath.kumar@intel.com>
These files are part of OBS infrastructure and shouldn't be part of
this repository.
Story: 2006508
Task: 36862
Change-Id: I8cc056a49a888352d8dbb03b2a55e86549e6a45a
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
All opensuse version are being standardize with the same format,
this requires that all components will change from 1.0 to 1.0.0.
Story: 2006508
Task: 36811
Change-Id: I301759895e4ed816633daa6595d5f60f2f1d59c7
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
The rpmlintrc files helps to configure the behavior of the rpm linter
executed by the opensuse build system. This patch adds the rpmlintrc
files that were defined in the opensuse build system.
Story: 2006508
Task: 36799
Change-Id: If75264e809bb78bbcff1dd474b1a5fc1819ac193
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
As the tarballs are now created by the _service definition in the
opensuse build system, it requires now to include the specfiles
within the tarballs. This means that the `-n` option needs to be
set for `%autosetup`.
Story: 2006508
Task: 36780
Change-Id: Ib89a440d4911200ead2a3a35d731564e86b0b447
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
Indentation issues were solve for `fmConfig.cpp`. The cpplint
command below doesn't show issues.
$ cpplint \
--filter=-readability/casting,-runtime/references \
fmConfig.cpp
The filtered out checks may introduce functionality changes so those
weren't fixed in this patch but planned for later phase.
Story: 2006425
Task: 36735
Change-Id: Icbc9dd26a3f0cb0ee4e16bba715fa0e57ab4b61f
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
In the opensuse build system (OBS) the `_service` files are being
standardized to generate tarballs with gz compression. The fault's
specfiles were created before this decision, therefore an update
in the extension is required.
Story: 2006508
Task: 36670
Change-Id: I96cb185a9a0e089e4f8e184e8fdeaa709f77915e
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
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>
Several indentation issues were solved, also some style was applied
to improve code's readability.
No functionality changes were done.
Story: 2006425
Task: 36322
Change-Id: I908ce18cb68ddcb96239866e720a82757a058691
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
Several indentation issues were solved, also some style was applied
to improve code's readability.
No funcionality changes were done.
Story: 2006425
Task: 36322
Change-Id: Ie3339ed10254a053a2e26397337c45dfa2d552bd
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
The Customer Log Table was removed in a prior change and the customer
log MIB object identifiers are no longer available. This change replaces
the customer log identifiers with the event identifiers.
Change-Id: Ia8a9c5250744f4206d57c309d26c9398ff01fcba
Closes-Bug: 1828453
Signed-off-by: David Sullivan <david.sullivan@windriver.com>
This commit adds the RPM specfile that supports openSUSE, these
include the _service file which creates the tarball, the changes
files and specfile itself.
These are all built via the OpenBuildService (OBS) and can be
found here:
https://build.opensuse.org/project/show/Cloud:StarlingX:2.0
Change-Id: I676aae8cb9554eab2740232fd0dd77e0ed876506
Signed-off-by: Saul Wold <sgw@linux.intel.com>
The dependency resolver for RPM relies on the shebang to have the
interperter that will be used in order to get things right, so
change shebang to /usr/bin/python.
In other cases, the shebang is not needed at all as these are not
really executable python files, they are part of the python package.
RPMLINT finds these and complains that a non-executable has a shebang.
Change-Id: Ie90a846d6addffca1225e59fd8b6f3753d2991a4
Signed-off-by: Saul Wold <sgw@linux.intel.com>
The Maintainer was change from a proper name to the StarlingX
project as it can be confusing the responsibilities of the person.
Change-Id: I32faf658388bc38e248362c71589f70f8f22ad4d
Story:2004792
Signed-off-by: Marcela Rosales <marcela.a.rosales.jimenez@intel.com>
This fixes two issues
-Alarm clear time incorrectly reported on non-UTC systems.
-Paused instances do not display the correct alarm timestamp in
non-UTC systems.
The mktime call that's made in fm_db_util_get_timestamp uses the local
tz in it's calculation. It assumes the incoming time is also in the
local time. When mktime is provided with a value in UTC we see the error
presented in this bug.
Change-Id: Iaf8d097e2dfdfae585b6976e02a85b9e2f1b19f9
Closes-Bug: 1828448
Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
These functions do a number of things, specifically they handles the
DevStack USE_PYTHON3 switch transparently so we can run both major
Python versions.
The new setup.cfg files are only used by setup_*() right now, making
the switch to use pbr is beyond what I want to do here.
Change-Id: Ib9753119235b1ce23030a2b3de0169ed6f8819e0
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
not found
For the all 6 APIs in FaultAPIsV2, will treat alarm non-exist as normal
case, and exception will not be raised. Exception is raised only if
there is operation failure, such as fmclient fail to connect fmManager,
failure in memory allocation, failure in internal structure parse, etc.
Test:
Run each 6 APIs from FaultAPIs and FaultAPIsV2 with below case:
1. with correct alarm id
2. with wrong alarm id
3. with fmManager cannot be connected (Modify fmManager listen port to
simulate it)
Confirm FaultAPIs's behavior is not changed.
And FaultAPIsV2 raises exception for operation failure only.
Check Events Suppression function in horizon GUI, it works correctly.
Closes-Bug: 1821112
Change-Id: I8ba122b19964613d90e9d0bf4a25134ff60e5c19
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Current FaultAPIs (get_fault/get_faults/get_faults_by_id) cannot
distinguish error and no data case. None will be returned for both
case. To separate these two cases, and implement the code more as
pythonic way, FaultAPIsV2 is added, which will raise exception for
error case.
In order to separate the cases, the C functions called by API are
modified to return FALSE for error, and return None for no data.
Test:
Pass basic deploy test, and "fm alarm-*" cmd work as before.
Use fm_api_test.py/fm_api_v2_test.py to manual trigger API call,
confirm alarm could be created/get/deleted, and value is the same
as "fm alarm-list".
Modify fmManager to simulate error case, confirm exception is
generated for FaultAPIsV2, and behavior is not changed for
FaultAPIs.
Story: 2004859
Task: 29097
Change-Id: Ic1c0a15eb8dfec6c368099b096d6a158da0d3c77
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
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>
This patch adds compiler flags to improve the security of STX code.
Flags added:
Format string vulnerabilities: CFLAGS="-Wformat -Wformat-security"
Compiler will treat string format warnings as errors,
so at compiling level, buffer overflow is avoided.
Story: 2004380
Task: 28806
Signed-off-by: Luis Botello <luis.botello.ortega@intel.com>
Reviewed-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
Victor Rodriguez <vm.rod25@gmail.com>
Sugested-by: Victor Rodriguez <vm.rod25@gmail.com>
Erich Cordoba <erich.cordoba.malibran@intel.com>
Change-Id: Ia1ffaf18e7050d9099b80f9023b2bf255b4750fa
The `install_non_bb` target was changed to `install`, also some
variable names in the Makefile and spec file were changed. There
was a hardcoded path in fmConstants.h and that was updated as well.
Story: 2004043
Task: 27543
Change-Id: I431b733030444185cc51a8b5352492926170a4c3
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
in function fm_db_util_get_timestamp()
172: char *tstr = strdup(str);
memory obtained from strdup() is done dynamically using malloc().
it should be freed when tstr is no longer in use.
test case:
1. one controller + one compute deploy (virtual)
success to deploy and create an instance.
Closes-Bug: 1794705
Change-Id: I0d0c1e6e4386128d6cb38741d80af22a5f10b770
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
This update adds hooks to the spec files for the following packages
to generate wheels for the python modules:
- fm-api
- fm-common
- fm-rest-api
- python-fmclient
Change-Id: I0542650b52b9c5b0627023a2ce1996176135411d
Story: 2003907
Task: 27525
Signed-off-by: Don Penney <don.penney@windriver.com>
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>
Specifically get the psql include path from pg_config as libpq-fe.h
is in different places on RHEL-based and Debian-based systems.
Also add -f to symlink command in install because we can't assume
DEST_DIR is empty.
This is in support of Austin's DevStack wirk in stx-config started
in https://review.openstack.org/#/c/586443/, in my case because all of
my DevStack VMs run Ubuntu xenial.
Needed-by: https://review.openstack.org/595865
Change-Id: I8db0579225487e6b31fe8a5ed88a29820bda7d69
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
As C++ references cannot be NULL, new compilers optimizes the code
assuming this condition. Therefore, in new compilers, from GCC 6 to
8 the fn_snmp_util_gen_trap will segfault trying to deference
data.entity_instance_id as the if (&data != NULL) will be always
optimized to be true.
Turns out that the case where SFmAlarmDataT is expected to be NULL
(or empty) is when the alarm type is WARM_START. So changing the if
statement to look for WARM_START instead of checking the null reference
seems to be a feasible solution.
Story: 2003498
Task: 24775
Change-Id: Ica07ec8d7ad009e1048f014b0a6440c76de09eef
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>