From 2c0adf1304e73eb1c940a6fbfd50bf34f870e282 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Tue, 19 Jun 2012 02:27:53 +0000 Subject: Fix bug 1014925: fix os-hosts List all hosts API. Change-Id: I95231ac98223c7b8cc07e867283da8c8d90fed38 --- nova/api/openstack/compute/contrib/hosts.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/hosts.py b/nova/api/openstack/compute/contrib/hosts.py index 6cdca56c8..e24ef3605 100644 --- a/nova/api/openstack/compute/contrib/hosts.py +++ b/nova/api/openstack/compute/contrib/hosts.py @@ -27,7 +27,6 @@ from nova import db from nova import exception from nova import flags from nova import log as logging -from nova.scheduler import rpcapi as scheduler_rpcapi LOG = logging.getLogger(__name__) @@ -98,8 +97,11 @@ def _list_hosts(req, service=None): by service type. """ context = req.environ['nova.context'] - rpcapi = scheduler_rpcapi.SchedulerAPI() - hosts = rpcapi.get_host_list(context) + services = db.service_get_all(context, False) + + hosts = [] + for host in services: + hosts.append({"host_name": host['host'], 'service': host['topic']}) if service: hosts = [host for host in hosts if host["service"] == service] -- cgit