This /opt/stack/nova/nova/availability_zones.py get_host_availability_zone method returns the first zone if there are multiple zones for one single host for this:
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] -- return first one
else:
return CONF.default_availability_zone
But our "nova aggregate-add-host" command supports to add one same host into multi-zones, this should be conflict between the 'add host to zone' and 'get host zone' two actions.
This /opt/stack/ nova/nova/ availability_ zones.py get_host_ availability_ zone method returns the first zone if there are multiple zones for one single host for this:
def get_host_ availability_ zone(context, host, conductor_ api=None) : api.aggregate_ metadata_ get_by_ host(
context, host, key='availabili ty_zone' ) metadata_ get_by_ host(
context, host, key='availabili ty_zone' ) 'availability_ zone']) [0] -- return first one availability_ zone
if conductor_api:
metadata = conductor_
else:
metadata = db.aggregate_
if 'availability_zone' in metadata:
return list(metadata[
else:
return CONF.default_
But our "nova aggregate-add-host" command supports to add one same host into multi-zones, this should be conflict between the 'add host to zone' and 'get host zone' two actions.