From 42ecd7d3767041a207735b7242bd5cf6f422956e Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Sat, 2 Dec 2017 10:10:22 -0500 Subject: [PATCH] IPv6 healthcheck fixes for Glance/Swift Add some checks and fixes for IPv6 bracket URLs for the Glance and Swift healthchecks. Also, added the -g option to our healthcheck command to disable the globing parser (which is also required) Change-Id: If6a1ee5a138d4c96a4ee01681f4189d96073efad Closes-bug: 1735923 --- healthcheck/common.sh | 2 +- healthcheck/glance-api | 5 ++++- healthcheck/swift-account-server | 4 ++++ healthcheck/swift-container-server | 4 ++++ healthcheck/swift-object-server | 4 ++++ healthcheck/swift-proxy | 4 ++++ 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/healthcheck/common.sh b/healthcheck/common.sh index 98fa7aead..7d05f333b 100644 --- a/healthcheck/common.sh +++ b/healthcheck/common.sh @@ -3,7 +3,7 @@ : ${HEALTHCHECK_CURL_WRITE_OUT:='\n%{http_code} %{remote_ip}:%{remote_port} %{time_total} seconds\n'} healthcheck_curl () { - curl -q --fail \ + curl -g -q --fail \ --max-time "${HEALTHCHECK_CURL_MAX_TIME}" \ --user-agent "${HEALTHCHECK_CURL_USER_AGENT}" \ --write-out "${HEALTHCHECK_CURL_WRITE_OUT}" \ diff --git a/healthcheck/glance-api b/healthcheck/glance-api index 594e9d5ad..37a470c29 100755 --- a/healthcheck/glance-api +++ b/healthcheck/glance-api @@ -4,6 +4,9 @@ bind_host=$(get_config_val /etc/glance/glance-api.conf DEFAULT bind_host 127.0.0.1) bind_port=$(get_config_val /etc/glance/glance-api.conf DEFAULT bind_port 9292) - +# Add brackets if IPv6 +if [[ $bind_host =~ ":" ]]; then + bind_host="[${bind_host}]" +fi # glance-api is still eventlet healthcheck_curl http://${bind_host}:${bind_port}/ diff --git a/healthcheck/swift-account-server b/healthcheck/swift-account-server index 63195ac6e..d686e6364 100755 --- a/healthcheck/swift-account-server +++ b/healthcheck/swift-account-server @@ -12,4 +12,8 @@ fi # swift-account-server is still eventlet bind_host=$(get_config_val $conf DEFAULT bind_ip 127.0.0.1) bind_port=$(get_config_val $conf DEFAULT bind_port 6002) +# Add brackets if IPv6 +if [[ $bind_host =~ ":" ]]; then + bind_host="[${bind_host}]" +fi healthcheck_curl http://${bind_host}:${bind_port}/healthcheck diff --git a/healthcheck/swift-container-server b/healthcheck/swift-container-server index 3cde3129c..9bb1f5a00 100755 --- a/healthcheck/swift-container-server +++ b/healthcheck/swift-container-server @@ -12,4 +12,8 @@ fi # swift-container-server is still eventlet bind_host=$(get_config_val $conf DEFAULT bind_ip 127.0.0.1) bind_port=$(get_config_val $conf DEFAULT bind_port 6001) +# Add brackets if IPv6 +if [[ $bind_host =~ ":" ]]; then + bind_host="[${bind_host}]" +fi healthcheck_curl http://${bind_host}:${bind_port}/healthcheck diff --git a/healthcheck/swift-object-server b/healthcheck/swift-object-server index d3b79b62c..2e4a35140 100755 --- a/healthcheck/swift-object-server +++ b/healthcheck/swift-object-server @@ -12,4 +12,8 @@ fi # swift-object-server is still eventlet bind_host=$(get_config_val $conf DEFAULT bind_ip 127.0.0.1) bind_port=$(get_config_val $conf DEFAULT bind_port 6000) +# Add brackets if IPv6 +if [[ $bind_host =~ ":" ]]; then + bind_host="[${bind_host}]" +fi healthcheck_curl http://${bind_host}:${bind_port}/healthcheck diff --git a/healthcheck/swift-proxy b/healthcheck/swift-proxy index ed7b53d45..c926dff97 100755 --- a/healthcheck/swift-proxy +++ b/healthcheck/swift-proxy @@ -12,4 +12,8 @@ fi # swift-proxy is still eventlet bind_host=$(get_config_val $conf DEFAULT bind_ip 127.0.0.1) bind_port=$(get_config_val $conf DEFAULT bind_port 8080) +# Add brackets if IPv6 +if [[ $bind_host =~ ":" ]]; then + bind_host="[${bind_host}]" +fi healthcheck_curl http://${bind_host}:${bind_port}/healthcheck