Skip hosts where compute agent is down
Change-Id: I8dfe82102d771fc4b687bc59c17a56962af50919
This commit is contained in:
parent
f3e026de68
commit
1bfd2b3faa
@ -312,7 +312,7 @@ class Compute(object):
|
|||||||
host_list = []
|
host_list = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
host_list = self.novaclient.hosts.list()
|
host_list = self.novaclient.services.list()
|
||||||
except novaclient.exceptions.Forbidden:
|
except novaclient.exceptions.Forbidden:
|
||||||
print ('Warning: Operation Forbidden: could not retrieve list of hosts'
|
print ('Warning: Operation Forbidden: could not retrieve list of hosts'
|
||||||
' (likely no permission)')
|
' (likely no permission)')
|
||||||
@ -338,14 +338,14 @@ class Compute(object):
|
|||||||
else:
|
else:
|
||||||
for host in host_list:
|
for host in host_list:
|
||||||
# this host must be a compute node
|
# this host must be a compute node
|
||||||
if host._info['service'] != 'compute':
|
if host.binary != 'nova-compute' or host.state != 'up':
|
||||||
continue
|
continue
|
||||||
candidate = None
|
candidate = None
|
||||||
if self.config.availability_zone:
|
if self.config.availability_zone:
|
||||||
if host.zone == self.config.availability_zone:
|
if host.zone == self.config.availability_zone:
|
||||||
candidate = self.normalize_az_host(None, host.host_name)
|
candidate = self.normalize_az_host(None, host.host)
|
||||||
else:
|
else:
|
||||||
candidate = self.normalize_az_host(host.zone, host.host_name)
|
candidate = self.normalize_az_host(host.zone, host.host)
|
||||||
if candidate:
|
if candidate:
|
||||||
avail_list.append(candidate)
|
avail_list.append(candidate)
|
||||||
# pick first 2 matches at most
|
# pick first 2 matches at most
|
||||||
|
Loading…
x
Reference in New Issue
Block a user