Comment 1 for bug 1196893

Revision history for this message
Haomeng,Wang (whaom) wrote :

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.