summaryrefslogtreecommitdiff
path: root/ceilometer/neutron_client.py
diff options
context:
space:
mode:
authorZhiQiang Fan <zhiqiang.fan@huawei.com>2014-11-03 20:57:04 +0800
committerZhiQiang Fan <aji.zqfan@gmail.com>2014-11-20 03:00:22 +0800
commitbd0244ffe63b752649ae74f65a46563e986dcb00 (patch)
treec761fcd12297a45fd5ecfbc8950771aac62e597e /ceilometer/neutron_client.py
parent2117ba760cffd03bf4ce14d63f30fe53f2b363bd (diff)
downloadceilometer-bd0244ffe63b752649ae74f65a46563e986dcb00.tar.gz
Add timeout to all http requests
Currently, we generate lots of samples by polling data from other services, but theses rest requests have no timeout limitation. We have observed that some requests (for example, keystone due to openssl problem) may stuck for over several days (maybe forever if we don't restart the service). Other pollsters in same thread will not be able to work too. The worst thing is that, when outside (keystone) service becomes normal, Ceilometer cannot recover itself automatically, cloud operator needs to restart it manually. So I strongly suggest that we should add timeout limit to **every** rest api call, this is quite important to improve Ceilometer's robust and reliability. This patch adds a new option named http_timeout, and applies it to almost all http requests in Ceilometer project. Change-Id: I76df2c0a9ffacb252e15edbb125e37ccb2aac4aa Closes-Bug: #1388778
Diffstat (limited to 'ceilometer/neutron_client.py')
-rw-r--r--ceilometer/neutron_client.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/ceilometer/neutron_client.py b/ceilometer/neutron_client.py
index 66d3f80e..0d46b9aa 100644
--- a/ceilometer/neutron_client.py
+++ b/ceilometer/neutron_client.py
@@ -30,6 +30,7 @@ SERVICE_OPTS = [
]
cfg.CONF.register_opts(SERVICE_OPTS, group='service_types')
+cfg.CONF.import_opt('http_timeout', 'ceilometer.service')
cfg.CONF.import_group('service_credentials', 'ceilometer.service')
LOG = log.getLogger(__name__)
@@ -65,7 +66,8 @@ class Client(object):
'auth_url': conf.os_auth_url,
'region_name': conf.os_region_name,
'endpoint_type': conf.os_endpoint_type,
- 'service_type': cfg.CONF.service_types.neutron
+ 'timeout': cfg.CONF.http_timeout,
+ 'service_type': cfg.CONF.service_types.neutron,
}
if conf.os_tenant_id: