wrong FilterAction instance is being created during filtering

Bug #1888490 reported by Krokhin Ihor
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Akihiro Motoki

Bug Description

Suppose we have deployed Openstack with several projects.
Step to reproduce:
- open Horizon dashboard and log in as an administrator;
- go to Admin > Overview > Compute > Instances;
- type name of any project in filter bar and click "filter";
- in result table appear instances of project whose name doesn't match search string;

This behaviour can be clearly seen on the screenshot that I attach to the issue.

I've been discovering the reason of this and figured out that actually by clicking on "filter" button (even with "Project name =" selected in dropdown) eventually a method of `FilterAction` instance is being called instead of concrete one which would contain some logic in `filter()`.
Please look at: https://opendev.org/openstack/horizon/src/branch/stable/train/horizon/tables/actions.py#L524
this is the one I've described beyond. Method just return the whole data. It is overridden in subclasses but as I mentioned it creates the base class (`FilterAction`) instead of correct one for some filter field chosen in dropdown.

Revision history for this message
Krokhin Ihor (ihorkrokhin889) wrote :
description: updated
description: updated
Changed in horizon:
assignee: nobody → vinay harsha mitta (vinay7)
Revision history for this message
vinay harsha mitta (vinay7) wrote :

The issue was with GET call for instances , i.e the filtering opts like project_name, image_name, flavor_name are not supported by nova_api (non-api filters), so these get mapped to their id's first and then updated in search_opts dict which is passed for retrieving instances. For the admin tab this call[1] was happening prior to non-api filters mapping[2] , so in-order to work a second call with updated search_opts dict should be called.

[1] .https://opendev.org/openstack/horizon/src/branch/master/openstack_dashboard/dashboards/admin/instances/views.py#L154

[2]. https://opendev.org/openstack/horizon/src/branch/master/openstack_dashboard/dashboards/admin/instances/views.py#L166

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.opendev.org/754658

Changed in horizon:
status: New → In Progress
Changed in horizon:
assignee: vinay harsha mitta (vinay7) → Akihiro Motoki (amotoki)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.opendev.org/754658
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=6b79cdcc1b92a968c967286cc267bac39803c85e
Submitter: Zuul
Branch: master

commit 6b79cdcc1b92a968c967286cc267bac39803c85e
Author: vinay_m <email address hidden>
Date: Mon Sep 28 14:22:18 2020 +0530

    Non-api filters not working with admin instance tab

    The issue was that the filtering opts like project_name, image_name,
    flavor_name that are not supported by nova API (non-api filters) do
    not work expectedly. These filters are mapped to their IDs [1], but
    an instance list retrieved before resolving non-API filters is used [2].
    This commit changes the logic to resolve non-API filters first and
    then retrieve instances using the updated search_opts.

    Note that the image list is handled a bit specially. If 'image_name'
    is specified as a filter, we retrieve a corresponding image detail
    first before fetching instances to resolve the image name into its ID.
    Otherwise, we retrieve images only related to instances retrieved
    and this happens after retrieving instances.

    [1] https://opendev.org/openstack/horizon/src/commit/f90c3cd50174af4927737e29e2765cd2d7ca507f/openstack_dashboard/dashboards/admin/instances/views.py#L166
    [2] https://opendev.org/openstack/horizon/src/commit/f90c3cd50174af4927737e29e2765cd2d7ca507f/openstack_dashboard/dashboards/admin/instances/views.py#L154

    Closes-Bug: #1888490
    Co-Authored-By: Akihiro Motoki <email address hidden>
    Change-Id: Id43adbd44778d3375c0d49da3f7530cbb99e16fe

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 19.0.0

This issue was fixed in the openstack/horizon 19.0.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/victoria)

Fix proposed to branch: stable/victoria
Review: https://review.opendev.org/c/openstack/horizon/+/827405

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/horizon/+/827406

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/victoria)

Reviewed: https://review.opendev.org/c/openstack/horizon/+/827405
Committed: https://opendev.org/openstack/horizon/commit/2e8e0abfa153c30d01f2b1cb937303d6237a5132
Submitter: "Zuul (22348)"
Branch: stable/victoria

commit 2e8e0abfa153c30d01f2b1cb937303d6237a5132
Author: vinay_m <email address hidden>
Date: Mon Sep 28 14:22:18 2020 +0530

    Non-api filters not working with admin instance tab

    The issue was that the filtering opts like project_name, image_name,
    flavor_name that are not supported by nova API (non-api filters) do
    not work expectedly. These filters are mapped to their IDs [1], but
    an instance list retrieved before resolving non-API filters is used [2].
    This commit changes the logic to resolve non-API filters first and
    then retrieve instances using the updated search_opts.

    Note that the image list is handled a bit specially. If 'image_name'
    is specified as a filter, we retrieve a corresponding image detail
    first before fetching instances to resolve the image name into its ID.
    Otherwise, we retrieve images only related to instances retrieved
    and this happens after retrieving instances.

    [1] https://opendev.org/openstack/horizon/src/commit/f90c3cd50174af4927737e29e2765cd2d7ca507f/openstack_dashboard/dashboards/admin/instances/views.py#L166
    [2] https://opendev.org/openstack/horizon/src/commit/f90c3cd50174af4927737e29e2765cd2d7ca507f/openstack_dashboard/dashboards/admin/instances/views.py#L154

    Closes-Bug: #1888490
    Co-Authored-By: Akihiro Motoki <email address hidden>
    Change-Id: Id43adbd44778d3375c0d49da3f7530cbb99e16fe
    (cherry picked from commit 6b79cdcc1b92a968c967286cc267bac39803c85e)

tags: added: in-stable-victoria
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 18.6.4

This issue was fixed in the openstack/horizon 18.6.4 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/ussuri)

Reviewed: https://review.opendev.org/c/openstack/horizon/+/827406
Committed: https://opendev.org/openstack/horizon/commit/9e6ddb7a0a53173f62566d5e829ff3ea4527937c
Submitter: "Zuul (22348)"
Branch: stable/ussuri

commit 9e6ddb7a0a53173f62566d5e829ff3ea4527937c
Author: vinay_m <email address hidden>
Date: Mon Sep 28 14:22:18 2020 +0530

    Non-api filters not working with admin instance tab

    The issue was that the filtering opts like project_name, image_name,
    flavor_name that are not supported by nova API (non-api filters) do
    not work expectedly. These filters are mapped to their IDs [1], but
    an instance list retrieved before resolving non-API filters is used [2].
    This commit changes the logic to resolve non-API filters first and
    then retrieve instances using the updated search_opts.

    Note that the image list is handled a bit specially. If 'image_name'
    is specified as a filter, we retrieve a corresponding image detail
    first before fetching instances to resolve the image name into its ID.
    Otherwise, we retrieve images only related to instances retrieved
    and this happens after retrieving instances.

    [1] https://opendev.org/openstack/horizon/src/commit/f90c3cd50174af4927737e29e2765cd2d7ca507f/openstack_dashboard/dashboards/admin/instances/views.py#L166
    [2] https://opendev.org/openstack/horizon/src/commit/f90c3cd50174af4927737e29e2765cd2d7ca507f/openstack_dashboard/dashboards/admin/instances/views.py#L154

    Closes-Bug: #1888490
    Co-Authored-By: Akihiro Motoki <email address hidden>
    Change-Id: Id43adbd44778d3375c0d49da3f7530cbb99e16fe
    (cherry picked from commit 6b79cdcc1b92a968c967286cc267bac39803c85e)

tags: added: in-stable-ussuri
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon ussuri-eol

This issue was fixed in the openstack/horizon ussuri-eol release.

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.