Add ptp no-lock alarm support for controllers

The current PTP No-Lock alarm is not raised for
controllers that assume Grandmastership.

This is incorrect behavior. Every node configured
for PTP needs to be locked to a remote Grandmaster.

This update increases the scope of the no lock alarm
to apply to all node types ; computes, storage and
now controllers as well.

Test Plan:

PASS: Verify PTP no lock alarm for controller.

Change-Id: I271c8ad235e6cb680bdb27f377149b7e1a3d14cd
Closes-Bug: 1850554
Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com>
This commit is contained in:
Eric MacDonald 2019-10-29 17:17:29 -04:00
parent 5df0fd26e6
commit d12b1a9e70
1 changed files with 14 additions and 31 deletions

View File

@ -857,40 +857,23 @@ def read_func():
# Handle case where this host is the Grand Master
# ... or assumes it is.
if my_identity == gm_identity or port_locked is False:
if ctrl.nolock_alarm_object.raised is False:
if raise_alarm(ALARM_CAUSE__NO_LOCK, None, 0) is True:
ctrl.nolock_alarm_object.raised = True
if obj.controller is False:
# produce a throttled log while this host is not locked to the GM
if not (obj.log_throttle_count % obj.INIT_LOG_THROTTLE):
collectd.info("%s %s not locked to remote Grand Master "
"(%s)" % (PLUGIN, obj.hostname, gm_identity))
obj.log_throttle_count += 1
# Compute and storage nodes should not be the Grand Master
if ctrl.nolock_alarm_object.raised is False:
if raise_alarm(ALARM_CAUSE__NO_LOCK, None, 0) is True:
ctrl.nolock_alarm_object.raised = True
# No samples if we are not locked to a Grand Master
return 0
# produce a throttled log while this host is not locked to the GM
if not (obj.log_throttle_count % obj.INIT_LOG_THROTTLE):
collectd.info("%s %s not locked to remote Grand Master "
"(%s)" % (PLUGIN, obj.hostname, gm_identity))
obj.log_throttle_count += 1
# No samples for storage and compute nodes that are not
# locked to a Grand Master
return 0
else:
# Controllers can be a Grand Master ; throttle the log
if not (obj.log_throttle_count % obj.INIT_LOG_THROTTLE):
collectd.info("%s %s is Grand Master:%s" %
(PLUGIN, obj.hostname, gm_identity))
obj.log_throttle_count += 1
# The Grand Master will always be 0 so there is no point
# creating a sample for it.
return 0
# Handle clearing nolock alarm for computes and storage nodes
elif obj.controller is False:
if ctrl.nolock_alarm_object.raised is True:
if clear_alarm(ctrl.nolock_alarm_object.eid) is True:
ctrl.nolock_alarm_object.raised = False
# Handle clearing nolock alarm
elif ctrl.nolock_alarm_object.raised is True:
if clear_alarm(ctrl.nolock_alarm_object.eid) is True:
ctrl.nolock_alarm_object.raised = False
# Keep this FIT test code but make it commented out for security
# if os.path.exists('/var/run/fit/ptp_data'):