From 430a3de58c3e903fdd63a30bb54c6f367591f104 Mon Sep 17 00:00:00 2001
From: Thomas Goirand <zigo@debian.org>
Date: Thu, 30 Apr 2020 16:56:25 +0200
Subject: [PATCH] Add a /healthcheck URL

This is useful for operators to configure HAProxy and
for monitoring.

Change-Id: Ie735336d143ad38dc10bb8200f9d3b713e603503
---
 etc/nova/api-paste.ini | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Index: nova/etc/nova/api-paste.ini
===================================================================
--- nova.orig/etc/nova/api-paste.ini
+++ nova/etc/nova/api-paste.ini
@@ -6,7 +6,7 @@ use = egg:Paste#urlmap
 /: meta
 
 [pipeline:meta]
-pipeline = cors http_proxy_to_wsgi metaapp
+pipeline = healthcheck cors http_proxy_to_wsgi metaapp
 
 [app:metaapp]
 paste.app_factory = nova.api.metadata.handler:MetadataRequestHandler.factory
@@ -30,17 +30,22 @@ use = call:nova.api.openstack.urlmap:url
 
 [composite:openstack_compute_api_v21]
 use = call:nova.api.auth:pipeline_factory_v21
-keystone = cors http_proxy_to_wsgi compute_req_id faultwrap request_log sizelimit osprofiler authtoken keystonecontext osapi_compute_app_v21
+keystone = healthcheck cors http_proxy_to_wsgi compute_req_id faultwrap request_log sizelimit osprofiler authtoken keystonecontext osapi_compute_app_v21
 # DEPRECATED: The [api]auth_strategy conf option is deprecated and will be
 # removed in a subsequent release, whereupon this pipeline will be unreachable.
-noauth2 = cors http_proxy_to_wsgi compute_req_id faultwrap request_log sizelimit osprofiler noauth2 osapi_compute_app_v21
+noauth2 = healthcheck cors http_proxy_to_wsgi compute_req_id faultwrap request_log sizelimit osprofiler noauth2 osapi_compute_app_v21
 
 [composite:openstack_compute_api_v21_legacy_v2_compatible]
 use = call:nova.api.auth:pipeline_factory_v21
-keystone = cors http_proxy_to_wsgi compute_req_id faultwrap request_log sizelimit osprofiler authtoken keystonecontext legacy_v2_compatible osapi_compute_app_v21
+keystone = healthcheck cors http_proxy_to_wsgi compute_req_id faultwrap request_log sizelimit osprofiler authtoken keystonecontext legacy_v2_compatible osapi_compute_app_v21
 # DEPRECATED: The [api]auth_strategy conf option is deprecated and will be
 # removed in a subsequent release, whereupon this pipeline will be unreachable.
-noauth2 = cors http_proxy_to_wsgi compute_req_id faultwrap request_log sizelimit osprofiler noauth2 legacy_v2_compatible osapi_compute_app_v21
+noauth2 = healthcheck cors http_proxy_to_wsgi compute_req_id faultwrap request_log sizelimit osprofiler noauth2 legacy_v2_compatible osapi_compute_app_v21
+
+[filter:healthcheck]
+use = egg:oslo.middleware#healthcheck
+backends = disable_by_file
+disable_by_file_path = /etc/nova/healthcheck_disable
 
 [filter:request_log]
 paste.filter_factory = nova.api.openstack.requestlog:RequestLog.factory
