diff options
| author | Yun Shen <Yun.Shen@hp.com> | 2011-09-29 12:09:37 +0100 |
|---|---|---|
| committer | Stanislaw Pitucha <stanislaw.pitucha@hp.com> | 2011-10-06 10:44:10 +0100 |
| commit | a25f106c2f824d7d03bf1161da72f66fe4be5a9c (patch) | |
| tree | a38297e708fa767b2a7ec7d8556fa215c3e0b3cb /nova | |
| parent | 981f52794ed41b6f25dfc4a25b4b736e8f030a0f (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
Diffstat (limited to 'nova')
| -rwxr-xr-x | nova/network/linux_net.py | 7 |
1 files changed, 5 insertions, 2 deletions
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): |
