Merge "Return complete response from hosts_client"
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 9334fb6..e42131d 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -40,7 +40,7 @@
         cls.aggregate_name_prefix = 'test_aggregate'
         cls.az_name_prefix = 'test_az'
 
-        hosts_all = cls.os_adm.hosts_client.list_hosts()
+        hosts_all = cls.os_adm.hosts_client.list_hosts()['hosts']
         hosts = map(lambda x: x['host_name'],
                     filter(lambda y: y['service'] == 'compute', hosts_all))
         cls.host = hosts[0]
diff --git a/tempest/api/compute/admin/test_aggregates_negative.py b/tempest/api/compute/admin/test_aggregates_negative.py
index 231c88f..02e0af0 100644
--- a/tempest/api/compute/admin/test_aggregates_negative.py
+++ b/tempest/api/compute/admin/test_aggregates_negative.py
@@ -39,7 +39,7 @@
         cls.aggregate_name_prefix = 'test_aggregate'
         cls.az_name_prefix = 'test_az'
 
-        hosts_all = cls.os_adm.hosts_client.list_hosts()
+        hosts_all = cls.os_adm.hosts_client.list_hosts()['hosts']
         hosts = map(lambda x: x['host_name'],
                     filter(lambda y: y['service'] == 'compute', hosts_all))
         cls.host = hosts[0]
@@ -131,7 +131,7 @@
     @test.idempotent_id('0ef07828-12b4-45ba-87cc-41425faf5711')
     def test_aggregate_add_non_exist_host(self):
         # Adding a non-exist host to an aggregate should raise exceptions.
-        hosts_all = self.os_adm.hosts_client.list_hosts()
+        hosts_all = self.os_adm.hosts_client.list_hosts()['hosts']
         hosts = map(lambda x: x['host_name'], hosts_all)
         while True:
             non_exist_host = data_utils.rand_name('nonexist_host')
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index 0dadea5..6d8788f 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -30,15 +30,15 @@
 
     @test.idempotent_id('9bfaf98d-e2cb-44b0-a07e-2558b2821e4f')
     def test_list_hosts(self):
-        hosts = self.client.list_hosts()
+        hosts = self.client.list_hosts()['hosts']
         self.assertTrue(len(hosts) >= 2, str(hosts))
 
     @test.idempotent_id('5dc06f5b-d887-47a2-bb2a-67762ef3c6de')
     def test_list_hosts_with_zone(self):
         self.useFixture(fixtures.LockFixture('availability_zone'))
-        hosts = self.client.list_hosts()
+        hosts = self.client.list_hosts()['hosts']
         host = hosts[0]
-        hosts = self.client.list_hosts(zone=host['zone'])
+        hosts = self.client.list_hosts(zone=host['zone'])['hosts']
         self.assertTrue(len(hosts) >= 1)
         self.assertIn(host, hosts)
 
@@ -46,26 +46,26 @@
     def test_list_hosts_with_a_blank_zone(self):
         # If send the request with a blank zone, the request will be successful
         # and it will return all the hosts list
-        hosts = self.client.list_hosts(zone='')
+        hosts = self.client.list_hosts(zone='')['hosts']
         self.assertNotEqual(0, len(hosts))
 
     @test.idempotent_id('c6ddbadb-c94e-4500-b12f-8ffc43843ff8')
     def test_list_hosts_with_nonexistent_zone(self):
         # If send the request with a nonexistent zone, the request will be
         # successful and no hosts will be retured
-        hosts = self.client.list_hosts(zone='xxx')
+        hosts = self.client.list_hosts(zone='xxx')['hosts']
         self.assertEqual(0, len(hosts))
 
     @test.idempotent_id('38adbb12-aee2-4498-8aec-329c72423aa4')
     def test_show_host_detail(self):
-        hosts = self.client.list_hosts()
+        hosts = self.client.list_hosts()['hosts']
 
         hosts = [host for host in hosts if host['service'] == 'compute']
         self.assertTrue(len(hosts) >= 1)
 
         for host in hosts:
             hostname = host['host_name']
-            resources = self.client.show_host(hostname)
+            resources = self.client.show_host(hostname)['host']
             self.assertTrue(len(resources) >= 1)
             host_resource = resources[0]['resource']
             self.assertIsNotNone(host_resource)
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
index b2d2a04..2ea7f1a 100644
--- a/tempest/api/compute/admin/test_hosts_negative.py
+++ b/tempest/api/compute/admin/test_hosts_negative.py
@@ -32,7 +32,7 @@
         cls.non_admin_client = cls.os.hosts_client
 
     def _get_host_name(self):
-        hosts = self.client.list_hosts()
+        hosts = self.client.list_hosts()['hosts']
         self.assertTrue(len(hosts) >= 1)
         hostname = hosts[0]['host_name']
         return hostname
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index 79c2ac9..d6bc6f5 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -41,7 +41,7 @@
         cls.created_server_ids = []
 
     def _get_compute_hostnames(self):
-        body = self.admin_hosts_client.list_hosts()
+        body = self.admin_hosts_client.list_hosts()['hosts']
         return [
             host_record['host_name']
             for host_record in body
diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py
index f5f4a61..fcde561 100644
--- a/tempest/scenario/test_aggregates_basic_ops.py
+++ b/tempest/scenario/test_aggregates_basic_ops.py
@@ -58,7 +58,7 @@
         self.aggregates_client.delete_aggregate(aggregate['id'])
 
     def _get_host_name(self):
-        hosts = self.hosts_client.list_hosts()
+        hosts = self.hosts_client.list_hosts()['hosts']
         self.assertTrue(len(hosts) >= 1)
         computes = [x for x in hosts if x['service'] == 'compute']
         return computes[0]['host_name']
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index 752af68..3d3cb18 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -31,7 +31,7 @@
         resp, body = self.get(url)
         body = json.loads(body)
         self.validate_response(schema.list_hosts, resp, body)
-        return service_client.ResponseBodyList(resp, body['hosts'])
+        return service_client.ResponseBody(resp, body)
 
     def show_host(self, hostname):
         """Show detail information for the host."""
@@ -39,7 +39,7 @@
         resp, body = self.get("os-hosts/%s" % hostname)
         body = json.loads(body)
         self.validate_response(schema.get_host_detail, resp, body)
-        return service_client.ResponseBodyList(resp, body['host'])
+        return service_client.ResponseBody(resp, body)
 
     def update_host(self, hostname, **kwargs):
         """Update a host."""
@@ -62,7 +62,7 @@
         resp, body = self.get("os-hosts/%s/startup" % hostname)
         body = json.loads(body)
         self.validate_response(schema.startup_host, resp, body)
-        return service_client.ResponseBody(resp, body['host'])
+        return service_client.ResponseBody(resp, body)
 
     def shutdown_host(self, hostname):
         """Shutdown a host."""
@@ -70,7 +70,7 @@
         resp, body = self.get("os-hosts/%s/shutdown" % hostname)
         body = json.loads(body)
         self.validate_response(schema.shutdown_host, resp, body)
-        return service_client.ResponseBody(resp, body['host'])
+        return service_client.ResponseBody(resp, body)
 
     def reboot_host(self, hostname):
         """reboot a host."""
@@ -78,4 +78,4 @@
         resp, body = self.get("os-hosts/%s/reboot" % hostname)
         body = json.loads(body)
         self.validate_response(schema.reboot_host, resp, body)
-        return service_client.ResponseBody(resp, body['host'])
+        return service_client.ResponseBody(resp, body)