Make the metadata paths use conductor
This patch makes the metadata service use conductor instead of hitting the database directly. It adds a get_ec2_ids() method to conductor, which encapsulates a bunch of very small id translation database queries. It also does the AZ lookup via conductor. Fixes bug 1120402 Change-Id: Iceef753b1451ff53e29dfbf97a696b952b47d5a3
This commit is contained in:
@@ -52,9 +52,13 @@ def set_availability_zones(context, services):
|
||||
return services
|
||||
|
||||
|
||||
def get_host_availability_zone(context, host):
|
||||
metadata = db.aggregate_metadata_get_by_host(
|
||||
context, host, key='availability_zone')
|
||||
def get_host_availability_zone(context, host, conductor_api=None):
|
||||
if conductor_api:
|
||||
metadata = conductor_api.aggregate_metadata_get_by_host(
|
||||
context, host, key='availability_zone')
|
||||
else:
|
||||
metadata = db.aggregate_metadata_get_by_host(
|
||||
context, host, key='availability_zone')
|
||||
if 'availability_zone' in metadata:
|
||||
return list(metadata['availability_zone'])[0]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user