Enable healthcheck middleware
This change makes healtcheck middleware enabled by default, so that operators can use the middleware to monitor service availability for various purpose like healthcheck by load balancers. Change-Id: I47e65d23ebfe310643896e1de3396cd627a3def3
This commit is contained in:
parent
f855abd374
commit
1c17ca4382
@ -5,6 +5,7 @@
|
||||
[composite:osapi_share]
|
||||
use = call:manila.api:root_app_factory
|
||||
/: apiversions
|
||||
/healthcheck: healthcheck
|
||||
/v1: openstack_share_api
|
||||
/v2: openstack_share_api_v2
|
||||
|
||||
@ -57,3 +58,8 @@ paste.filter_factory = keystonemiddleware.auth_token:filter_factory
|
||||
[filter:cors]
|
||||
paste.filter_factory = oslo_middleware.cors:filter_factory
|
||||
oslo_config_project = manila
|
||||
|
||||
[app:healthcheck]
|
||||
paste.app_factory = oslo_middleware:Healthcheck.app_factory
|
||||
backends = disable_by_file
|
||||
disable_by_file_path = /etc/manila/healthcheck_disable
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
import ddt
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
import requests
|
||||
|
||||
from manila.tests.integrated import integrated_helpers
|
||||
|
||||
@ -86,3 +88,17 @@ class TestCORSMiddleware(integrated_helpers._IntegratedTestBase):
|
||||
self.assertEqual(404, response.status)
|
||||
self.assertEqual(acao_header_expected,
|
||||
response.getheader('Access-Control-Allow-Origin'))
|
||||
|
||||
|
||||
class TestHealthCheckMiddleware(integrated_helpers._IntegratedTestBase):
|
||||
|
||||
def test_healthcheck(self):
|
||||
# We verify that we return a HTTP200 when calling api_get
|
||||
url = 'http://%s:%s/healthcheck' % (self.osapi.host, self.osapi.port)
|
||||
response = requests.request(
|
||||
'GET',
|
||||
url,
|
||||
headers={'Accept': 'application/json'})
|
||||
output = jsonutils.loads(response.content)
|
||||
self.assertEqual(200, response.status_code)
|
||||
self.assertEqual(['OK'], output['reasons'])
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The oslo.middleware /healthcheck is now activated by default in the Manila
|
||||
api-paste.ini. Operators can use it to configure HAproxy or the monitoring
|
||||
of Manila APIs. Edit the ``api-paste.ini`` file and remove any healthcheck
|
||||
entries to disable this functionality.
|
Loading…
x
Reference in New Issue
Block a user