'Return a list of instance records for the instances found
on the hypervisor which satisfy the specified filters. If filters=None
return a list of instance records for all the instances found on the
hypervisor.'

def _get_instances_on_driver(self, context, filters=None):

    if (not filters):
        filters = {}
    try:
        driver_uuids = self.driver.list_instance_uuids()
        if (len(driver_uuids) == 0):
            return objects.InstanceList()
        filters['uuid'] = driver_uuids
        local_instances = objects.InstanceList.get_by_filters(context, filters, use_slave=True)
        return local_instances
    except NotImplementedError:
        pass
    driver_instances = self.driver.list_instances()
    instances = objects.InstanceList.get_by_filters(context, filters, use_slave=True)
    name_map = {instance.name: instance for instance in instances}
    local_instances = []
    for driver_instance in driver_instances:
        instance = name_map.get(driver_instance)
        if (not instance):
            continue
        local_instances.append(instance)
    return local_instances
