diff options
| author | Thierry Carrez <thierry@openstack.org> | 2012-06-11 11:37:07 +0200 |
|---|---|---|
| committer | Thierry Carrez <thierry@openstack.org> | 2012-06-11 12:22:40 +0200 |
| commit | 294de0ec6c6b2f5d39dcdc3687a42095fca01288 (patch) | |
| tree | 000831e98cc72813e9e93276235e480d4be1bbe2 /nova | |
| parent | 3ea7dcc6432d6247cb1dc536c31684b595841633 (diff) | |
Do not attempt to kill already-dead dnsmasq
Check that the dnsmasq process is running (and actually looks like a
dnsmasq process) before attempting to kill it. Fixes bug 1010275.
Change-Id: Ib49209e1624dfb30470adbe13d7fc045ec1fdf83
Diffstat (limited to 'nova')
| -rwxr-xr-x | nova/network/linux_net.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index 811395f9c..484320261 100755 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -660,7 +660,14 @@ def update_dhcp_hostfile_with_text(dev, hosts_text): def kill_dhcp(dev): pid = _dnsmasq_pid_for(dev) if pid: - _execute('kill', '-9', pid, run_as_root=True) + # Check that the process exists and looks like a dnsmasq process + conffile = _dhcp_file(dev, 'conf') + out, _err = _execute('cat', '/proc/%d/cmdline' % pid, + check_exit_code=False) + if conffile.split('/')[-1] in out: + _execute('kill', '-9', pid, run_as_root=True) + else: + LOG.debug(_('Pid %d is stale, skip killing dnsmasq'), pid) # NOTE(ja): Sending a HUP only reloads the hostfile, so any |
