From 30d8b8ecded625330aa9b5ce378568e4118d3bc4 Mon Sep 17 00:00:00 2001 From: Radoslav Gerganov Date: Wed, 4 Apr 2018 10:27:34 +0300 Subject: [PATCH] Replace list_hypervisors with list_services This fixes a regression introduced with commit 88c7ea8 which replaced list_hosts with list_hypervisors because the former is deprecated. However, the hypervisor_hostname cannot be used as replacement for compute hostname. This patch fixes the problem by switching to list_services which returns compute hostnames. Change-Id: I948429075e71e11e091703c4b12378c71c37bc29 --- tempest/api/compute/admin/test_aggregates_negative.py | 7 ++++--- tempest/scenario/test_aggregates_basic_ops.py | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tempest/api/compute/admin/test_aggregates_negative.py b/tempest/api/compute/admin/test_aggregates_negative.py index 6df8410c1a..a6e0efa5bd 100644 --- a/tempest/api/compute/admin/test_aggregates_negative.py +++ b/tempest/api/compute/admin/test_aggregates_negative.py @@ -27,15 +27,16 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): def setup_clients(cls): super(AggregatesAdminNegativeTestJSON, cls).setup_clients() cls.client = cls.os_admin.aggregates_client - cls.hyper_client = cls.os_admin.hypervisor_client + cls.services_client = cls.os_admin.services_client @classmethod def resource_setup(cls): super(AggregatesAdminNegativeTestJSON, cls).resource_setup() cls.aggregate_name_prefix = 'test_aggregate' - hyper_list = cls.hyper_client.list_hypervisors()['hypervisors'] - cls.hosts = [v['hypervisor_hostname'] for v in hyper_list + svc_list = cls.services_client.list_services( + binary='nova-compute')['services'] + cls.hosts = [v['host'] for v in svc_list if v['status'] == 'enabled' and v['state'] == 'up'] def _create_test_aggregate(self): diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py index f7629951e8..b5156391b5 100644 --- a/tempest/scenario/test_aggregates_basic_ops.py +++ b/tempest/scenario/test_aggregates_basic_ops.py @@ -37,7 +37,7 @@ class TestAggregatesBasicOps(manager.ScenarioTest): super(TestAggregatesBasicOps, cls).setup_clients() # Use admin client by default cls.aggregates_client = cls.os_admin.aggregates_client - cls.hyper_client = cls.os_admin.hypervisor_client + cls.services_client = cls.os_admin.services_client def _create_aggregate(self, **kwargs): aggregate = (self.aggregates_client.create_aggregate(**kwargs) @@ -51,9 +51,10 @@ class TestAggregatesBasicOps(manager.ScenarioTest): return aggregate def _get_host_name(self): - hyper_list = self.hyper_client.list_hypervisors()['hypervisors'] - self.assertNotEmpty(hyper_list) - return hyper_list[0]['hypervisor_hostname'] + svc_list = self.services_client.list_services( + binary='nova-compute')['services'] + self.assertNotEmpty(svc_list) + return svc_list[0]['host'] def _add_host(self, aggregate_id, host): aggregate = (self.aggregates_client.add_host(aggregate_id, host=host)