Return value of shell commands is not checked by plugins

Bug #1000406 reported by Maru Newby
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Gary Kotton

Bug Description

Plugin agents (linuxbridge, ovs, ryu) use a copied implementation of run_cmd to execute shell commands. None of the implementations check the return value of an executed command, which has the potential to violate the dictates of 'fail fast' and complicate debugging.

As a simple example, a missing command will normally cause Popen to raise OSError. If a root_helper like sudo is used, however, no such error is raised and the exit code and/or stderror output are the only indications that something is wrong. None of the plugins check the exit code or stderr output by default.

nova.util.execute() is the benchmark here - exit codes are checked by default, and can only be ignored on a code-by-code basis.

Maru Newby (maru)
summary: - Return value of shell commands is not checked
+ Return value of shell commands is not checked by plugins
description: updated
Juliano Martinez (ncode)
Changed in quantum:
assignee: nobody → Juliano Martinez (juliano-martinez)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (master)

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

Changed in quantum:
status: New → In Progress
Juliano Martinez (ncode)
Changed in quantum:
status: In Progress → Fix Committed
Changed in quantum:
status: Fix Committed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/8033
Committed: http://github.com/openstack/quantum/commit/0230e96196baf4cfd4cb7f556539fe6758367176
Submitter: Jenkins
Branch: master

commit 0230e96196baf4cfd4cb7f556539fe6758367176
Author: Juliano Martinez <email address hidden>
Date: Thu Jun 7 17:56:07 2012 -0300

    Bug #1000406 - Return value of shell commands is not checked by plugins

    Added an utils library for agents and also changed agents to use
    this library.

    Changed to keep 2.4 compatibility

    Change-Id: Ib4fc0a8dcbfc4b79a0b0e61e1fc1f24ec5da4d46

Changed in quantum:
status: In Progress → Fix Committed
Changed in quantum:
assignee: Juliano Martinez (ncode) → Gary Kotton (garyk)
status: Fix Committed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/9203
Committed: http://github.com/openstack/quantum/commit/4742e34a8979d4a9ddb8ea58c0f2c5448723a6fb
Submitter: Jenkins
Branch: master

commit 4742e34a8979d4a9ddb8ea58c0f2c5448723a6fb
Author: Gary Kotton <email address hidden>
Date: Sun Jul 1 03:06:07 2012 -0400

    Check if interface exists in bridge prior to adding.

    This fixes bug 1019730. The fix for bug 1000406 ensures that return
    values of shell commands are checked. The command
        utils.execute(['brctl', 'addif', bridge_name, interface],
                       root_helper=self.root_helper)
    would cause an exception if there was more than one attachment
    on the network. The reason for this was the interface already existed
    on the bridge.

    Change-Id: I8a1f6cc7be930c04ce302d7f87814b9bd5bed129

Changed in quantum:
status: In Progress → Fix Committed
Gary Kotton (garyk)
Changed in quantum:
milestone: none → folsom-2
Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in quantum:
milestone: folsom-2 → 2012.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.