invoking nova/utils.py's "execute" with check_exit_code=False causes problem in nova-network

Bug #1153751 reported by Samuel XJ
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Medium
Unassigned

Bug Description

version: essex

In nova/network/linux_net.py, there are six invocations of nova/utils.py's "execute" function with "check_exit_code=False." Our experiences show that this pattern is problematic. Specifically, the process executing a given command may exit unexpectedly.

All examples below are related to nova/network/linux_net.py.

Example 1:
In function "ensure_bridge" of class "LinuxBridgeInterfaceDriver," a command "brctl addif" is executed without checking the exit code. The parent process calling "_execute" cannot know whether the execution of "brctl addif" succeeds. This can cause a bridge and a NIC to remain dissociated.

Example 2:
In function "_device_exists," if the execution of "ip link show dev [device]" fails unexpectedly, then neither stdout nor stderr contains any data. According to the logic in "_device_exists," such a fault would lead the caller of "_device_exists" to think that the device in question exists, which may not be the case.

Example 3:
In function "restart_dhcp," if the execution of "cat /proc/[pid]/cmdline" fails unexpectedly, then there may be no data in the stdout, which in turn will cause the caller to believe that a dnsmasq instance has crashed and a new instance should be started, while in fact the existing dnsmasq instance works properly.

The rest occurrences of "check_exit_code=False" raises similar issues.

Revision history for this message
Russell Bryant (russellb) wrote :

This report says Essex, but I just checked the latest code (Grizzly) and the same comments apply there.

Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Michael Still (mikal) wrote :

Is this actually true? utils.execute defaults to checking for a zero exit code, and will raise exception.ProcessExecutionError() if the exit code is anything other than that. Its up to the caller to catch the exception.

Revision history for this message
Samuel XJ (samuel-xj) wrote : Re: [Bug 1153751] Re: invoking nova/utils.py's "execute" with check_exit_code=False causes problem in nova-network

When the caller of "utils.execute" passes "check_exit_code=False," the
default "[0]" expected exit code list will not be used and the related
exception will not be raised. It is the use of "check_exit_code=False" from
the caller side that we think may be problematic.

On Fri, Mar 15, 2013 at 2:44 PM, Michael Still <email address hidden> wrote:

> Is this actually true? utils.execute defaults to checking for a zero
> exit code, and will raise exception.ProcessExecutionError() if the exit
> code is anything other than that. Its up to the caller to catch the
> exception.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1153751
>
> Title:
> invoking nova/utils.py's "execute" with check_exit_code=False causes
> problem in nova-network
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nova/+bug/1153751/+subscriptions
>

Revision history for this message
Joe Gordon (jogo) wrote :

This bug is very old and the code has changed significantly since this was filed. If this is still valid in Icehouse or later please reopen.

Changed in nova:
status: Confirmed → Invalid
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.