From a8c79c8f846bf137df801f81ca1616a7e611b478 Mon Sep 17 00:00:00 2001 From: Jay Pipes Date: Mon, 13 May 2013 14:20:49 -0400 Subject: [PATCH] Add osapi_compute_link_prefix to nova.conf When a load balancer is used to terminate SSL, it generally strips the https:// from the HTTP_HOST header and changes it to http://. This is used by webob.Request as the request_url that is then used by default when constructing link collections in the OpenStack Compute API. Setting the osapi_compute_link_prefix configuration option allows us to override the URI returned to match the original compute endpoint URI. --- recipes/nova-common.rb | 3 ++- templates/default/nova.conf.erb | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/recipes/nova-common.rb b/recipes/nova-common.rb index 65c3546..99c8ce7 100644 --- a/recipes/nova-common.rb +++ b/recipes/nova-common.rb @@ -131,7 +131,8 @@ class ::Chef::Recipe :glance_api_ipaddress => image_endpoint.host, :glance_api_port => image_endpoint.port, :iscsi_helper => platform_options["iscsi_helper"], - :scheduler_default_filters => node["nova"]["scheduler"]["default_filters"].join(",") + :scheduler_default_filters => node["nova"]["scheduler"]["default_filters"].join(","), + :osapi_compute_link_prefix => nova_api_endpoint.to_s ) end diff --git a/templates/default/nova.conf.erb b/templates/default/nova.conf.erb index c053835..4a4d321 100644 --- a/templates/default/nova.conf.erb +++ b/templates/default/nova.conf.erb @@ -98,6 +98,12 @@ memcached_servers=<%= @memcache_servers %> force_raw_images=<%= node["nova"]["config"]["force_raw_images"] %> allow_same_net_traffic=<%= node["nova"]["config"]["allow_same_net_traffic"] %> osapi_max_limit=<%= node["nova"]["config"]["osapi_max_limit"] %> +# If you terminate SSL with a load balancer, the HTTP_HOST environ +# variable that generates the request_uri in webob.Request will lack +# the HTTPS scheme. Setting this overrides the default and allows +# URIs returned in the various links collections to contain the proper +# HTTPS endpoint. +osapi_compute_link_prefix = <%= @osapi_compute_link_prefix %> snapshot_image_format=<%= node["nova"]["config"]["snapshot_image_format"] %> start_guests_on_host_boot=<%= node["nova"]["config"]["start_guests_on_host_boot"] %> resume_guests_state_on_host_boot=<%= node["nova"]["config"]["resume_guests_state_on_host_boot"] %>