Collectd runs all its python plugins concurrently.
With the expansion of collectd python plugins due
to the obsolesence of rmon collectd core dumps are
being reported during collectd startup when the FM
service on the controller is not running.
Debug of the issue revealed that the core dumps are
due to having no mutex around FM API's shared data.
The required mutex is provided by this update by
adding a while locked expression to the start of
each API.
Also fixed 3 pep8 errors.
Closes-Bug: 1819473
Test Plan:
PASS: Test before and after cases to confirm that without
the change we see core dumps but with the change the
API and collectd plugin behavior is correct without
the core dumps.
PASS: System install with current collectd plugins and fm's
python API enhanced with locking.
PASS: Have sm stop managing the fmManager process, kill it
and then restart collectd over and over.
Should not see any collectd core dumps.
PASS: Verify nfv alarming still works
Change-Id: I3d5ef0bd9cb774299b4c0f3b9e33cddb7c0f776c
Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com>