Handle pidfile exception for dnsmasq

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
This commit is contained in:
Yun Shen
2011年09月29日 12:09:37 +01:00
committed by Stanislaw Pitucha
parent 981f52794e
commit a25f106c2f

View File

@@ -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>

View File

@@ -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):
Reference in New Issue
openstack/nova
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.