'Return a list of hosts that can create instance_type
Check that the extra specs associated with the instance type match
the metadata provided by aggregates.  If not present return False.'

def host_passes(self, host_state, spec_obj):

    instance_type = spec_obj.flavor
    if ((not instance_type.obj_attr_is_set('extra_specs')) or (not instance_type.extra_specs)):
        return True
    metadata = utils.aggregate_metadata_get_by_host(host_state)
    for (key, req) in instance_type.extra_specs.items():
        scope = key.split(':', 1)
        if (len(scope) > 1):
            if (scope[0] != _SCOPE):
                continue
            else:
                del scope[0]
        key = scope[0]
        aggregate_vals = metadata.get(key, None)
        if (not aggregate_vals):
            LOG.debug('%(host_state)s    fails    instance_type    extra_specs    requirements.    Extra_spec    %(key)s    is    not    in    aggregate.', {'host_state': host_state, 'key': key})
            return False
        for aggregate_val in aggregate_vals:
            if extra_specs_ops.match(aggregate_val, req):
                break
        else:
            LOG.debug("%(host_state)s    fails    instance_type    extra_specs    requirements.    '%(aggregate_vals)s'    do    not    match    '%(req)s'", {'host_state': host_state, 'req': req, 'aggregate_vals': aggregate_vals})
            return False
    return True
