Update is_up from Service OVO class to match ORM
Our services' update_at field is also being updated now on creation [1], so there's no longer a need to check for the created_at field for the heartbeat in is_up method. Since this change was introduced in Newton it is now safe for this patch to remove the unnecessary check on created_at in method is_up of the Service OVO class. [1] https://review.openstack.org/#/c/318572/22/cinder/db/sqlalchemy/models.py@73 Trivialfix Change-Id: Id0e30656901810128415fd9544c28cafb22c6592
This commit is contained in:
parent
4fef72f32f
commit
6f72616c55
@ -194,9 +194,8 @@ class Service(base.CinderPersistentObject, base.CinderObject,
|
|||||||
@property
|
@property
|
||||||
def is_up(self):
|
def is_up(self):
|
||||||
"""Check whether a service is up based on last heartbeat."""
|
"""Check whether a service is up based on last heartbeat."""
|
||||||
last_heartbeat = self.updated_at or self.created_at
|
return (self.updated_at and
|
||||||
return (last_heartbeat and
|
self.updated_at >= utils.service_expired_time(True))
|
||||||
last_heartbeat >= utils.service_expired_time(True))
|
|
||||||
|
|
||||||
|
|
||||||
@base.CinderObjectRegistry.register
|
@base.CinderObjectRegistry.register
|
||||||
|
@ -30,7 +30,7 @@ def fake_db_service(**updates):
|
|||||||
NOW = timeutils.utcnow().replace(microsecond=0)
|
NOW = timeutils.utcnow().replace(microsecond=0)
|
||||||
db_service = {
|
db_service = {
|
||||||
'created_at': NOW,
|
'created_at': NOW,
|
||||||
'updated_at': None,
|
'updated_at': NOW,
|
||||||
'deleted_at': None,
|
'deleted_at': None,
|
||||||
'deleted': False,
|
'deleted': False,
|
||||||
'id': 123,
|
'id': 123,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user