From 01508fe34b6595f8b47ea808e433bc8cb210e94e Mon Sep 17 00:00:00 2001 From: spisarski Date: Tue, 13 Jun 2017 09:18:57 +0800 Subject: Changed logic to return only active availability zones. Change-Id: I75d92976f4486933d432a8066159dbb66c12daf5 Signed-off-by: spisarski --- snaps/openstack/utils/nova_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snaps/openstack/utils/nova_utils.py b/snaps/openstack/utils/nova_utils.py index 419f451..a1b959a 100644 --- a/snaps/openstack/utils/nova_utils.py +++ b/snaps/openstack/utils/nova_utils.py @@ -232,7 +232,7 @@ def delete_floating_ip(nova, floating_ip): def get_nova_availability_zones(nova): """ - Returns the names of all nova compute servers + Returns the names of all nova active compute servers :param nova: the Nova client :return: a list of compute server names """ @@ -241,7 +241,8 @@ def get_nova_availability_zones(nova): for zone in zones: if zone.zoneName == 'nova': for key, host in zone.hosts.items(): - out.append(zone.zoneName + ':' + key) + if host['nova-compute']['available']: + out.append(zone.zoneName + ':' + key) return out -- cgit 1.2.3-korg