Metadata filtering logic too tightly coupled with other code

Bug #1364758 reported by Rushi Agrawal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Rushi Agrawal

Bug Description

The def _get_all_instance_metadata() at https://github.com/openstack/nova/blob/master/nova/compute/api.py#L2885 contains the logic for filtering a list of instances. The problem is, it also contains nova-specific code, e.g. policy checking. This method is being used by describe_tags of the EC2 API too. In an effort to add more resources (e.g. voumes, volume snapshots) to the EC2 API, the filtering logic needs to be abstracted out into a common function for all resources (e.g. get_all_resource_metadata).

Another issue is, the functioning of this filtering logic is only minimally tested in nova's core code. Strangely the filtering logic is extensively tested in the EC2 API tests, which is the wrong place to test them. As a part of fixing this bug, unit tests to test this new common function should be added too.

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

Changed in nova:
status: New → In Progress
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/118554
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b2759edacae209ae07288fa56d76eaaf2947b0a6
Submitter: Jenkins
Branch: master

commit b2759edacae209ae07288fa56d76eaaf2947b0a6
Author: Rushi Agrawal <email address hidden>
Date: Mon Sep 1 14:05:33 2014 +0530

    Move metadata filtering logic to utils.py

    Metadata filtering logic in it's current form is tightly coupled with
    compute code. To make this filtering logic usable for filtering
    metadata of other resources, it is being moved to utils.py file. The
    filtering metadata logic is going to be used for filtering volume and
    volume snapshot metadata in the EC2 API, at the very least.

    There were no unit tests present at all to test the filtering logic.
    Those have been added too, and in the process of writing unit tests,
    a bug was found: a single character value of a resource metadata
    (e.g. 'c') matches when a filter is specified which contains
    that character as a part of input matching string (e.g.
    all resources which has a metadata value = 'taco')

    The bug has also been fixed, and accompanying testcase added

    Closes-Bug: 1364758
    Closes-Bug: 1365887
    Change-Id: Ie9dbb50b79c042e49ef7eaba831280e175cc1e7f

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-2 → 2015.1.0
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.