From a25f106c2f824d7d03bf1161da72f66fe4be5a9c Mon Sep 17 00:00:00 2001 From: Yun Shen Date: Thu, 29 Sep 2011 12:09:37 +0100 Subject: 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 --- Authors | 1 + nova/network/linux_net.py | 7 +++++-- 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 William Wolf Yoshiaki Tamura Youcef Laribi +Yun Shen Yuriy Taraday Zhixue Wu Zed Shaw 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): -- cgit