summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorThierry Carrez <thierry@openstack.org>2012-06-11 11:37:07 +0200
committerThierry Carrez <thierry@openstack.org>2012-06-11 12:22:40 +0200
commit294de0ec6c6b2f5d39dcdc3687a42095fca01288 (patch)
tree000831e98cc72813e9e93276235e480d4be1bbe2 /nova
parent3ea7dcc6432d6247cb1dc536c31684b595841633 (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-xnova/network/linux_net.py9
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