Don't use 'updated_at' to check service's status
Commit b9bae02af2 introduced
'last_seen_up' to check service in Liberty. Nova use 'updated_at'
to check that before Liberty. So we can remove legacy item now.
Note: 'last_seen_up' may be null at the beginning. so we still
need 'created_at' in this case.
Change-Id: I5a273c294341027fba66a54a540182fc890522db
This commit is contained in:
committed by
Stephen Finucane
parent
14a9462504
commit
594b1b1520
@@ -57,10 +57,8 @@ class DbDriver(base.Driver):
|
|||||||
"""Moved from nova.utils
|
"""Moved from nova.utils
|
||||||
Check whether a service is up based on last heartbeat.
|
Check whether a service is up based on last heartbeat.
|
||||||
"""
|
"""
|
||||||
# Keep checking 'updated_at' if 'last_seen_up' isn't set.
|
|
||||||
# Should be able to use only 'last_seen_up' in the M release
|
|
||||||
last_heartbeat = (service_ref.get('last_seen_up') or
|
last_heartbeat = (service_ref.get('last_seen_up') or
|
||||||
service_ref['updated_at'] or service_ref['created_at'])
|
service_ref['created_at'])
|
||||||
if isinstance(last_heartbeat, six.string_types):
|
if isinstance(last_heartbeat, six.string_types):
|
||||||
# NOTE(russellb) If this service_ref came in over rpc via
|
# NOTE(russellb) If this service_ref came in over rpc via
|
||||||
# conductor, then the timestamp will be a string and needs to be
|
# conductor, then the timestamp will be a string and needs to be
|
||||||
|
|||||||
@@ -64,6 +64,13 @@ class DBServiceGroupTestCase(test.NoDBTestCase):
|
|||||||
result = self.servicegroup_api.service_is_up(service)
|
result = self.servicegroup_api.service_is_up(service)
|
||||||
self.assertFalse(result)
|
self.assertFalse(result)
|
||||||
|
|
||||||
|
# "last_seen_up" is none before compute node reports its status,
|
||||||
|
# just use 'created_at' as last_heartbeat.
|
||||||
|
service.last_seen_up = None
|
||||||
|
service.created_at = timeutils.utcnow()
|
||||||
|
result = self.servicegroup_api.service_is_up(service)
|
||||||
|
self.assertTrue(result)
|
||||||
|
|
||||||
def test_join(self):
|
def test_join(self):
|
||||||
service = mock.MagicMock(report_interval=1)
|
service = mock.MagicMock(report_interval=1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user