reversed parent,obj parameters in extension code

Bug #1505170 reported by Thomas Morin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
Medium
Thomas Morin
Liberty
Fix Released
Medium
Unassigned

Bug Description

The code handling extension of the Neutron client is not self consistent in the case where parent_id/parent_resource is used.

This makes it impossible, I think, to write an extension with parent_id/parent_resource.

The code in neutronclient/neutron/v2_0/__init__.py always has the parent id as first parameter, and if any, the object id as a second parameter:

python-neutronclient% grep 'def _parent_fx' neutronclient/v2_0/client.py
        def _parent_fx(parent_id, obj, **_params):
        def _parent_fx(parent_id, **_params):
        def _parent_fx(parent_id, body=None):
        def _parent_fx(parent_id, obj):
        def _parent_fx(parent_id, obj, body=None):

The code calling these function, in neutronclient/neutron/v2_0/__init__.py, do not always pass parent_id as first parameter:

python-neutronclient% grep obj_.*parent neutronclient/neutron/v2_0/__init__.py
            data = obj_lister(parent_id, **params)
        data = obj_lister(parent_id, **params)
            data = obj_creator(self.parent_id, body)
            obj_updater(_id, self.parent_id, body)
            obj_deleter(_id, self.parent_id)
            data = obj_lister(self.parent_id, **search_opts)
            data = obj_shower(_id, self.parent_id, **params)

The problematic calls are:
            obj_updater(_id, self.parent_id, body)
            obj_deleter(_id, self.parent_id)
            data = obj_shower(_id, self.parent_id, **params)

Nimish Joshi (jnimish77)
Changed in python-neutronclient:
assignee: nobody → Nimish (jnimish77)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (master)

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

Changed in python-neutronclient:
assignee: Nimish (jnimish77) → Thomas Morin (tmmorin-orange)
status: New → In Progress
Changed in python-neutronclient:
importance: Undecided → Low
tags: added: liberty-backport-potential
Revision history for this message
Thomas Morin (tmmorin-orange) wrote :

We hit the bug in networking-bgpvpn, making it impossible to create the API sub-resources we define server-side.
The impact is thus high on that project

Fixing this in liberty 1 release of python-neutronclient would allow the networking-bgpvpn to not have a less optimal requirement on a later release of python-neutronclient.

Could we fasttrack the fix and a backport in liberty ?

Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

The bug is already marked for L consideration, but it won't happen before the patch is merged in master.

Revision history for this message
Ryan Moats (rmoats) wrote :

Ihar is correct - we have to merge the patch in master first

Revision history for this message
Thomas Morin (tmmorin-orange) wrote :

Ok, so the next step is reviewing the proposed change.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (master)

Reviewed: https://review.openstack.org/233571
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=1ced38c1a72271faabb7ef6d3b37d3f7d329ac4f
Submitter: Jenkins
Branch: master

commit 1ced38c1a72271faabb7ef6d3b37d3f7d329ac4f
Author: Thomas Morin <email address hidden>
Date: Mon Oct 12 12:18:55 2015 +0200

    Revert parent_id and obj_id parameter order

    This change reverts the parameter order between parent_id and
    object id in the definition of obj_updater, obj_deleter, and obj_shower
    in neutronclient/v2_0/client.py, to match the call order in
    neutronclient/neutron/v2_0/__init__.py .

    Fixing the caller code would be the alternative, but would require
    changing the sig of many non-dynmically created methods in
    neutronclient/v2_0/client.py .

    Change-Id: Ia5d499e5a3cf3ff1b357c954f7e82a9066c94982
    Closes-Bug: 1505170

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

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/235140

Revision history for this message
Thomas Morin (tmmorin-orange) wrote :

Do we have a chance to have the fix in the 3.2.0 python-neutronclient release ?

Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

It will of course be included in 3.2.0 (a release from Mitaka), and if backported, in 3.1.1 (next Liberty release).

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-neutronclient (stable/liberty)

Change abandoned by Thomas Morin (<email address hidden>) on branch: stable/liberty
Review: https://review.openstack.org/235140

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/235827

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (stable/liberty)

Reviewed: https://review.openstack.org/235827
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=05908356a7c6828ec26b399e45387a12a6d5cec7
Submitter: Jenkins
Branch: stable/liberty

commit 05908356a7c6828ec26b399e45387a12a6d5cec7
Author: Thomas Morin <email address hidden>
Date: Mon Oct 12 12:18:55 2015 +0200

    Revert parent_id and obj_id parameter order

    This change reverts the parameter order between parent_id and
    object id in the definition of obj_updater, obj_deleter, and obj_shower
    in neutronclient/v2_0/client.py, to match the call order in
    neutronclient/neutron/v2_0/__init__.py .

    Fixing the caller code would be the alternative, but would require
    changing the sig of many non-dynmically created methods in
    neutronclient/v2_0/client.py .

    Change-Id: Ia5d499e5a3cf3ff1b357c954f7e82a9066c94982
    Closes-Bug: 1505170
    (cherry picked from commit 1ced38c1a72271faabb7ef6d3b37d3f7d329ac4f)

tags: added: in-stable-liberty
Revision history for this message
Thomas Morin (tmmorin-orange) wrote :

Would it be possible to consider releasing a stable/liberty revision including this patch ?

Akihiro Motoki (amotoki)
Changed in python-neutronclient:
milestone: none → 4.0.0
Akihiro Motoki (amotoki)
tags: removed: liberty-backport-potential
Akihiro Motoki (amotoki)
Changed in python-neutronclient:
status: Fix Committed → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-neutronclient 4.0.0

This issue was fixed in the openstack/python-neutronclient 4.0.0 release.

Akihiro Motoki (amotoki)
Changed in python-neutronclient:
importance: Low → Medium
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-neutronclient 3.1.1

This issue was fixed in the openstack/python-neutronclient 3.1.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

This issue was fixed in the openstack/python-neutronclient 3.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.