There is no need to filter objects if there is no objects in resource list

Bug #1266690 reported by Guangya Liu (Jay Lau)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
Wishlist
Guangya Liu (Jay Lau)

Bug Description

In oslo base filter, it has the following logic, this will cause that get_filtered_objects loop all filters even if there is no objs after filtered by some first filters.

class BaseFilterHandler(base_handler.BaseHandler):
    """Base class to handle loading filter classes.

    This class should be subclassed where one needs to use filters.
    """

    def get_filtered_objects(self, filter_classes, objs,
                             filter_properties):
        for filter_cls in filter_classes:
            objs = filter_cls().filter_all(objs, filter_properties)
        return list(objs)

Changed in oslo:
assignee: nobody → Jay Lau (jay-lau-513)
Changed in oslo:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

Fix proposed to branch: master
Review: https://review.openstack.org/65418

Changed in oslo:
status: Triaged → In Progress
Changed in oslo:
milestone: none → icehouse-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/65418
Committed: https://git.openstack.org/cgit/openstack/oslo-incubator/commit/?id=cae33101b6dadbfd64d9f460ebdea533baace288
Submitter: Jenkins
Branch: master

commit cae33101b6dadbfd64d9f460ebdea533baace288
Author: Jay Lau <email address hidden>
Date: Mon Jan 20 13:11:16 2014 +0800

    Stop looping all filters if no objects return

    In Oslo base filter, get_filtered_objects will loop all filters
    before exit even if some filters return no objects.

    This patch will stop looping all filters if no objects return by
    one filter.

    Change-Id: Ie5b1c477e6cfb9cd004828eb73109ef96b17ff6e
    Closes-Bug: #1266690

Changed in oslo:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in oslo:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: icehouse-2 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.