From 9e208ae6e3cfe3b1dfea56f36d73c413b1952acd Mon Sep 17 00:00:00 2001 From: Yun Mao Date: Mon, 11 Feb 2013 15:29:58 -0500 Subject: Use ServiceGroup API to show node liveness Previously it's direct db access. Now we use the servicegroup API to show node liveness. Note that db access is still needed to get other service attributes such as `disabled'. Change-Id: I65ef3a136fd90036a8d009ed97a5f48ae461d8d9 --- bin/nova-manage | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index c793fed16..6e8aa8a9c 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -87,6 +87,7 @@ from nova.openstack.common import rpc from nova.openstack.common import timeutils from nova import quota from nova.scheduler import rpcapi as scheduler_rpcapi +from nova import servicegroup from nova import utils from nova import version @@ -624,6 +625,7 @@ class ServiceCommands(object): """ Show a list of all running services. Filter by host & service name. """ + servicegroup_api = servicegroup.API() ctxt = context.get_admin_context() now = timeutils.utcnow() services = db.service_get_all(ctxt) @@ -641,8 +643,7 @@ class ServiceCommands(object): _('State'), _('Updated_At')) for svc in services: - delta = now - (svc['updated_at'] or svc['created_at']) - alive = abs(utils.total_seconds(delta)) <= CONF.service_down_time + alive = servicegroup_api.service_is_up(svc) art = (alive and ":-)") or "XXX" active = 'enabled' if svc['disabled']: -- cgit