Skip to content

Commit

Permalink
svc_monitor unable to handle empty az list from nova
Browse files Browse the repository at this point in the history
This fix adds error handling to svc_monitor code. If nova
returns empty az_list or if the call to nova fails for some
reason, svc_monitor will not crash after this fix.

Change-Id: Ib132401d931c763c36c9eca46bfd855663b070b9
Closes-Bug: #1593432
  • Loading branch information
Varun Lodaya committed Jun 16, 2016
1 parent 077906c commit 8cee707
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/config/svc-monitor/svc_monitor/scheduler/vrouter_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,21 @@ def _get_az_vrouter_list(self):
az_list = self._nc.oper('availability_zones', 'list',
self._args.admin_tenant_name,
detailed=True)
if not az_list:
self._logger.error("Failed fetching azs from nova")
return None

az_vr_list = []
for az in az_list:
if self._args.netns_availability_zone not in str(az):
continue
try:
# check if the az is available
if not az.zoneState['available']:
continue
# check if there are any hosts
if not az.hosts:
# check:
# 1. If az is mentioned in config
# 2. If the az is enabled & active
# 3. If it has any hosts
if az.zoneName not in self._args.netns_availability_zone or \
not az.zoneState['available'] or not az.hosts:
continue

# check if hosts are active & enabled
for host,host_status in az.hosts.iteritems():
if (('nova-compute' in host_status) and \
Expand Down

0 comments on commit 8cee707

Please sign in to comment.