Don't use hypervisor_hostname as compute hostname
Several tempest tests are failing when using the VMware virt driver
where compute hostname != hypervisor_hostname. Those are different
things and cannot be used interchangeably. This patch fixes a
regression introduced with commit 1dc2e231 where the hosts_client was
replaced with hypervisor_client in order to select hosts which are both
up and enabled.
This patch changes the implementation of get_host_other_than() to use
services_client which still allows to select nova computes which are up
and enabled but also gives us the compute hostname.
Related-prod: PROD-18630
Change-Id: Ie6df1192e1ca83977dccc8e6b9331dfe874c8aba
Closes-Bug: #1759801
(cherry picked from commit 50325e239ad0119c6e0cfd90b1c7b1ef7ec78525)
Close-bug: https://mirantis.jira.com/browse/PROD-19499
(cherry picked from commit 30f360dff2aa54d341d16d87808ffac4126e2355)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 9759be7..760e356 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -532,10 +532,10 @@
def get_host_other_than(self, server_id):
source_host = self.get_host_for_server(server_id)
- hypers = self.os_admin.hypervisor_client.list_hypervisors(
- )['hypervisors']
- hosts = [hyper['hypervisor_hostname'] for hyper in hypers
- if hyper['state'] == 'up' and hyper['status'] == 'enabled']
+ svcs = self.os_admin.services_client.list_services(
+ binary='nova-compute')['services']
+ hosts = [svc['host'] for svc in svcs
+ if svc['state'] == 'up' and svc['status'] == 'enabled']
for target_host in hosts:
if source_host != target_host: