Fix timesync behaviour with new ntp.conf defaults
- use "ntpd -gq" instead of "ntpdate" - as consequence - get rid of parsing ntp.conf for peer addresses Change-Id: I9393f8d89c9e4545f7b73e873ad8fb8cb77a26b6 Closes-Bug:#1660358
This commit is contained in:
parent
26dfdc686c
commit
a8e22388ed
|
@ -96,12 +96,9 @@ class BaseNtp(AbstractNtp):
|
|||
"""
|
||||
|
||||
def set_actual_time(self, timeout=600):
|
||||
# Get IP of a server from which the time will be synchronized.
|
||||
srv_cmd = "awk '/^server/ && $2 !~ /^127\./ {print $2}' /etc/ntp.conf"
|
||||
server = self.remote.execute(srv_cmd)['stdout'][0]
|
||||
|
||||
# Waiting for parent server until it starts providing the time
|
||||
set_date_cmd = "ntpdate -p 4 -t 0.2 -bu {0}".format(server)
|
||||
set_date_cmd = "ntpd -gq"
|
||||
helpers.wait(
|
||||
lambda: not self.remote.execute(set_date_cmd)['exit_code'],
|
||||
timeout=timeout,
|
||||
|
@ -276,15 +273,13 @@ class GroupNtpSync(object):
|
|||
def __exit__(self, exp_type, exp_value, traceback):
|
||||
pass
|
||||
|
||||
def add_node(self, remote, node_name):
|
||||
group = 'other'
|
||||
def add_node(self, remote, node_name, group='other'):
|
||||
ntp = self.get_ntp(remote, node_name)
|
||||
|
||||
if node_name == 'admin':
|
||||
group = 'admin'
|
||||
ntp = self.get_ntp(remote, 'admin')
|
||||
else:
|
||||
ntp = self.get_ntp(remote, node_name)
|
||||
if isinstance(ntp, NtpPacemaker):
|
||||
group = 'pacemaker'
|
||||
elif isinstance(ntp, NtpPacemaker):
|
||||
group = 'pacemaker'
|
||||
|
||||
self.ntp_groups[group].append(ntp)
|
||||
|
||||
|
|
|
@ -134,9 +134,7 @@ class TestNtpInitscript(NtpTestCase):
|
|||
self.remote_mock.execute.assert_has_calls((
|
||||
mock.call(
|
||||
"find /etc/init.d/ -regex '/etc/init.d/ntp.?' -executable"),
|
||||
mock.call("awk '/^server/ && $2 !~ /^127\./ {print $2}' "
|
||||
"/etc/ntp.conf"),
|
||||
mock.call('ntpdate -p 4 -t 0.2 -bu server1.com'),
|
||||
mock.call('ntpd -gq'),
|
||||
))
|
||||
|
||||
self.remote_mock.check_call.assert_called_once_with('hwclock -w')
|
||||
|
|
Loading…
Reference in New Issue