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.

(cherry picked from commit a25f106)

Change-Id: Ifd79c7143060702bfe359f0e0a35867c685e27df
  • Loading branch information
Yun Shen authored and markmc committed Oct 25, 2011
1 parent b1ab6da commit ad4eef0
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 @@ -120,6 +120,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 ad4eef0

Please sign in to comment.