From 4efcb548dbe7257a5ad22fc1903c555fc47f3a6b Mon Sep 17 00:00:00 2001 From: Cole Walker Date: Mon, 28 Nov 2022 15:44:21 -0500 Subject: [PATCH] [PTP] Skip checking clock instance for ptp-lock When no ts2phc instance is configured on a node, collectd incorrectly tries to check 'clock' type instances for a PTP lock state. The 'clock' instance type does not contain ptp4l configuration info and should not be part of this check. This was resulting in an incorrect 'ptp no-lock' alarm being raised. Updated the logic for calling check_ptp_regular() so that 'clock' instances are excluded. Test plan: PASS: Configure system with clock instance and no ts2phc instance, verify alarm is not raised. PASS: Configure system with clock and ts2phc instances and verify that normal behaviour is unaffected. Closes-bug: 1998132 Signed-off-by: Cole Walker Change-Id: Id3941ed2079478e9c1241cf613d3fa3486e653c0 --- collectd-extensions/src/ptp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collectd-extensions/src/ptp.py b/collectd-extensions/src/ptp.py index 215bde0..a001f88 100755 --- a/collectd-extensions/src/ptp.py +++ b/collectd-extensions/src/ptp.py @@ -1414,7 +1414,7 @@ def read_func(): ctrl.phase = RUN_PHASE__SAMPLING ctrl.log_throttle_count = 0 - if not obj.capabilities['primary_nic']: + if not obj.capabilities['primary_nic'] and ctrl.instance_type != PTP_INSTANCE_TYPE_CLOCK: # Non-synce PTP check_ptp_regular(instance, ctrl, conf_file) elif (ptpinstances[instance].instance_type in