Only choose available compute node as migration dest
In live_migrate_server, destination host can be specified,
but we should only choose available compute node as the
destination host, otherwise the testcase will fail unexpectedly.
Change-Id: I0a293161efa346a5cc6a57ea794641364b4b2d25
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 746f83a..3340d8c 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -495,12 +495,10 @@
def get_host_other_than(self, server_id):
source_host = self.get_host_for_server(server_id)
- list_hosts_resp = self.os_admin.hosts_client.list_hosts()['hosts']
- hosts = [
- host_record['host_name']
- for host_record in list_hosts_resp
- if host_record['service'] == 'compute'
- ]
+ 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']
for target_host in hosts:
if source_host != target_host: