From 6254d5fd0d87e65aa0a53b9fb30b36145e47d46d Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcritten@redhat.com>
Date: Fri, 5 Jun 2015 11:58:15 -0400
Subject: [PATCH] Fix nova and glance discovery URLs when tls-proxy is enabled.

Retrieving the root page in the nova and glance APIs include
URLs for the various versions supported. These are by default
reported using unsecure URLs. Configure the services to report
a SSL-based URL instead.

Change-Id: I220757e53b94a5f6d19291371407220fdf54c645
---
 lib/glance | 1 +
 lib/nova   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/lib/glance b/lib/glance
index 4e1bd24ef5..016ade3479 100644
--- a/lib/glance
+++ b/lib/glance
@@ -154,6 +154,7 @@ function configure_glance {
 
     if is_service_enabled tls-proxy; then
         iniset $GLANCE_API_CONF DEFAULT bind_port $GLANCE_SERVICE_PORT_INT
+        iniset $GLANCE_API_CONF DEFAULT public_endpoint $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT
         iniset $GLANCE_REGISTRY_CONF DEFAULT bind_port $GLANCE_REGISTRY_PORT_INT
     fi
 
diff --git a/lib/nova b/lib/nova
index da288d3e4d..11fa2a0ba4 100644
--- a/lib/nova
+++ b/lib/nova
@@ -489,6 +489,7 @@ function create_nova_conf {
         if is_service_enabled tls-proxy; then
             # Set the service port for a proxy to take the original
             iniset $NOVA_CONF DEFAULT osapi_compute_listen_port "$NOVA_SERVICE_PORT_INT"
+            iniset $NOVA_CONF DEFAULT osapi_compute_link_prefix $NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT
         fi
 
         configure_auth_token_middleware $NOVA_CONF nova $NOVA_AUTH_CACHE_DIR