instance_get_all_by_host joins tables even if told not to

Bug #1680616 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Matt Riedemann
Ocata
Fix Committed
Medium
Matt Riedemann

Bug Description

The instance_get_all_by_host DB API will join the info_cache and security_groups tables even if told not to by passing in columns_to_join=[], which the _sync_instance_scheduler_info periodic task from the compute manager does.

That is because instance_get_all_by_host doesn't pass columns_to_join through to _instance_get_all_query which will default to join on info_cache and security_groups:

https://github.com/openstack/nova/blob/6103ec7c113121866344cdca2fbbbf7b80dfa975/nova/db/sqlalchemy/api.py#L2530

https://github.com/openstack/nova/blob/6103ec7c113121866344cdca2fbbbf7b80dfa975/nova/db/sqlalchemy/api.py#L2513

Tags: db
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/454368

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/454368
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=d52bcc616f2d1c0df7bad8a6f5a00adc7ad1fb27
Submitter: Jenkins
Branch: master

commit d52bcc616f2d1c0df7bad8a6f5a00adc7ad1fb27
Author: Matt Riedemann <email address hidden>
Date: Thu Apr 6 17:59:34 2017 -0400

    Fix joins in instance_get_all_by_host

    Some callers of instance_get_all_by_host are passing
    in columns_to_join=[], like the _sync_scheduler_instance_info
    periodic task in the compute manager, to avoid unnecessary
    joins with other tables.

    The problem was columns_to_join wasn't being passed through
    to _instance_get_all_query which builds the actual query
    method, and defaults to join on info_cache and security_groups.

    This fixes the problem by passing through columns_to_join and
    provides tests to show it working both with and without the joins.

    Change-Id: I69f2ddca8fb0935e03b0f426891d01360940a85a
    Closes-Bug: #1680616

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

This issue was fixed in the openstack/nova 16.0.0.0b1 development milestone.

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

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/511682

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

Reviewed: https://review.openstack.org/511682
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=e2c2b1d586f4e24f0e4f3fc760c687e03c501ec7
Submitter: Zuul
Branch: stable/ocata

commit e2c2b1d586f4e24f0e4f3fc760c687e03c501ec7
Author: Matt Riedemann <email address hidden>
Date: Thu Apr 6 17:59:34 2017 -0400

    Fix joins in instance_get_all_by_host

    Some callers of instance_get_all_by_host are passing
    in columns_to_join=[], like the _sync_scheduler_instance_info
    periodic task in the compute manager, to avoid unnecessary
    joins with other tables.

    The problem was columns_to_join wasn't being passed through
    to _instance_get_all_query which builds the actual query
    method, and defaults to join on info_cache and security_groups.

    This fixes the problem by passing through columns_to_join and
    provides tests to show it working both with and without the joins.

    Change-Id: I69f2ddca8fb0935e03b0f426891d01360940a85a
    Closes-Bug: #1680616
    (cherry picked from commit d52bcc616f2d1c0df7bad8a6f5a00adc7ad1fb27)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 15.1.1

This issue was fixed in the openstack/nova 15.1.1 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.