aggregate_get_by_host returns aggregates from other hosts

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

Bug Description

This is basically a continuation of:

https://bugs.launchpad.net/nova/+bug/1187708

The fix for that bug seems to only fix the case of aggregates with no hosts being included. If aggregates with a different host exist they are also included in the returned list. An inner joinedload happened to fix the no-hosts case but the host filter is still applied inconsistently due to the lack of an explicit join on AggregateHost. By the look of the query generated it also returns deleted hosts.

rmm0811's comment from the other bug:
"""
I encountered the same problem on grizzly version. And I change the api.py follow the commited.
Howerver, it is also not work well.

According the document of sqlalchemy, query options.(joinedload(c)) is not really join.
query.filter(models.AggregateHost.host == host) can not work.

 http://github.com/openstack/nova/commit/7fadc012939faf063bbe9ad3a2f35067ce16a4b2

nova/db/sqlalchemy/api.py
The line number 4625 need to change like this:
query = query.join("_host").filter(models.AggregateHost.host == host)

nova/tests/db/test_db_api.py
need to add the assert " as is not in result set"
"""

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/37026

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

Reviewed: https://review.openstack.org/37026
Committed: http://github.com/openstack/nova/commit/13513a182a54dffb62900a8464529459dd836136
Submitter: Jenkins
Branch: master

commit 13513a182a54dffb62900a8464529459dd836136
Author: Kieran Spear <email address hidden>
Date: Sun Jul 14 01:08:52 2013 +1000

    Fix aggregate_get_by_host host filtering

    aggregate_get_by_host never actually joins the _hosts relationship,
    so aggregates with non-matching hosts are still included in the output.

    This change adds the join and improves the tests to cover the bug.

    Fixes bug 1201277.

    Change-Id: I87ebfe3de193b9ae47e3a2c8350a49d9cc863fb0

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/38585

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

Reviewed: https://review.openstack.org/38585
Committed: http://github.com/openstack/nova/commit/5685ea870508b9153179526e28daaf7a9328d373
Submitter: Jenkins
Branch: stable/grizzly

commit 5685ea870508b9153179526e28daaf7a9328d373
Author: Kieran Spear <email address hidden>
Date: Sun Jul 14 01:08:52 2013 +1000

    Fix aggregate_get_by_host host filtering

    aggregate_get_by_host never actually joins the _hosts relationship,
    so aggregates with non-matching hosts are still included in the output.

    This change adds the join and improves the tests to cover the bug.

    Fixes bug 1201277.

    Conflicts:

     nova/db/sqlalchemy/api.py
     nova/tests/db/test_db_api.py

    Change-Id: I87ebfe3de193b9ae47e3a2c8350a49d9cc863fb0
    (cherry picked from commit 13513a182a54dffb62900a8464529459dd836136)

Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
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.