Use openstack/placement instead of placement-in-nova

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
This commit is contained in:
Chris Dent 2018-10-05 10:17:56 +01:00
parent 0c6208c6a0
commit 78a564bb03
4 changed files with 48 additions and 44 deletions

View File

@ -241,8 +241,8 @@
This base job can be used for single node and multinode devstack jobs. This base job can be used for single node and multinode devstack jobs.
With a single node nodeset, this job sets up an "all-in-one" (aio) With a single node nodeset, this job sets up an "all-in-one" (aio)
devstack with the six OpenStack services included in the devstack tree: devstack with the seven OpenStack services included in the devstack tree:
keystone, glance, cinder, neutron, nova and swift. keystone, glance, cinder, neutron, nova, placement, and swift.
With a two node nodeset, this job sets up an aio + compute node. With a two node nodeset, this job sets up an aio + compute node.
The controller can be customised using host-vars.controller, the The controller can be customised using host-vars.controller, the
@ -265,6 +265,7 @@
- git.openstack.org/openstack/keystone - git.openstack.org/openstack/keystone
- git.openstack.org/openstack/neutron - git.openstack.org/openstack/neutron
- git.openstack.org/openstack/nova - git.openstack.org/openstack/nova
- git.openstack.org/openstack/placement
- git.openstack.org/openstack/swift - git.openstack.org/openstack/swift
timeout: 7200 timeout: 7200
vars: vars:

View File

@ -3,9 +3,6 @@
# lib/placement # lib/placement
# Functions to control the configuration and operation of the **Placement** service # Functions to control the configuration and operation of the **Placement** service
# #
# Currently the placement service is embedded in nova. Eventually we
# expect this to change so this file is started as a separate entity
# despite making use of some *NOVA* variables and files.
# Dependencies: # Dependencies:
# #
@ -29,23 +26,21 @@ set +o xtrace
# Defaults # Defaults
# -------- # --------
PLACEMENT_CONF_DIR=/etc/nova PLACEMENT_DIR=$DEST/placement
PLACEMENT_CONF=$PLACEMENT_CONF_DIR/nova.conf PLACEMENT_CONF_DIR=/etc/placement
PLACEMENT_AUTH_STRATEGY=${PLACEMENT_AUTH_STRATEGY:-placement} PLACEMENT_CONF=$PLACEMENT_CONF_DIR/placement.conf
# Nova virtual environment PLACEMENT_AUTH_CACHE_DIR=${PLACEMENT_AUTH_CACHE_DIR:-/var/cache/placement}
PLACEMENT_AUTH_STRATEGY=${PLACEMENT_AUTH_STRATEGY:-keystone}
# Placement virtual environment
if [[ ${USE_VENV} = True ]]; then if [[ ${USE_VENV} = True ]]; then
PROJECT_VENV["nova"]=${NOVA_DIR}.venv PROJECT_VENV["placement"]=${PLACEMENT_DIR}.venv
PLACEMENT_BIN_DIR=${PROJECT_VENV["nova"]}/bin PLACEMENT_BIN_DIR=${PROJECT_VENV["placement"]}/bin
else else
PLACEMENT_BIN_DIR=$(get_python_exec_prefix) PLACEMENT_BIN_DIR=$(get_python_exec_prefix)
fi fi
PLACEMENT_UWSGI=$PLACEMENT_BIN_DIR/nova-placement-api PLACEMENT_UWSGI=$PLACEMENT_BIN_DIR/placement-api
PLACEMENT_UWSGI_CONF=$PLACEMENT_CONF_DIR/placement-uwsgi.ini PLACEMENT_UWSGI_CONF=$PLACEMENT_CONF_DIR/placement-uwsgi.ini
# The placement service can optionally use a separate database
# connection. Set PLACEMENT_DB_ENABLED to True to use it.
PLACEMENT_DB_ENABLED=$(trueorfalse False PLACEMENT_DB_ENABLED)
if is_service_enabled tls-proxy; then if is_service_enabled tls-proxy; then
PLACEMENT_SERVICE_PROTOCOL="https" PLACEMENT_SERVICE_PROTOCOL="https"
fi fi
@ -70,27 +65,26 @@ function cleanup_placement {
sudo rm -f $(apache_site_config_for nova-placement-api) sudo rm -f $(apache_site_config_for nova-placement-api)
sudo rm -f $(apache_site_config_for placement-api) sudo rm -f $(apache_site_config_for placement-api)
remove_uwsgi_config "$PLACEMENT_UWSGI_CONF" "$PLACEMENT_UWSGI" remove_uwsgi_config "$PLACEMENT_UWSGI_CONF" "$PLACEMENT_UWSGI"
sudo rm -f $PLACEMENT_AUTH_CACHE_DIR/*
} }
# _config_placement_apache_wsgi() - Set WSGI config files # _config_placement_apache_wsgi() - Set WSGI config files
function _config_placement_apache_wsgi { function _config_placement_apache_wsgi {
local placement_api_apache_conf local placement_api_apache_conf
local venv_path="" local venv_path=""
local nova_bin_dir="" local placement_bin_dir=""
nova_bin_dir=$(get_python_exec_prefix) placement_bin_dir=$(get_python_exec_prefix)
placement_api_apache_conf=$(apache_site_config_for placement-api) placement_api_apache_conf=$(apache_site_config_for placement-api)
# reuse nova's venv if there is one as placement code lives
# there
if [[ ${USE_VENV} = True ]]; then if [[ ${USE_VENV} = True ]]; then
venv_path="python-path=${PROJECT_VENV["nova"]}/lib/$(python_version)/site-packages" venv_path="python-path=${PROJECT_VENV["placement"]}/lib/$(python_version)/site-packages"
nova_bin_dir=${PROJECT_VENV["nova"]}/bin placement_bin_dir=${PROJECT_VENV["placement"]}/bin
fi fi
sudo cp $FILES/apache-placement-api.template $placement_api_apache_conf sudo cp $FILES/apache-placement-api.template $placement_api_apache_conf
sudo sed -e " sudo sed -e "
s|%APACHE_NAME%|$APACHE_NAME|g; s|%APACHE_NAME%|$APACHE_NAME|g;
s|%PUBLICWSGI%|$nova_bin_dir/nova-placement-api|g; s|%PUBLICWSGI%|$placement_bin_dir/placement-api|g;
s|%SSLENGINE%|$placement_ssl|g; s|%SSLENGINE%|$placement_ssl|g;
s|%SSLCERTFILE%|$placement_certfile|g; s|%SSLCERTFILE%|$placement_certfile|g;
s|%SSLKEYFILE%|$placement_keyfile|g; s|%SSLKEYFILE%|$placement_keyfile|g;
@ -110,19 +104,23 @@ function configure_placement_nova_compute {
iniset $conf placement user_domain_name "$SERVICE_DOMAIN_NAME" iniset $conf placement user_domain_name "$SERVICE_DOMAIN_NAME"
iniset $conf placement project_name "$SERVICE_TENANT_NAME" iniset $conf placement project_name "$SERVICE_TENANT_NAME"
iniset $conf placement project_domain_name "$SERVICE_DOMAIN_NAME" iniset $conf placement project_domain_name "$SERVICE_DOMAIN_NAME"
# TODO(cdent): auth_strategy, which is common to see in these iniset $conf placement auth_strategy $PLACEMENT_AUTH_STRATEGY
# blocks is not currently used here. For the time being the }
# placement api uses the auth_strategy configuration setting
# established by the nova api. This avoids, for the time, being, # create_placement_conf() - Write confg
# creating redundant configuration items that are just used for function create_placement_conf {
# testing. rm -f $PLACEMENT_CONF
iniset $PLACEMENT_CONF placement_database connection `database_connection_url placement`
iniset $PLACEMENT_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
iniset $PLACEMENT_CONF api auth_strategy $PLACEMENT_AUTH_STRATEGY
configure_auth_token_middleware $PLACEMENT_CONF placement $PLACEMENT_AUTH_CACHE_DIR
setup_logging $PLACEMENT_CONF
} }
# configure_placement() - Set config files, create data dirs, etc # configure_placement() - Set config files, create data dirs, etc
function configure_placement { function configure_placement {
if [ "$PLACEMENT_DB_ENABLED" != False ]; then sudo install -d -o $STACK_USER $PLACEMENT_CONF_DIR
iniset $PLACEMENT_CONF placement_database connection `database_connection_url placement` create_placement_conf
fi
if [[ "$WSGI_MODE" == "uwsgi" ]]; then if [[ "$WSGI_MODE" == "uwsgi" ]]; then
write_uwsgi_config "$PLACEMENT_UWSGI_CONF" "$PLACEMENT_UWSGI" "/placement" write_uwsgi_config "$PLACEMENT_UWSGI_CONF" "$PLACEMENT_UWSGI" "/placement"
@ -143,25 +141,28 @@ function create_placement_accounts {
"$placement_api_url" "$placement_api_url"
} }
# create_placement_cache_dir() - Create directories for keystone cache
function create_placement_cache_dir {
# Create cache dir
sudo install -d -o $STACK_USER $PLACEMENT_AUTH_CACHE_DIR
rm -f $PLACEMENT_AUTH_CACHE_DIR/*
}
# init_placement() - Create service user and endpoints # init_placement() - Create service user and endpoints
# If PLACEMENT_DB_ENABLED is true, create the separate placement db
# using, for now, the api_db migrations.
function init_placement { function init_placement {
if [ "$PLACEMENT_DB_ENABLED" != False ]; then recreate_database placement
recreate_database placement $PLACEMENT_BIN_DIR/placement-manage db sync
# Database migration will be handled when nova does an api_db sync
# TODO(cdent): When placement is extracted we'll do our own sync
# here.
fi
create_placement_accounts create_placement_accounts
create_placement_cache_dir
} }
# install_placement() - Collect source and prepare # install_placement() - Collect source and prepare
function install_placement { function install_placement {
install_apache_wsgi install_apache_wsgi
# Install the openstackclient placement client plugin for CLI # Install the openstackclient placement client plugin for CLI
# TODO(mriedem): Use pip_install_gr once osc-placement is in g-r. pip_install_gr osc-placement
pip_install osc-placement git_clone $PLACEMENT_REPO $PLACEMENT_DIR $PLACEMENT_BRANCH
setup_develop $PLACEMENT_DIR
} }
# start_placement_api() - Start the API processes ahead of other things # start_placement_api() - Start the API processes ahead of other things

View File

@ -894,8 +894,6 @@ if is_service_enabled neutron; then
stack_install_service neutron stack_install_service neutron
fi fi
# Nova configuration is used by placement so we need to create nova.conf
# first.
if is_service_enabled nova; then if is_service_enabled nova; then
# Compute service # Compute service
stack_install_service nova stack_install_service nova

View File

@ -298,6 +298,10 @@ NOVA_BRANCH=${NOVA_BRANCH:-$TARGET_BRANCH}
SWIFT_REPO=${SWIFT_REPO:-${GIT_BASE}/openstack/swift.git} SWIFT_REPO=${SWIFT_REPO:-${GIT_BASE}/openstack/swift.git}
SWIFT_BRANCH=${SWIFT_BRANCH:-$TARGET_BRANCH} SWIFT_BRANCH=${SWIFT_BRANCH:-$TARGET_BRANCH}
# placement service
PLACEMENT_REPO=${PLACEMENT_REPO:-${GIT_BASE}/openstack/placement.git}
PLACEMENT_BRANCH=${PLACEMENT_BRANCH:-$TARGET_BRANCH}
############## ##############
# #
# Testing Components # Testing Components