summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-15 19:14:54 +0000
committerGerrit Code Review <review@openstack.org>2013-01-15 19:14:54 +0000
commit425af8913b6cb89758278e69654f68201c91c18b (patch)
treef947fb6d78f5d7a86e07e2f4957baeea4fcea24d
parentff2542a3e58023193f9ec23f70a0b6bd92499a85 (diff)
parentfc42f76b24df376c89f94a177f2476dacbc87073 (diff)
downloadnova-425af8913b6cb89758278e69654f68201c91c18b.tar.gz
nova-425af8913b6cb89758278e69654f68201c91c18b.tar.xz
nova-425af8913b6cb89758278e69654f68201c91c18b.zip
Merge "Populate service list with availability zone and correct unit test"
-rw-r--r--nova/api/openstack/compute/contrib/services.py2
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_services.py14
2 files changed, 9 insertions, 7 deletions
diff --git a/nova/api/openstack/compute/contrib/services.py b/nova/api/openstack/compute/contrib/services.py
index c792c72da..2786ad814 100644
--- a/nova/api/openstack/compute/contrib/services.py
+++ b/nova/api/openstack/compute/contrib/services.py
@@ -21,6 +21,7 @@ import webob.exc
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
+from nova import availability_zones
from nova import db
from nova import exception
from nova.openstack.common import cfg
@@ -69,6 +70,7 @@ class ServiceController(object):
authorize(context)
now = timeutils.utcnow()
services = db.service_get_all(context)
+ services = availability_zones.set_availability_zones(context, services)
host = ''
if 'host' in req.GET:
diff --git a/nova/tests/api/openstack/compute/contrib/test_services.py b/nova/tests/api/openstack/compute/contrib/test_services.py
index 12c1ef2a4..1bd47b67a 100644
--- a/nova/tests/api/openstack/compute/contrib/test_services.py
+++ b/nova/tests/api/openstack/compute/contrib/test_services.py
@@ -26,30 +26,30 @@ from nova.tests.api.openstack import fakes
fake_services_list = [{'binary': 'nova-scheduler',
'host': 'host1',
- 'availability_zone': 'nova',
'id': 1,
'disabled': True,
+ 'topic': 'scheduler',
'updated_at': datetime(2012, 10, 29, 13, 42, 2),
'created_at': datetime(2012, 9, 18, 2, 46, 27)},
{'binary': 'nova-compute',
'host': 'host1',
- 'availability_zone': 'nova',
'id': 2,
'disabled': True,
+ 'topic': 'compute',
'updated_at': datetime(2012, 10, 29, 13, 42, 5),
'created_at': datetime(2012, 9, 18, 2, 46, 27)},
{'binary': 'nova-scheduler',
'host': 'host2',
- 'availability_zone': 'nova',
'id': 3,
'disabled': False,
+ 'topic': 'scheduler',
'updated_at': datetime(2012, 9, 19, 6, 55, 34),
'created_at': datetime(2012, 9, 18, 2, 46, 28)},
{'binary': 'nova-compute',
'host': 'host2',
- 'availability_zone': 'nova',
'id': 4,
'disabled': True,
+ 'topic': 'compute',
'updated_at': datetime(2012, 9, 18, 8, 3, 38),
'created_at': datetime(2012, 9, 18, 2, 46, 28)},
]
@@ -128,7 +128,7 @@ class ServicesTest(test.TestCase):
res_dict = self.controller.index(req)
response = {'services': [{'binary': 'nova-scheduler',
- 'host': 'host1', 'zone': 'nova',
+ 'host': 'host1', 'zone': 'internal',
'status': 'disabled', 'state': 'up',
'updated_at': datetime(2012, 10, 29, 13, 42, 2)},
{'binary': 'nova-compute',
@@ -136,7 +136,7 @@ class ServicesTest(test.TestCase):
'status': 'disabled', 'state': 'up',
'updated_at': datetime(2012, 10, 29, 13, 42, 5)},
{'binary': 'nova-scheduler', 'host': 'host2',
- 'zone': 'nova',
+ 'zone': 'internal',
'status': 'enabled', 'state': 'down',
'updated_at': datetime(2012, 9, 19, 6, 55, 34)},
{'binary': 'nova-compute', 'host': 'host2',
@@ -150,7 +150,7 @@ class ServicesTest(test.TestCase):
res_dict = self.controller.index(req)
response = {'services': [{'binary': 'nova-scheduler', 'host': 'host1',
- 'zone': 'nova',
+ 'zone': 'internal',
'status': 'disabled', 'state': 'up',
'updated_at': datetime(2012, 10, 29, 13, 42, 2)},
{'binary': 'nova-compute', 'host': 'host1',