diff options
| author | Yun Mao <yunmao@gmail.com> | 2013-02-11 15:29:58 -0500 |
|---|---|---|
| committer | Yun Mao <yunmao@gmail.com> | 2013-02-11 15:37:18 -0500 |
| commit | 9e208ae6e3cfe3b1dfea56f36d73c413b1952acd (patch) | |
| tree | d236d7e19798af659462a149ba3afc9ef7b10262 | |
| parent | 20424b987946ee56e39f88aed7fddd35c54d7207 (diff) | |
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
| -rwxr-xr-x | bin/nova-manage | 5 |
1 files 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']: |
