Fetch only 'up' state nodes for nova hypervisor list

Change-Id: I2ea545960365b666d4bd4dbb3f96613400ee804b
This commit is contained in:
Sawan Choudhary 2018-01-11 14:18:10 -08:00
parent 45b7cbe59c
commit b06080b6bf
1 changed files with 2 additions and 1 deletions

View File

@ -24,7 +24,8 @@ class NovaHealth(object):
hypervisors = self.novaclient.hypervisors.list()
except (ClientException, Exception) as e:
return (400, e.message, [])
hypervisor_names = [node.hypervisor_hostname for node in hypervisors]
hypervisor_names = [node.hypervisor_hostname for node in hypervisors
if node.state == "up"]
return (200, "success", hypervisor_names)
def nova_service_list(self):