We introduce and set PLACEMENT_REPO, add a placement-manage command
to sync database tables (see one of the commits on which this
depends), use /etc/placement/placement.conf for config, and put the
uwsgi config file (pointing to placement-api instead of
nova-placement-api) in /etc/placement.
openstack/placement is also added to the required-projects in
the devstack zuul job.
Change-Id: I0b217e7a8c68a637b7a3445f6c44b7574117e320
... | ... |
@@ -241,8 +241,8 @@ |
241 | 241 |
This base job can be used for single node and multinode devstack jobs. |
242 | 242 |
|
243 | 243 |
With a single node nodeset, this job sets up an "all-in-one" (aio) |
244 |
- devstack with the six OpenStack services included in the devstack tree: |
|
245 |
- keystone, glance, cinder, neutron, nova and swift. |
|
244 |
+ devstack with the seven OpenStack services included in the devstack tree: |
|
245 |
+ keystone, glance, cinder, neutron, nova, placement, and swift. |
|
246 | 246 |
|
247 | 247 |
With a two node nodeset, this job sets up an aio + compute node. |
248 | 248 |
The controller can be customised using host-vars.controller, the |
... | ... |
@@ -265,6 +265,7 @@ |
265 | 265 |
- git.openstack.org/openstack/keystone |
266 | 266 |
- git.openstack.org/openstack/neutron |
267 | 267 |
- git.openstack.org/openstack/nova |
268 |
+ - git.openstack.org/openstack/placement |
|
268 | 269 |
- git.openstack.org/openstack/swift |
269 | 270 |
timeout: 7200 |
270 | 271 |
vars: |
... | ... |
@@ -3,9 +3,6 @@ |
3 | 3 |
# lib/placement |
4 | 4 |
# Functions to control the configuration and operation of the **Placement** service |
5 | 5 |
# |
6 |
-# Currently the placement service is embedded in nova. Eventually we |
|
7 |
-# expect this to change so this file is started as a separate entity |
|
8 |
-# despite making use of some *NOVA* variables and files. |
|
9 | 6 |
|
10 | 7 |
# Dependencies: |
11 | 8 |
# |
... | ... |
@@ -29,23 +26,21 @@ set +o xtrace |
29 | 29 |
# Defaults |
30 | 30 |
# -------- |
31 | 31 |
|
32 |
-PLACEMENT_CONF_DIR=/etc/nova |
|
33 |
-PLACEMENT_CONF=$PLACEMENT_CONF_DIR/nova.conf |
|
34 |
-PLACEMENT_AUTH_STRATEGY=${PLACEMENT_AUTH_STRATEGY:-placement} |
|
35 |
-# Nova virtual environment |
|
32 |
+PLACEMENT_DIR=$DEST/placement |
|
33 |
+PLACEMENT_CONF_DIR=/etc/placement |
|
34 |
+PLACEMENT_CONF=$PLACEMENT_CONF_DIR/placement.conf |
|
35 |
+PLACEMENT_AUTH_CACHE_DIR=${PLACEMENT_AUTH_CACHE_DIR:-/var/cache/placement} |
|
36 |
+PLACEMENT_AUTH_STRATEGY=${PLACEMENT_AUTH_STRATEGY:-keystone} |
|
37 |
+# Placement virtual environment |
|
36 | 38 |
if [[ ${USE_VENV} = True ]]; then |
37 |
- PROJECT_VENV["nova"]=${NOVA_DIR}.venv |
|
38 |
- PLACEMENT_BIN_DIR=${PROJECT_VENV["nova"]}/bin |
|
39 |
+ PROJECT_VENV["placement"]=${PLACEMENT_DIR}.venv |
|
40 |
+ PLACEMENT_BIN_DIR=${PROJECT_VENV["placement"]}/bin |
|
39 | 41 |
else |
40 | 42 |
PLACEMENT_BIN_DIR=$(get_python_exec_prefix) |
41 | 43 |
fi |
42 |
-PLACEMENT_UWSGI=$PLACEMENT_BIN_DIR/nova-placement-api |
|
44 |
+PLACEMENT_UWSGI=$PLACEMENT_BIN_DIR/placement-api |
|
43 | 45 |
PLACEMENT_UWSGI_CONF=$PLACEMENT_CONF_DIR/placement-uwsgi.ini |
44 | 46 |
|
45 |
-# The placement service can optionally use a separate database |
|
46 |
-# connection. Set PLACEMENT_DB_ENABLED to True to use it. |
|
47 |
-PLACEMENT_DB_ENABLED=$(trueorfalse False PLACEMENT_DB_ENABLED) |
|
48 |
- |
|
49 | 47 |
if is_service_enabled tls-proxy; then |
50 | 48 |
PLACEMENT_SERVICE_PROTOCOL="https" |
51 | 49 |
fi |
... | ... |
@@ -70,27 +65,26 @@ function cleanup_placement { |
70 | 70 |
sudo rm -f $(apache_site_config_for nova-placement-api) |
71 | 71 |
sudo rm -f $(apache_site_config_for placement-api) |
72 | 72 |
remove_uwsgi_config "$PLACEMENT_UWSGI_CONF" "$PLACEMENT_UWSGI" |
73 |
+ sudo rm -f $PLACEMENT_AUTH_CACHE_DIR/* |
|
73 | 74 |
} |
74 | 75 |
|
75 | 76 |
# _config_placement_apache_wsgi() - Set WSGI config files |
76 | 77 |
function _config_placement_apache_wsgi { |
77 | 78 |
local placement_api_apache_conf |
78 | 79 |
local venv_path="" |
79 |
- local nova_bin_dir="" |
|
80 |
- nova_bin_dir=$(get_python_exec_prefix) |
|
80 |
+ local placement_bin_dir="" |
|
81 |
+ placement_bin_dir=$(get_python_exec_prefix) |
|
81 | 82 |
placement_api_apache_conf=$(apache_site_config_for placement-api) |
82 | 83 |
|
83 |
- # reuse nova's venv if there is one as placement code lives |
|
84 |
- # there |
|
85 | 84 |
if [[ ${USE_VENV} = True ]]; then |
86 |
- venv_path="python-path=${PROJECT_VENV["nova"]}/lib/$(python_version)/site-packages" |
|
87 |
- nova_bin_dir=${PROJECT_VENV["nova"]}/bin |
|
85 |
+ venv_path="python-path=${PROJECT_VENV["placement"]}/lib/$(python_version)/site-packages" |
|
86 |
+ placement_bin_dir=${PROJECT_VENV["placement"]}/bin |
|
88 | 87 |
fi |
89 | 88 |
|
90 | 89 |
sudo cp $FILES/apache-placement-api.template $placement_api_apache_conf |
91 | 90 |
sudo sed -e " |
92 | 91 |
s|%APACHE_NAME%|$APACHE_NAME|g; |
93 |
- s|%PUBLICWSGI%|$nova_bin_dir/nova-placement-api|g; |
|
92 |
+ s|%PUBLICWSGI%|$placement_bin_dir/placement-api|g; |
|
94 | 93 |
s|%SSLENGINE%|$placement_ssl|g; |
95 | 94 |
s|%SSLCERTFILE%|$placement_certfile|g; |
96 | 95 |
s|%SSLKEYFILE%|$placement_keyfile|g; |
... | ... |
@@ -110,19 +104,23 @@ function configure_placement_nova_compute { |
110 | 110 |
iniset $conf placement user_domain_name "$SERVICE_DOMAIN_NAME" |
111 | 111 |
iniset $conf placement project_name "$SERVICE_TENANT_NAME" |
112 | 112 |
iniset $conf placement project_domain_name "$SERVICE_DOMAIN_NAME" |
113 |
- # TODO(cdent): auth_strategy, which is common to see in these |
|
114 |
- # blocks is not currently used here. For the time being the |
|
115 |
- # placement api uses the auth_strategy configuration setting |
|
116 |
- # established by the nova api. This avoids, for the time, being, |
|
117 |
- # creating redundant configuration items that are just used for |
|
118 |
- # testing. |
|
113 |
+ iniset $conf placement auth_strategy $PLACEMENT_AUTH_STRATEGY |
|
114 |
+} |
|
115 |
+ |
|
116 |
+# create_placement_conf() - Write confg |
|
117 |
+function create_placement_conf { |
|
118 |
+ rm -f $PLACEMENT_CONF |
|
119 |
+ iniset $PLACEMENT_CONF placement_database connection `database_connection_url placement` |
|
120 |
+ iniset $PLACEMENT_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL" |
|
121 |
+ iniset $PLACEMENT_CONF api auth_strategy $PLACEMENT_AUTH_STRATEGY |
|
122 |
+ configure_auth_token_middleware $PLACEMENT_CONF placement $PLACEMENT_AUTH_CACHE_DIR |
|
123 |
+ setup_logging $PLACEMENT_CONF |
|
119 | 124 |
} |
120 | 125 |
|
121 | 126 |
# configure_placement() - Set config files, create data dirs, etc |
122 | 127 |
function configure_placement { |
123 |
- if [ "$PLACEMENT_DB_ENABLED" != False ]; then |
|
124 |
- iniset $PLACEMENT_CONF placement_database connection `database_connection_url placement` |
|
125 |
- fi |
|
128 |
+ sudo install -d -o $STACK_USER $PLACEMENT_CONF_DIR |
|
129 |
+ create_placement_conf |
|
126 | 130 |
|
127 | 131 |
if [[ "$WSGI_MODE" == "uwsgi" ]]; then |
128 | 132 |
write_uwsgi_config "$PLACEMENT_UWSGI_CONF" "$PLACEMENT_UWSGI" "/placement" |
... | ... |
@@ -143,25 +141,28 @@ function create_placement_accounts { |
143 | 143 |
"$placement_api_url" |
144 | 144 |
} |
145 | 145 |
|
146 |
+# create_placement_cache_dir() - Create directories for keystone cache |
|
147 |
+function create_placement_cache_dir { |
|
148 |
+ # Create cache dir |
|
149 |
+ sudo install -d -o $STACK_USER $PLACEMENT_AUTH_CACHE_DIR |
|
150 |
+ rm -f $PLACEMENT_AUTH_CACHE_DIR/* |
|
151 |
+} |
|
152 |
+ |
|
146 | 153 |
# init_placement() - Create service user and endpoints |
147 |
-# If PLACEMENT_DB_ENABLED is true, create the separate placement db |
|
148 |
-# using, for now, the api_db migrations. |
|
149 | 154 |
function init_placement { |
150 |
- if [ "$PLACEMENT_DB_ENABLED" != False ]; then |
|
151 |
- recreate_database placement |
|
152 |
- # Database migration will be handled when nova does an api_db sync |
|
153 |
- # TODO(cdent): When placement is extracted we'll do our own sync |
|
154 |
- # here. |
|
155 |
- fi |
|
155 |
+ recreate_database placement |
|
156 |
+ $PLACEMENT_BIN_DIR/placement-manage db sync |
|
156 | 157 |
create_placement_accounts |
158 |
+ create_placement_cache_dir |
|
157 | 159 |
} |
158 | 160 |
|
159 | 161 |
# install_placement() - Collect source and prepare |
160 | 162 |
function install_placement { |
161 | 163 |
install_apache_wsgi |
162 | 164 |
# Install the openstackclient placement client plugin for CLI |
163 |
- # TODO(mriedem): Use pip_install_gr once osc-placement is in g-r. |
|
164 |
- pip_install osc-placement |
|
165 |
+ pip_install_gr osc-placement |
|
166 |
+ git_clone $PLACEMENT_REPO $PLACEMENT_DIR $PLACEMENT_BRANCH |
|
167 |
+ setup_develop $PLACEMENT_DIR |
|
165 | 168 |
} |
166 | 169 |
|
167 | 170 |
# start_placement_api() - Start the API processes ahead of other things |
... | ... |
@@ -894,8 +894,6 @@ if is_service_enabled neutron; then |
894 | 894 |
stack_install_service neutron |
895 | 895 |
fi |
896 | 896 |
|
897 |
-# Nova configuration is used by placement so we need to create nova.conf |
|
898 |
-# first. |
|
899 | 897 |
if is_service_enabled nova; then |
900 | 898 |
# Compute service |
901 | 899 |
stack_install_service nova |
... | ... |
@@ -298,6 +298,10 @@ NOVA_BRANCH=${NOVA_BRANCH:-$TARGET_BRANCH} |
298 | 298 |
SWIFT_REPO=${SWIFT_REPO:-${GIT_BASE}/openstack/swift.git} |
299 | 299 |
SWIFT_BRANCH=${SWIFT_BRANCH:-$TARGET_BRANCH} |
300 | 300 |
|
301 |
+# placement service |
|
302 |
+PLACEMENT_REPO=${PLACEMENT_REPO:-${GIT_BASE}/openstack/placement.git} |
|
303 |
+PLACEMENT_BRANCH=${PLACEMENT_BRANCH:-$TARGET_BRANCH} |
|
304 |
+ |
|
301 | 305 |
############## |
302 | 306 |
# |
303 | 307 |
# Testing Components |