Improve the liveness checking for services

With this modification both nova-manage and scheduler use the flag
service_down_time and check positive and negative values in a
correct way.
Fixes bug: 867674.

Change-Id: I15c48d80cafa2089cd228c09c61b0a1e513730e8
This commit is contained in:
David Subiros 2011-08-05 16:35:56 +01:00 committed by Stanislaw Pitucha
parent ecff45d629
commit 2fc769e1d8

@ -1009,3 +1009,12 @@ def make_dev_path(dev, partition=None, base='/dev'):
if partition:
path += str(partition)
return path
def total_seconds(td):
"""Local total_seconds implementation for compatibility with python 2.6"""
if hasattr(td, 'total_seconds'):
return td.total_seconds()
else:
return ((td.days * 86400 + td.seconds) * 10 ** 6 +
td.microseconds) / 10.0 ** 6