Skip to content

Commit f2c79cd

Browse files
Handle chronyd restarting when disabled
1 parent 3fc3cc3 commit f2c79cd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

addons/generic/ntpfailover.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const (
4646
)
4747

4848
var (
49-
ts2phcOffsetRegex = regexp.MustCompile("offset .*s[23] freq")
49+
ts2phcOffsetRegex = regexp.MustCompile("offset .*s[23] freq")
50+
chronydOnlineRegex = regexp.MustCompile("chronyd .* starting")
5051
)
5152

5253
func onPTPConfigChangeNtpFailover(data *interface{}, nodeProfile *ptpv1.PtpProfile) error {
@@ -167,6 +168,12 @@ func processLogNtpFailover(data *interface{}, pname string, log string) string {
167168
continue
168169
}
169170
}
171+
if pname == chronydPname && chronydOnlineRegex.MatchString(log) {
172+
chronydSetEnabled, ok := pluginData.cmdSetEnabled[chronydPname]
173+
if ok {
174+
chronydSetEnabled(false)
175+
}
176+
}
170177
break done
171178
case pcsmsOutOfSpec:
172179
if pname == ts2phcPname {

0 commit comments

Comments
 (0)