Browse code

Placement service only using default HTTPd ports

The placement API configuration was binding a specific port *and* was supporting
to be called by the default HTTPd ports using a Location directive.

Given that the corresponding service catalog entry for the placement service type
doesn't mention the specific application port but is rather using the default
port 80, we can remove that specific port and just use the default config.

Note that we still need to use a VirtualHost directive for the specific placement
config because ErrorLog is only scoped for either server or virtualhost but can't
be set for a Location (or a Directory) context.

Change-Id: I9a26dcff4b879cf9e82e43a3d1aca2e4fe6aa3e6

Sylvain Bauza authored on 2016/12/20 23:34:29
Showing 2 changed files
... ...
@@ -1,6 +1,8 @@
1
-Listen %PUBLICPORT%
2
-
3
-<VirtualHost *:%PUBLICPORT%>
1
+# NOTE(sbauza): This virtualhost is only here because some directives can
2
+# only be set by a virtualhost or server context, so that's why the port is not bound.
3
+# TODO(sbauza): Find a better way to identify a free port that is not corresponding to an existing
4
+# vhost.
5
+<VirtualHost *:8780>
4 6
     WSGIDaemonProcess placement-api processes=%APIWORKERS% threads=1 user=%USER% display-name=%{GROUP} %VIRTUALENV%
5 7
     WSGIProcessGroup placement-api
6 8
     WSGIScriptAlias / %PUBLICWSGI%
... ...
@@ -47,7 +47,6 @@ fi
47 47
 # Public facing bits
48 48
 PLACEMENT_SERVICE_PROTOCOL=${PLACEMENT_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
49 49
 PLACEMENT_SERVICE_HOST=${PLACEMENT_SERVICE_HOST:-$SERVICE_HOST}
50
-PLACEMENT_SERVICE_PORT=${PLACEMENT_SERVICE_PORT:-8778}
51 50
 
52 51
 # Functions
53 52
 # ---------
... ...
@@ -68,7 +67,6 @@ function cleanup_placement {
68 68
 # _config_placement_apache_wsgi() - Set WSGI config files
69 69
 function _config_placement_apache_wsgi {
70 70
     local placement_api_apache_conf
71
-    local placement_api_port=$PLACEMENT_SERVICE_PORT
72 71
     local venv_path=""
73 72
     local nova_bin_dir=""
74 73
     nova_bin_dir=$(get_python_exec_prefix)
... ...
@@ -89,7 +87,6 @@ function _config_placement_apache_wsgi {
89 89
 
90 90
     sudo cp $FILES/apache-placement-api.template $placement_api_apache_conf
91 91
     sudo sed -e "
92
-        s|%PUBLICPORT%|$placement_api_port|g;
93 92
         s|%APACHE_NAME%|$APACHE_NAME|g;
94 93
         s|%PUBLICWSGI%|$nova_bin_dir/nova-placement-api|g;
95 94
         s|%SSLENGINE%|$placement_ssl|g;
... ...
@@ -161,10 +158,6 @@ function install_placement {
161 161
 
162 162
 # start_placement_api() - Start the API processes ahead of other things
163 163
 function start_placement_api {
164
-    # Get right service port for testing
165
-    local service_port=$PLACEMENT_SERVICE_PORT
166
-    local placement_api_port=$PLACEMENT_SERVICE_PORT
167
-
168 164
     enable_apache_site placement-api
169 165
     restart_apache_server
170 166
     tail_log placement-api /var/log/$APACHE_NAME/placement-api.log