summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYun Shen <Yun.Shen@hp.com>2011-09-29 12:09:37 +0100
committerStanislaw Pitucha <stanislaw.pitucha@hp.com>2011-10-06 10:44:10 +0100
commita25f106c2f824d7d03bf1161da72f66fe4be5a9c (patch)
treea38297e708fa767b2a7ec7d8556fa215c3e0b3cb
parent981f52794ed41b6f25dfc4a25b4b736e8f030a0f (diff)
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
-rw-r--r--Authors1
-rwxr-xr-xnova/network/linux_net.py7
2 files changed, 6 insertions, 2 deletions
diff --git a/Authors b/Authors
index d0b1d0a08..ac69ab67c 100644
--- a/Authors
+++ b/Authors
@@ -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>
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index 19d7b5cf7..9f2ce0828 100755
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -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):