Skip to content

Commit

Permalink
Handle pidfile exception for dnsmasq
Browse files Browse the repository at this point in the history
Capture the exception in dnsmasq_pid_for method. If the pidfile cannot be read
for some reason, it should be treated as if it does not exist. This prevents
issues where the filesystem write delay leaves the file created but empty.
Fixes bug 865399.

Change-Id: I3b0f1211762696f925ae32d785ffa6a35c5e1d6b
  • Loading branch information
Yun Shen authored and viraptor committed Oct 6, 2011
1 parent 981f527 commit a25f106
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Authors
Expand Up @@ -121,6 +121,7 @@ Vladimir Popovski <vladimir@zadarastorage.com>
William Wolf <throughnothing@gmail.com>
Yoshiaki Tamura <yoshi@midokura.jp>
Youcef Laribi <Youcef.Laribi@eu.citrix.com>
Yun Shen <Yun.Shen@hp.com>
Yuriy Taraday <yorik.sar@gmail.com>
Zhixue Wu <Zhixue.Wu@citrix.com>
Zed Shaw <zedshaw@zedshaw.com>
7 changes: 5 additions & 2 deletions nova/network/linux_net.py
Expand Up @@ -793,8 +793,11 @@ def _dnsmasq_pid_for(dev):
pid_file = _dhcp_file(dev, 'pid')

if os.path.exists(pid_file):
with open(pid_file, 'r') as f:
return int(f.read())
try:
with open(pid_file, 'r') as f:
return int(f.read())
except (ValueError, IOError):
return None


def _ra_pid_for(dev):
Expand Down

0 comments on commit a25f106

Please sign in to comment.