diff --git a/cinder/objects/service.py b/cinder/objects/service.py index bcfe9dfe964..a1706184f3a 100644 --- a/cinder/objects/service.py +++ b/cinder/objects/service.py @@ -194,9 +194,8 @@ class Service(base.CinderPersistentObject, base.CinderObject, @property def is_up(self): """Check whether a service is up based on last heartbeat.""" - last_heartbeat = self.updated_at or self.created_at - return (last_heartbeat and - last_heartbeat >= utils.service_expired_time(True)) + return (self.updated_at and + self.updated_at >= utils.service_expired_time(True)) @base.CinderObjectRegistry.register diff --git a/cinder/tests/unit/fake_service.py b/cinder/tests/unit/fake_service.py index f3a65f1607d..455db247c86 100644 --- a/cinder/tests/unit/fake_service.py +++ b/cinder/tests/unit/fake_service.py @@ -30,7 +30,7 @@ def fake_db_service(**updates): NOW = timeutils.utcnow().replace(microsecond=0) db_service = { 'created_at': NOW, - 'updated_at': None, + 'updated_at': NOW, 'deleted_at': None, 'deleted': False, 'id': 123,