From aa15b2d7ed02822b72f878e889b3a77c97b4a6c5 Mon Sep 17 00:00:00 2001 From: Pradeep Kilambi Date: Tue, 30 Sep 2014 11:24:20 -0700 Subject: [PATCH] Fix neutron client to catch 404 exceptions When network services such as lbaas, fwaas or vpnaas are disabled in neutron, the discovery continues to poll the api calls and gets back a not found exception. The fix here is to catch the exception so it doesn't go unhandled. Change-Id: I8f350b9009f0d8c172836b1dd1123e966f887fdb Closes-Bug: #1374012 (cherry picked from commit b65554eb460a282a2ab0a2dcc0053a8691cb9373) --- ceilometer/neutron_client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ceilometer/neutron_client.py b/ceilometer/neutron_client.py index 930d7eabfd..c9751cf1ca 100644 --- a/ceilometer/neutron_client.py +++ b/ceilometer/neutron_client.py @@ -16,6 +16,7 @@ import functools +from neutronclient.common import exceptions from neutronclient.v2_0 import client as clientv20 from oslo.config import cfg @@ -40,6 +41,10 @@ def logged(func): def with_logging(*args, **kwargs): try: return func(*args, **kwargs) + except exceptions.NeutronClientException as e: + # handles 404's when services are disabled in neutron + LOG.warn(e) + return [] except Exception as e: LOG.exception(e) raise