ip_lib netns.execute should work with or without namespace

Bug #1287524 reported by Carl Baldwin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Carl Baldwin

Bug Description

There are a number of places in the neutron code that run an ip command like this:

        if self.network.namespace:
            ip_wrapper = ip_lib.IPWrapper(self.root_helper,
                                          self.network.namespace)
            ip_wrapper.netns.execute(cmd)
        else:
            utils.execute(cmd, self.root_helper)

This code could be simplified if netns.execute simply checked if there was a namespace defined or not.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
assignee: nobody → Carl Baldwin (carl-baldwin)
status: New → In Progress
Kyle Mestery (mestery)
Changed in neutron:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/77788
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=40390598c5a440d1bbfa4f229130eeedf5cd4dba
Submitter: Jenkins
Branch: master

commit 40390598c5a440d1bbfa4f229130eeedf5cd4dba
Author: Carl Baldwin <email address hidden>
Date: Tue Mar 4 04:24:55 2014 +0000

    Refactor netns.execute so that it is not necessary to check namespace

    I saw some code in a couple of reviews today that check whether a
    namespace is set and run it under "ip netns exec ..." if it is.
    Otherwise, it runs the command without it in the default namespace.

    Change-Id: I55e8f4f3523ec7a7c5a6f082addf918952a05741
    Closes-Bug: #1287524

Changed in neutron:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in neutron:
milestone: none → icehouse-rc1
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: icehouse-rc1 → 2014.1
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.