Aggregate metadata filtering by key returns unrelated metadata

Bug #1201283 reported by Kieran Spear
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Kieran Spear
Grizzly
Fix Released
Medium
Kieran Spear

Bug Description

Filtering metadata by key using these two DB functions doesn't work correctly:

aggregate_metadata_get_by_host
aggregate_host_get_by_metadata_key

In both cases the function returns metadata from keys other than the target key. This looks due to the code following the Aggregate._metadata relationship which is independent from any filtering done in the original query due to the joinedload().

Tags: db
Kieran Spear (kspear)
Changed in nova:
assignee: nobody → Kieran Spear (kspear)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: New → In Progress
Kieran Spear (kspear)
tags: added: grizzly-backport-potential
Sean Dague (sdague)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/37069
Committed: http://github.com/openstack/nova/commit/7e8fa8f3e6acac0e510cd1fc5af591f9a321d03a
Submitter: Jenkins
Branch: master

commit 7e8fa8f3e6acac0e510cd1fc5af591f9a321d03a
Author: Kieran Spear <email address hidden>
Date: Mon Jul 15 22:00:19 2013 +1000

    Fix filtering aggregate metadata by key

    Filtering by metadata key has no effect in the following two functions:

        aggregate_metadata_get_by_host
        aggregate_host_get_by_metadata_key

    Rely on the explicit join instead of joinedload to load the _metadata
    relationship in these functions (indicated by the contains_eager
    option), so that filtering by key still applies when the metadata is
    collected.

    Fixes bug 1201283.

    Change-Id: I3e44b5db8d67787bfa14f0e57d30a02a271a8833

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/38587

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

Reviewed: https://review.openstack.org/38587
Committed: http://github.com/openstack/nova/commit/c30e03e2aa1acc0207be47b3acc156ddcfd94947
Submitter: Jenkins
Branch: stable/grizzly

commit c30e03e2aa1acc0207be47b3acc156ddcfd94947
Author: Kieran Spear <email address hidden>
Date: Mon Jul 15 22:00:19 2013 +1000

    Fix filtering aggregate metadata by key

    Filtering by metadata key has no effect in the following two functions:

        aggregate_metadata_get_by_host
        aggregate_host_get_by_metadata_key

    Rely on the explicit join instead of joinedload to load the _metadata
    relationship in these functions (indicated by the contains_eager
    option), so that filtering by key still applies when the metadata is
    collected.

    Fixes bug 1201283.

    Conflicts:

     nova/tests/db/test_db_api.py

    Change-Id: I3e44b5db8d67787bfa14f0e57d30a02a271a8833
    (cherry picked from commit 7e8fa8f3e6acac0e510cd1fc5af591f9a321d03a)

tags: added: in-stable-grizzly
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential in-stable-grizzly
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-3 → 2013.2
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.