summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-06-11 13:18:34 +0000
committerGerrit Code Review <review@openstack.org>2012-06-11 13:18:34 +0000
commit7bdf35eb11e41624aa1888dfe9eb4ebae330ff33 (patch)
tree94d23c91bd067b23711eb60758d20ec32a3a6da1 /nova
parentbbdf82c5ec3e31a5dc43948291c4f37ce1098714 (diff)
parent294de0ec6c6b2f5d39dcdc3687a42095fca01288 (diff)
Merge "Do not attempt to kill already-dead dnsmasq"
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