Merge "blueprint devstack-support-for-keystone-mixbackend"
diff --git a/clean.sh b/clean.sh
index a443ac8..6ceb5a4 100755
--- a/clean.sh
+++ b/clean.sh
@@ -33,6 +33,7 @@
source $TOP_DIR/lib/database
source $TOP_DIR/lib/rpc_backend
+source $TOP_DIR/lib/oslo
source $TOP_DIR/lib/tls
source $TOP_DIR/lib/horizon
source $TOP_DIR/lib/keystone
diff --git a/exercises/trove.sh b/exercises/trove.sh
new file mode 100755
index 0000000..d48d5fe
--- /dev/null
+++ b/exercises/trove.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+# **trove.sh**
+
+# Sanity check that trove started if enabled
+
+echo "*********************************************************************"
+echo "Begin DevStack Exercise: $0"
+echo "*********************************************************************"
+
+# This script exits on an error so that errors don't compound and you see
+# only the first error that occurred.
+set -o errexit
+
+# Print the commands being run so that we can see the command that triggers
+# an error. It is also useful for following allowing as the install occurs.
+set -o xtrace
+
+
+# Settings
+# ========
+
+# Keep track of the current directory
+EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
+TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
+
+# Import common functions
+source $TOP_DIR/functions
+
+# Import configuration
+source $TOP_DIR/openrc
+
+# Import exercise configuration
+source $TOP_DIR/exerciserc
+
+is_service_enabled trove || exit 55
+
+# can we get a list versions
+curl http://$SERVICE_HOST:8779/ 2>/dev/null | grep -q 'versions' || die $LINENO "Trove API not functioning!"
+
+set +o xtrace
+echo "*********************************************************************"
+echo "SUCCESS: End DevStack Exercise: $0"
+echo "*********************************************************************"
+
diff --git a/files/apts/trove b/files/apts/trove
new file mode 100644
index 0000000..09dcee8
--- /dev/null
+++ b/files/apts/trove
@@ -0,0 +1 @@
+libxslt1-dev # testonly
diff --git a/files/rpms-suse/trove b/files/rpms-suse/trove
new file mode 100644
index 0000000..09dcee8
--- /dev/null
+++ b/files/rpms-suse/trove
@@ -0,0 +1 @@
+libxslt1-dev # testonly
diff --git a/files/rpms/trove b/files/rpms/trove
new file mode 100644
index 0000000..09dcee8
--- /dev/null
+++ b/files/rpms/trove
@@ -0,0 +1 @@
+libxslt1-dev # testonly
diff --git a/functions b/functions
index d14c973..e1a5f4b 100644
--- a/functions
+++ b/functions
@@ -779,6 +779,7 @@
# **glance** returns true if any service enabled start with **g-**
# **neutron** returns true if any service enabled start with **q-**
# **swift** returns true if any service enabled start with **s-**
+# **trove** returns true if any service enabled start with **tr-**
# For backward compatibility if we have **swift** in ENABLED_SERVICES all the
# **s-** services will be enabled. This will be deprecated in the future.
#
@@ -798,6 +799,7 @@
[[ ${service} == "ceilometer" && ${ENABLED_SERVICES} =~ "ceilometer-" ]] && return 0
[[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && return 0
[[ ${service} == "neutron" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0
+ [[ ${service} == "trove" && ${ENABLED_SERVICES} =~ "tr-" ]] && return 0
[[ ${service} == "swift" && ${ENABLED_SERVICES} =~ "s-" ]] && return 0
[[ ${service} == s-* && ${ENABLED_SERVICES} =~ "swift" ]] && return 0
done
@@ -1158,6 +1160,51 @@
fi
}
+# Returns true if the directory is on a filesystem mounted via NFS.
+function is_nfs_directory() {
+ local mount_type=`stat -f -L -c %T $1`
+ test "$mount_type" == "nfs"
+}
+
+# Only run the command if the target file (the last arg) is not on an
+# NFS filesystem.
+function _safe_permission_operation() {
+ local args=( $@ )
+ local last
+ local sudo_cmd
+ local dir_to_check
+
+ let last="${#args[*]} - 1"
+
+ dir_to_check=${args[$last]}
+ if [ ! -d "$dir_to_check" ]; then
+ dir_to_check=`dirname "$dir_to_check"`
+ fi
+
+ if is_nfs_directory "$dir_to_check" ; then
+ return 0
+ fi
+
+ if [[ $TRACK_DEPENDS = True ]]; then
+ sudo_cmd="env"
+ else
+ sudo_cmd="sudo"
+ fi
+
+ $sudo_cmd $@
+}
+
+# Only change ownership of a file or directory if it is not on an NFS
+# filesystem.
+function safe_chown() {
+ _safe_permission_operation chown $@
+}
+
+# Only change permissions of a file or directory if it is not on an
+# NFS filesystem.
+function safe_chmod() {
+ _safe_permission_operation chmod $@
+}
# ``pip install -e`` the package, which processes the dependencies
# using pip before running `setup.py develop`
@@ -1165,11 +1212,6 @@
# setup_develop directory
function setup_develop() {
local project_dir=$1
- if [[ $TRACK_DEPENDS = True ]]; then
- SUDO_CMD="env"
- else
- SUDO_CMD="sudo"
- fi
echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir"
@@ -1181,7 +1223,7 @@
pip_install -e $project_dir
# ensure that further actions can do things like setup.py sdist
- $SUDO_CMD chown -R $STACK_USER $1/*.egg-info
+ safe_chown -R $STACK_USER $1/*.egg-info
}
diff --git a/lib/glance b/lib/glance
index 64d8b06..7e69682 100644
--- a/lib/glance
+++ b/lib/glance
@@ -39,6 +39,7 @@
GLANCE_API_PASTE_INI=$GLANCE_CONF_DIR/glance-api-paste.ini
GLANCE_CACHE_CONF=$GLANCE_CONF_DIR/glance-cache.conf
GLANCE_POLICY_JSON=$GLANCE_CONF_DIR/policy.json
+GLANCE_SCHEMA_JSON=$GLANCE_CONF_DIR/schema-image.json
# Support entry points installation of console scripts
if [[ -d $GLANCE_DIR/bin ]]; then
@@ -142,6 +143,7 @@
iniset $GLANCE_CACHE_CONF DEFAULT admin_password $SERVICE_PASSWORD
cp -p $GLANCE_DIR/etc/policy.json $GLANCE_POLICY_JSON
+ cp -p $GLANCE_DIR/etc/schema-image.json $GLANCE_SCHEMA_JSON
}
# create_glance_cache_dir() - Part of the init_glance() process
diff --git a/lib/heat b/lib/heat
index ef134ec..afa0eeb 100644
--- a/lib/heat
+++ b/lib/heat
@@ -122,7 +122,7 @@
iniset $HEAT_CONF heat_api_cloudwatch bind_port $HEAT_API_CW_PORT
# Set limits to match tempest defaults
- iniset $HEAT_CONF max_template_size 10240
+ iniset $HEAT_CONF DEFAULT max_template_size 10240
# heat environment
sudo mkdir -p $HEAT_ENV_DIR
diff --git a/lib/trove b/lib/trove
new file mode 100644
index 0000000..e64ca5f
--- /dev/null
+++ b/lib/trove
@@ -0,0 +1,170 @@
+# lib/trove
+# Functions to control the configuration and operation of the **Trove** service
+
+# Dependencies:
+# ``functions`` file
+# ``DEST``, ``STACK_USER`` must be defined
+# ``SERVICE_{HOST|PROTOCOL|TOKEN}`` must be defined
+
+# ``stack.sh`` calls the entry points in this order:
+#
+# install_trove
+# configure_trove
+# init_trove
+# start_trove
+# stop_trove
+# cleanup_trove
+
+# Save trace setting
+XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+# Defaults
+# --------
+
+NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1}
+
+# Set up default configuration
+TROVE_DIR=$DEST/trove
+TROVECLIENT_DIR=$DEST/python-troveclient
+TROVE_CONF_DIR=/etc/trove
+TROVE_LOCAL_CONF_DIR=$TROVE_DIR/etc/trove
+TROVE_AUTH_ENDPOINT=$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT//v$IDENTITY_API_VERSION
+TROVE_AUTH_CACHE_DIR=${TROVE_AUTH_CACHE_DIR:-/var/cache/trove}
+TROVE_BIN_DIR=/usr/local/bin
+
+# create_trove_accounts() - Set up common required trove accounts
+
+# Tenant User Roles
+# ------------------------------------------------------------------
+# service trove admin # if enabled
+
+create_trove_accounts() {
+ # Trove
+ SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
+ SERVICE_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }")
+
+ if [[ "$ENABLED_SERVICES" =~ "trove" ]]; then
+ TROVE_USER=$(keystone user-create --name=trove \
+ --pass="$SERVICE_PASSWORD" \
+ --tenant_id $SERVICE_TENANT \
+ --email=trove@example.com \
+ | grep " id " | get_field 2)
+ keystone user-role-add --tenant-id $SERVICE_TENANT \
+ --user-id $TROVE_USER \
+ --role-id $SERVICE_ROLE
+ if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
+ TROVE_SERVICE=$(keystone service-create \
+ --name=trove \
+ --type=database \
+ --description="Trove Service" \
+ | grep " id " | get_field 2)
+ keystone endpoint-create \
+ --region RegionOne \
+ --service_id $TROVE_SERVICE \
+ --publicurl "http://$SERVICE_HOST:8779/v1.0/\$(tenant_id)s" \
+ --adminurl "http://$SERVICE_HOST:8779/v1.0/\$(tenant_id)s" \
+ --internalurl "http://$SERVICE_HOST:8779/v1.0/\$(tenant_id)s"
+ fi
+ fi
+}
+
+# stack.sh entry points
+# ---------------------
+
+# cleanup_trove() - Remove residual data files, anything left over from previous
+# runs that a clean run would need to clean up
+function cleanup_trove() {
+ #Clean up dirs
+ rm -fr $TROVE_AUTH_CACHE_DIR/*
+ rm -fr $TROVE_CONF_DIR/*
+}
+
+# configure_troveclient() - Set config files, create data dirs, etc
+function configure_troveclient() {
+ setup_develop $TROVECLIENT_DIR
+}
+
+# configure_trove() - Set config files, create data dirs, etc
+function configure_trove() {
+ setup_develop $TROVE_DIR
+
+ # Create the trove conf dir and cache dirs if they don't exist
+ sudo mkdir -p ${TROVE_CONF_DIR}
+ sudo mkdir -p ${TROVE_AUTH_CACHE_DIR}
+ sudo chown -R $STACK_USER: ${TROVE_CONF_DIR}
+ sudo chown -R $STACK_USER: ${TROVE_AUTH_CACHE_DIR}
+
+ # Copy api-paste file over to the trove conf dir and configure it
+ cp $TROVE_LOCAL_CONF_DIR/api-paste.ini $TROVE_CONF_DIR/api-paste.ini
+ TROVE_API_PASTE_INI=$TROVE_CONF_DIR/api-paste.ini
+ iniset $TROVE_API_PASTE_INI filter:tokenauth auth_host $KEYSTONE_AUTH_HOST
+ iniset $TROVE_API_PASTE_INI filter:tokenauth auth_port $KEYSTONE_AUTH_PORT
+ iniset $TROVE_API_PASTE_INI filter:tokenauth auth_protocol $KEYSTONE_AUTH_PROTOCOL
+ iniset $TROVE_API_PASTE_INI filter:tokenauth admin_tenant_name $SERVICE_TENANT_NAME
+ iniset $TROVE_API_PASTE_INI filter:tokenauth admin_user trove
+ iniset $TROVE_API_PASTE_INI filter:tokenauth admin_password $SERVICE_PASSWORD
+ iniset $TROVE_API_PASTE_INI filter:tokenauth signing_dir $TROVE_AUTH_CACHE_DIR
+
+ # (Re)create trove conf files
+ rm -f $TROVE_CONF_DIR/trove.conf
+ rm -f $TROVE_CONF_DIR/trove-taskmanager.conf
+ iniset $TROVE_CONF_DIR/trove.conf DEFAULT rabbit_password $RABBIT_PASSWORD
+ iniset $TROVE_CONF_DIR/trove.conf DEFAULT sql_connection `database_connection_url trove`
+ iniset $TROVE_CONF_DIR/trove.conf DEFAULT add_addresses True
+
+ iniset $TROVE_LOCAL_CONF_DIR/trove-guestagent.conf.sample DEFAULT rabbit_password $RABBIT_PASSWORD
+ iniset $TROVE_LOCAL_CONF_DIR/trove-guestagent.conf.sample DEFAULT sql_connection `database_connection_url trove`
+ sed -i "s/localhost/$NETWORK_GATEWAY/g" $TROVE_LOCAL_CONF_DIR/trove-guestagent.conf.sample
+
+ # (Re)create trove taskmanager conf file if needed
+ if is_service_enabled tr-tmgr; then
+ iniset $TROVE_CONF_DIR/trove-taskmanager.conf DEFAULT rabbit_password $RABBIT_PASSWORD
+ iniset $TROVE_CONF_DIR/trove-taskmanager.conf DEFAULT sql_connection `database_connection_url trove`
+ iniset $TROVE_CONF_DIR/trove-taskmanager.conf DEFAULT taskmanager_manager trove.taskmanager.manager.Manager
+ iniset $TROVE_CONF_DIR/trove-taskmanager.conf DEFAULT nova_proxy_admin_user radmin
+ iniset $TROVE_CONF_DIR/trove-taskmanager.conf DEFAULT nova_proxy_admin_tenant_name trove
+ iniset $TROVE_CONF_DIR/trove-taskmanager.conf DEFAULT nova_proxy_admin_pass $RADMIN_USER_PASS
+ iniset $TROVE_CONF_DIR/trove-taskmanager.conf DEFAULT trove_auth_url $TROVE_AUTH_ENDPOINT
+ fi
+}
+
+# install_troveclient() - Collect source and prepare
+function install_troveclient() {
+ git_clone $TROVECLIENT_REPO $TROVECLIENT_DIR $TROVECLIENT_BRANCH
+}
+
+# install_trove() - Collect source and prepare
+function install_trove() {
+ git_clone $TROVE_REPO $TROVE_DIR $TROVE_BRANCH
+}
+
+# init_trove() - Initializes Trove Database as a Service
+function init_trove() {
+ #(Re)Create trove db
+ recreate_database trove utf8
+
+ #Initialize the trove database
+ $TROVE_DIR/bin/trove-manage db_sync
+}
+
+# start_trove() - Start running processes, including screen
+function start_trove() {
+ screen_it tr-api "cd $TROVE_DIR; bin/trove-api --config-file=$TROVE_CONF_DIR/trove.conf --debug 2>&1"
+ screen_it tr-tmgr "cd $TROVE_DIR; bin/trove-taskmanager --config-file=$TROVE_CONF_DIR/trove-taskmanager.conf --debug 2>&1"
+}
+
+# stop_trove() - Stop running processes
+function stop_trove() {
+ # Kill the trove screen windows
+ for serv in tr-api tr-tmgr; do
+ screen -S $SCREEN_NAME -p $serv -X kill
+ done
+}
+
+# Restore xtrace
+$XTRACE
+
+# Local variables:
+# mode: shell-script
+# End:
diff --git a/stack.sh b/stack.sh
index 89e4c24..71e7317 100755
--- a/stack.sh
+++ b/stack.sh
@@ -2,8 +2,8 @@
# ``stack.sh`` is an opinionated OpenStack developer installation. It
# installs and configures various combinations of **Ceilometer**, **Cinder**,
-# **Glance**, **Heat**, **Horizon**, **Keystone**, **Nova**, **Neutron**
-# and **Swift**.
+# **Glance**, **Heat**, **Horizon**, **Keystone**, **Nova**, **Neutron**,
+# **Swift**, and **Trove**
# This script allows you to specify configuration options of what git
# repositories to use, enabled services, network configuration and various
@@ -203,7 +203,7 @@
echo "Copying files to $STACK_USER user"
STACK_DIR="$DEST/${TOP_DIR##*/}"
cp -r -f -T "$TOP_DIR" "$STACK_DIR"
- chown -R $STACK_USER "$STACK_DIR"
+ safe_chown -R $STACK_USER "$STACK_DIR"
cd "$STACK_DIR"
if [[ "$SHELL_AFTER_RUN" != "no" ]]; then
exec sudo -u $STACK_USER bash -l -c "set -e; bash stack.sh; bash"
@@ -236,8 +236,8 @@
# Create the destination directory and ensure it is writable by the user
# and read/executable by everybody for daemons (e.g. apache run for horizon)
sudo mkdir -p $DEST
-sudo chown -R $STACK_USER $DEST
-chmod 0755 $DEST
+safe_chown -R $STACK_USER $DEST
+safe_chmod 0755 $DEST
# a basic test for $DEST path permissions (fatal on error unless skipped)
check_path_perm_sanity ${DEST}
@@ -258,7 +258,7 @@
# Destination path for service data
DATA_DIR=${DATA_DIR:-${DEST}/data}
sudo mkdir -p $DATA_DIR
-sudo chown -R $STACK_USER $DATA_DIR
+safe_chown -R $STACK_USER $DATA_DIR
# Common Configuration
@@ -319,6 +319,7 @@
source $TOP_DIR/lib/baremetal
source $TOP_DIR/lib/ldap
source $TOP_DIR/lib/ironic
+source $TOP_DIR/lib/trove
# Look for Nova hypervisor plugin
NOVA_PLUGINS=$TOP_DIR/lib/nova_plugins
@@ -720,6 +721,12 @@
configure_heat
fi
+if is_service_enabled trove; then
+ install_trove
+ install_troveclient
+ cleanup_trove
+fi
+
if is_service_enabled tls-proxy; then
configure_CA
init_CA
@@ -860,6 +867,10 @@
create_cinder_accounts
create_neutron_accounts
+ if is_service_enabled trove; then
+ create_trove_accounts
+ fi
+
if is_service_enabled swift || is_service_enabled s-proxy; then
create_swift_accounts
fi
@@ -954,7 +965,7 @@
clean_iptables
rm -rf ${NOVA_STATE_PATH}/networks
sudo mkdir -p ${NOVA_STATE_PATH}/networks
- sudo chown -R ${USER} ${NOVA_STATE_PATH}/networks
+ safe_chown -R ${USER} ${NOVA_STATE_PATH}/networks
# Force IP forwarding on, just in case
sudo sysctl -w net.ipv4.ip_forward=1
fi
@@ -1236,6 +1247,18 @@
start_heat
fi
+# Configure and launch the trove service api, and taskmanager
+if is_service_enabled trove; then
+ # Initialize trove
+ echo_summary "Configuring Trove"
+ configure_troveclient
+ configure_trove
+ init_trove
+
+ # Start the trove API and trove taskmgr components
+ echo_summary "Starting Trove"
+ start_trove
+fi
# Create account rc files
# =======================
diff --git a/stackrc b/stackrc
index f9a977c..3a338d1 100644
--- a/stackrc
+++ b/stackrc
@@ -181,6 +181,13 @@
SPICE_REPO=${SPICE_REPO:-http://anongit.freedesktop.org/git/spice/spice-html5.git}
SPICE_BRANCH=${SPICE_BRANCH:-master}
+# trove service
+TROVE_REPO=${TROVE_REPO:-${GIT_BASE}/openstack/trove.git}
+TROVE_BRANCH=${TROVE_BRANCH:-master}
+
+# trove client library test
+TROVECLIENT_REPO=${TROVECLIENT_REPO:-${GIT_BASE}/openstack/python-troveclient.git}
+TROVECLIENT_BRANCH=${TROVECLIENT_BRANCH:-master}
# Nova hypervisor configuration. We default to libvirt with **kvm** but will
# drop back to **qemu** if we are unable to load the kvm module. ``stack.sh`` can
diff --git a/tools/install_pip.sh b/tools/install_pip.sh
index cb414a7..fc1c195 100755
--- a/tools/install_pip.sh
+++ b/tools/install_pip.sh
@@ -2,13 +2,11 @@
# **install_pip.sh**
-# install_pip.sh [--pip-version <version>] [--use-get-pip] [--setuptools] [--force]
+# install_pip.sh [--pip-version <version>] [--use-get-pip] [--force]
#
# Update pip and friends to a known common version
# Assumptions:
-# - currently we try to leave the system setuptools alone, install
-# the system package if it is not already present
# - update pip to $INSTALL_PIP_VERSION
# Keep track of the current directory
@@ -35,9 +33,6 @@
INSTALL_PIP_VERSION="$2"
shift
;;
- --setuptools)
- SETUPTOOLS=1
- ;;
--use-get-pip)
USE_GET_PIP=1;
;;
@@ -45,7 +40,6 @@
shift
done
-SETUPTOOLS_EZ_SETUP_URL=https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
PIP_GET_PIP_URL=https://raw.github.com/pypa/pip/master/contrib/get-pip.py
PIP_TAR_URL=https://pypi.python.org/packages/source/p/pip/pip-$INSTALL_PIP_VERSION.tar.gz
@@ -55,21 +49,11 @@
function get_versions() {
PIP=$(which pip 2>/dev/null || which pip-python 2>/dev/null)
if [[ -n $PIP ]]; then
- DISTRIBUTE_VERSION=$($PIP freeze | grep 'distribute==')
- SETUPTOOLS_VERSION=$($PIP freeze | grep 'setuptools==')
PIP_VERSION=$($PIP --version | awk '{ print $2}')
- echo "pip: $PIP_VERSION setuptools: $SETUPTOOLS_VERSION distribute: $DISTRIBUTE_VERSION"
+ echo "pip: $PIP_VERSION"
fi
}
-function setuptools_ez_setup() {
- if [[ ! -r $FILES/ez_setup.py ]]; then
- (cd $FILES; \
- curl -OR $SETUPTOOLS_EZ_SETUP_URL; \
- )
- fi
- sudo python $FILES/ez_setup.py
-}
function install_get_pip() {
if [[ ! -r $FILES/get-pip.py ]]; then
@@ -92,29 +76,15 @@
# Show starting versions
get_versions
-# Do setuptools
-if [[ -n "$SETUPTOOLS" ]]; then
- # We want it from source
- uninstall_package python-setuptools
- setuptools_ez_setup
-else
- # See about installing the distro setuptools
- if ! python -c "import setuptools"; then
- install_package python-setuptools
- fi
-fi
-
# Do pip
-if [[ -z $PIP || "$PIP_VERSION" != "$INSTALL_PIP_VERSION" || -n $FORCE ]]; then
- # Eradicate any and all system packages
- uninstall_package python-pip
+# Eradicate any and all system packages
+uninstall_package python-pip
- if [[ -n "$USE_GET_PIP" ]]; then
- install_get_pip
- else
- install_pip_tarball
- fi
-
- get_versions
+if [[ -n "$USE_GET_PIP" ]]; then
+ install_get_pip
+else
+ install_pip_tarball
fi
+
+get_versions
diff --git a/unstack.sh b/unstack.sh
index 38f795b..05d9fb7 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -34,6 +34,7 @@
source $TOP_DIR/lib/swift
source $TOP_DIR/lib/neutron
source $TOP_DIR/lib/ironic
+source $TOP_DIR/lib/trove
# Determine what system we are running on. This provides ``os_VENDOR``,
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
@@ -130,4 +131,8 @@
cleanup_neutron
fi
+if is_service_enabled trove; then
+ cleanup_trove
+fi
+
cleanup_tmp