timeutils.total_seconds() is deprecated

This deprecated func is going to be removed starting with 3.1 version of
"oslo_utils" because the datetime.total_seconds() has been deprecated for
python >= 2.6,and is replaced by datetime.timedelta.total_seconds.

Change-Id: Ie75a3afcba0dda2a9e7c3da71e055c3d505efd62
This commit is contained in:
Yang Wei 2015-12-01 18:00:30 +08:00
parent e6af0f3972
commit 3155ca013e

View File

@ -405,7 +405,8 @@ def service_is_up(service):
"""Check whether a service is up based on last heartbeat."""
last_heartbeat = service['updated_at'] or service['created_at']
# Timestamps in DB are UTC.
elapsed = timeutils.total_seconds(timeutils.utcnow() - last_heartbeat)
tdelta = timeutils.utcnow() - last_heartbeat
elapsed = tdelta.total_seconds()
return abs(elapsed) <= CONF.service_down_time