Comment 3 for bug 943690

Revision history for this message
JC Martin (jemartin) wrote : Re: [Bug 943690] Re: kill_dhcp fails if dnsmasq is not running

I'll try it: it's simple enough that I'm unlikely to break something else.

jc

Sent from my iPhone

On Mar 1, 2012, at 2:43 AM, "Thierry Carrez" <email address hidden> wrote:

> @JCMartin: would you consider filing the patch to Gerrit, or should I on
> your behalf ?
>
> ** Changed in: nova
> Importance: Undecided => Low
>
> ** Changed in: nova
> Status: New => Triaged
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/943690
>
> Title:
> kill_dhcp fails if dnsmasq is not running
>
> Status in OpenStack Compute (Nova):
> Triaged
>
> Bug description:
> in nova/network/linux_net.py
>
> If dnsmasq is not running, the following line :
>
> pid = _dnsmasq_pid_for(dev)
>
> returns NONE.
> Since
> _execute('kill', '-9', pid, run_as_root=True)
>
> doesn't check for None, this cause the following exception:
>
> Command: sudo nova-rootwrap kill -9 None
> Exit code: 99
> Stdout: 'Unauthorized command: kill -9 None\n'
> Stderr: ''
> (nova): TRACE: Traceback (most recent call last):
> (nova): TRACE: File "/usr/bin/nova-manage", line 2372, in <module>
> (nova): TRACE: main()
> (nova): TRACE: File "/usr/bin/nova-manage", line 2360, in main
> (nova): TRACE: fn(*fn_args, **fn_kwargs)
> (nova): TRACE: File "/usr/bin/nova-manage", line 908, in delete
> (nova): TRACE: fixed_range, uuid)
> (nova): TRACE: File "/usr/lib/python2.7/dist-packages/nova/network/quantum/manager.py", line 251, in delete_network
> (nova): TRACE: self.driver.kill_dhcp(dev)
> (nova): TRACE: File "/usr/lib/python2.7/dist-packages/nova/network/linux_net.py", line 661, in kill_dhcp
> (nova): TRACE: _execute('kill', '-9', pid, run_as_root=True)
> (nova): TRACE: File "/usr/lib/python2.7/dist-packages/nova/network/linux_net.py", line 818, in _execute
> (nova): TRACE: return utils.execute(*cmd, **kwargs)
> (nova): TRACE: File "/usr/lib/python2.7/dist-packages/nova/utils.py", line 225, in execute
> (nova): TRACE: cmd=' '.join(cmd))
> (nova): TRACE: ProcessExecutionError: Unexpected error while running command.
> (nova): TRACE: Command: sudo nova-rootwrap kill -9 None
> (nova): TRACE: Exit code: 99
> (nova): TRACE: Stdout: 'Unauthorized command: kill -9 None\n'
> (nova): TRACE: Stderr: ''
> (nova): TRACE:
>
>
> simple fix is:
>
>
> def kill_dhcp(dev):
> pid = _dnsmasq_pid_for(dev)
> if pid is not None:
> _execute('kill', '-9', pid, run_as_root=True)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nova/+bug/943690/+subscriptions