summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-05-22 21:45:34 +0000
committerGerrit Code Review <review@openstack.org>2013-05-22 21:45:34 +0000
commit89df79f865bf87aa0b2f60d7f7cc2349c7acb453 (patch)
treeba4be40d4839b51babb6dc921bbc373a91ee1a4c /nova/api
parent986fa041a7cb8b85f4b3be47407288c1f71c0972 (diff)
parent616e5d965bd8a2923f00ba4ff194e6a6ee2468cd (diff)
downloadnova-89df79f865bf87aa0b2f60d7f7cc2349c7acb453.tar.gz
nova-89df79f865bf87aa0b2f60d7f7cc2349c7acb453.tar.xz
nova-89df79f865bf87aa0b2f60d7f7cc2349c7acb453.zip
Merge "Make nova-api use servicegroup.API.service_is_up()."
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/services.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/nova/api/openstack/compute/contrib/services.py b/nova/api/openstack/compute/contrib/services.py
index 9952484f7..bc5f60b64 100644
--- a/nova/api/openstack/compute/contrib/services.py
+++ b/nova/api/openstack/compute/contrib/services.py
@@ -22,8 +22,7 @@ from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import compute
from nova import exception
-from nova.openstack.common import timeutils
-from nova import utils
+from nova import servicegroup
authorize = extensions.extension_authorizer('compute', 'services')
CONF = cfg.CONF
@@ -71,6 +70,7 @@ class ServiceController(object):
def __init__(self):
self.host_api = compute.HostAPI()
+ self.servicegroup_api = servicegroup.API()
@wsgi.serializers(xml=ServicesIndexTemplate)
def index(self, req):
@@ -79,7 +79,6 @@ class ServiceController(object):
"""
context = req.environ['nova.context']
authorize(context)
- now = timeutils.utcnow()
services = self.host_api.service_get_all(
context, set_zones=True)
@@ -96,8 +95,7 @@ class ServiceController(object):
svcs = []
for svc in services:
- delta = now - (svc['updated_at'] or svc['created_at'])
- alive = abs(utils.total_seconds(delta)) <= CONF.service_down_time
+ alive = self.servicegroup_api.service_is_up(svc)
art = (alive and "up") or "down"
active = 'enabled'
if svc['disabled']: