Make os-availability-zones know about cells
This removes the direct-to-object listing of Service objects by the availability zone routines. Instead, it implements a cell-scanning approach in HostAPI and uses that for consistent behavior. The modified behavior of service_get_all() in HostAPI was originally in another patch, but is moved here because of dependency sequencing. The HostAPI patch later in this series uses this as well. Related to blueprint cells-aware-api Change-Id: I65c2b436bef8837c0e10a5e502e9cd598d9aa0c3
This commit is contained in:
@@ -120,8 +120,12 @@ def get_availability_zones(context, get_only_available=False,
|
||||
:param with_hosts: whether to return hosts part of the AZs
|
||||
:type with_hosts: bool
|
||||
"""
|
||||
enabled_services = objects.ServiceList.get_all(context, disabled=False,
|
||||
set_zones=True)
|
||||
# NOTE(danms): Avoid circular import
|
||||
from nova import compute
|
||||
hostapi = compute.HostAPI()
|
||||
|
||||
enabled_services = hostapi.service_get_all(
|
||||
context, {'disabled': False}, set_zones=True, all_cells=True)
|
||||
|
||||
available_zones = []
|
||||
for (zone, host) in [(service['availability_zone'], service['host'])
|
||||
@@ -136,8 +140,8 @@ def get_availability_zones(context, get_only_available=False,
|
||||
available_zones = list(_available_zones.items())
|
||||
|
||||
if not get_only_available:
|
||||
disabled_services = objects.ServiceList.get_all(context, disabled=True,
|
||||
set_zones=True)
|
||||
disabled_services = hostapi.service_get_all(
|
||||
context, {'disabled': True}, set_zones=True, all_cells=True)
|
||||
not_available_zones = []
|
||||
azs = available_zones if not with_hosts else dict(available_zones)
|
||||
zones = [(service['availability_zone'], service['host'])
|
||||
|
Reference in New Issue
Block a user