Remove requirement to have strong reachability to remote server
If remote server was selected as reference, it can be used as time source, so there are no big problem if it flaps. Change-Id: I01fa7acde7c9cd97245e8b2bf8ca31f3c62d6479 Related-Bug: #1656020
This commit is contained in:
parent
236a605026
commit
4da6c0c111
|
@ -119,7 +119,7 @@ class BaseNtp(AbstractNtp):
|
|||
for peer in peers:
|
||||
p = peer.split()
|
||||
remote = str(p[0])
|
||||
reach = int(p[6], 8) # From octal to int
|
||||
# reach = int(p[6], 8) # From octal to int
|
||||
offset = float(p[8])
|
||||
jitter = float(p[9])
|
||||
|
||||
|
@ -134,8 +134,12 @@ class BaseNtp(AbstractNtp):
|
|||
|
||||
# 3. reachability bit array should have '1' at least in
|
||||
# two lower bits as the last two successful checks
|
||||
if reach & 3 != 3:
|
||||
continue
|
||||
# TODO(sbog): we should improve this, as unstable reference
|
||||
# is still a reference and can be used for time sync. Moreover,
|
||||
# if there are other servers which can easily be a reference
|
||||
# one, that reachability of current one is not a problem at all.
|
||||
# if reach & 3 != 3:
|
||||
# continue
|
||||
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -155,7 +155,7 @@ class TestNtpInitscript(NtpTestCase):
|
|||
ntp_init = ntp.NtpInitscript(self.remote_mock, 'node')
|
||||
assert ntp_init._get_sync_complete() is True
|
||||
|
||||
def test_get_sync_complete_false(self):
|
||||
def test_get_sync_complete_with_unstable_peer(self):
|
||||
self.remote_mock.execute.side_effect = (
|
||||
self.make_exec_result('/etc/init.d/ntp'),
|
||||
self.make_exec_result("""\
|
||||
|
@ -169,7 +169,7 @@ class TestNtpInitscript(NtpTestCase):
|
|||
"""))
|
||||
|
||||
ntp_init = ntp.NtpInitscript(self.remote_mock, 'node')
|
||||
assert ntp_init._get_sync_complete() is False
|
||||
assert ntp_init._get_sync_complete() is True
|
||||
|
||||
def test_wait_peer(self):
|
||||
ntp_init = ntp.NtpInitscript(self.remote_mock, 'node')
|
||||
|
|
Loading…
Reference in New Issue