Move trove into in-tree plugin

Once the trove code is copied into the trove repo and it is used
as a devstack-plugin, we can remove trove-specific code from
devstack.

Change-Id: I8f9f1a015edb7ec1033e2eaf0b29ab15d89384ce
Depends-On: I3506dec0e6097f9c2e9267110fdfb768faa23c85
This commit is contained in:
James E. Blair 2015-03-24 16:32:03 -07:00
parent bf5de0aee4
commit 9e220b9b2b
8 changed files with 10 additions and 318 deletions

View File

@ -75,12 +75,6 @@ SUSE
Tempest
~~~~~~~
Trove
~~~~~
* Nikhil Manchanda <SlickNik@gmail.com>
* Michael Basnight <mbasnight@gmail.com>
Xen
~~~
* Bob Ball <bob.ball@citrix.com>

View File

@ -51,7 +51,6 @@ source $TOP_DIR/lib/ceilometer
source $TOP_DIR/lib/heat
source $TOP_DIR/lib/neutron-legacy
source $TOP_DIR/lib/ironic
source $TOP_DIR/lib/trove
# Extras Source

View File

@ -173,7 +173,6 @@ Scripts
* `lib/swift <lib/swift.html>`__
* `lib/tempest <lib/tempest.html>`__
* `lib/tls <lib/tls.html>`__
* `lib/trove <lib/trove.html>`__
* `lib/zaqar <lib/zaqar.html>`__
* `unstack.sh <unstack.sh.html>`__
* `clean.sh <clean.sh.html>`__
@ -182,7 +181,6 @@ Scripts
* `extras.d/50-ironic.sh <extras.d/50-ironic.sh.html>`__
* `extras.d/60-ceph.sh <extras.d/60-ceph.sh.html>`__
* `extras.d/70-sahara.sh <extras.d/70-sahara.sh.html>`__
* `extras.d/70-trove.sh <extras.d/70-trove.sh.html>`__
* `extras.d/70-tuskar.sh <extras.d/70-tuskar.sh.html>`__
* `extras.d/70-zaqar.sh <extras.d/70-zaqar.sh.html>`__
* `extras.d/80-tempest.sh <extras.d/80-tempest.sh.html>`__
@ -242,6 +240,5 @@ Exercises
* `exercises/sahara.sh <exercises/sahara.sh.html>`__
* `exercises/sec\_groups.sh <exercises/sec_groups.sh.html>`__
* `exercises/swift.sh <exercises/swift.sh.html>`__
* `exercises/trove.sh <exercises/trove.sh.html>`__
* `exercises/volumes.sh <exercises/volumes.sh.html>`__
* `exercises/zaqar.sh <exercises/zaqar.sh.html>`__

View File

@ -1,32 +0,0 @@
# trove.sh - Devstack extras script to install Trove
if is_service_enabled trove; then
if [[ "$1" == "source" ]]; then
# Initial source
source $TOP_DIR/lib/trove
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing Trove"
install_trove
install_troveclient
cleanup_trove
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring Trove"
configure_trove
if is_service_enabled key; then
create_trove_accounts
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize trove
init_trove
# Start the trove API and trove taskmgr components
echo_summary "Starting Trove"
start_trove
fi
if [[ "$1" == "unstack" ]]; then
stop_trove
fi
fi

252
lib/trove
View File

@ -1,252 +0,0 @@
#!/bin/bash
#
# 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
# --------
if is_service_enabled neutron; then
TROVE_HOST_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-172.24.4.1}
else
TROVE_HOST_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1}
fi
# Set up default configuration
GITDIR["python-troveclient"]=$DEST/python-troveclient
TROVE_DIR=$DEST/trove
TROVE_CONF_DIR=${TROVE_CONF_DIR:-/etc/trove}
TROVE_CONF=${TROVE_CONF:-$TROVE_CONF_DIR/trove.conf}
TROVE_TASKMANAGER_CONF=${TROVE_TASKMANAGER_CONF:-$TROVE_CONF_DIR/trove-taskmanager.conf}
TROVE_CONDUCTOR_CONF=${TROVE_CONDUCTOR_CONF:-$TROVE_CONF_DIR/trove-conductor.conf}
TROVE_GUESTAGENT_CONF=${TROVE_GUESTAGENT_CONF:-$TROVE_CONF_DIR/trove-guestagent.conf}
TROVE_API_PASTE_INI=${TROVE_API_PASTE_INI:-$TROVE_CONF_DIR/api-paste.ini}
TROVE_LOCAL_CONF_DIR=$TROVE_DIR/etc/trove
TROVE_LOCAL_API_PASTE_INI=$TROVE_LOCAL_CONF_DIR/api-paste.ini
TROVE_AUTH_CACHE_DIR=${TROVE_AUTH_CACHE_DIR:-/var/cache/trove}
TROVE_DATASTORE_TYPE=${TROVE_DATASTORE_TYPE:-"mysql"}
TROVE_DATASTORE_VERSION=${TROVE_DATASTORE_VERSION:-"5.6"}
TROVE_DATASTORE_PACKAGE=${TROVE_DATASTORE_PACKAGE:-"mysql-server-5.6"}
# Support entry points installation of console scripts
if [[ -d $TROVE_DIR/bin ]]; then
TROVE_BIN_DIR=$TROVE_DIR/bin
else
TROVE_BIN_DIR=$(get_python_exec_prefix)
fi
TROVE_MANAGE=$TROVE_BIN_DIR/trove-manage
# Tell Tempest this project is present
TEMPEST_SERVICES+=,trove
# Functions
# ---------
# Test if any Trove services are enabled
# is_trove_enabled
function is_trove_enabled {
[[ ,${ENABLED_SERVICES} =~ ,"tr-" ]] && return 0
return 1
}
# setup_trove_logging() - Adds logging configuration to conf files
function setup_trove_logging {
local CONF=$1
iniset $CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
iniset $CONF DEFAULT use_syslog $SYSLOG
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
# Add color to logging output
setup_colorized_logging $CONF DEFAULT tenant user
fi
}
# create_trove_accounts() - Set up common required Trove accounts
# Tenant User Roles
# ------------------------------------------------------------------
# service trove admin # if enabled
function create_trove_accounts {
if [[ "$ENABLED_SERVICES" =~ "trove" ]]; then
create_service_user "trove"
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
local trove_service=$(get_or_create_service "trove" \
"database" "Trove Service")
get_or_create_endpoint $trove_service \
"$REGION_NAME" \
"http://$SERVICE_HOST:8779/v1.0/\$(tenant_id)s" \
"http://$SERVICE_HOST:8779/v1.0/\$(tenant_id)s" \
"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_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 install -d -o $STACK_USER ${TROVE_CONF_DIR} ${TROVE_AUTH_CACHE_DIR}
# Copy api-paste file over to the trove conf dir
cp $TROVE_LOCAL_API_PASTE_INI $TROVE_API_PASTE_INI
# (Re)create trove conf files
rm -f $TROVE_CONF
rm -f $TROVE_TASKMANAGER_CONF
rm -f $TROVE_CONDUCTOR_CONF
iniset $TROVE_CONF DEFAULT rabbit_userid $RABBIT_USERID
iniset $TROVE_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
iniset $TROVE_CONF database connection `database_connection_url trove`
iniset $TROVE_CONF DEFAULT default_datastore $TROVE_DATASTORE_TYPE
setup_trove_logging $TROVE_CONF
iniset $TROVE_CONF DEFAULT trove_api_workers "$API_WORKERS"
configure_auth_token_middleware $TROVE_CONF trove $TROVE_AUTH_CACHE_DIR
# (Re)create trove taskmanager conf file if needed
if is_service_enabled tr-tmgr; then
TROVE_AUTH_ENDPOINT=$KEYSTONE_AUTH_URI/v$IDENTITY_API_VERSION
iniset $TROVE_TASKMANAGER_CONF DEFAULT rabbit_userid $RABBIT_USERID
iniset $TROVE_TASKMANAGER_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
iniset $TROVE_TASKMANAGER_CONF database connection `database_connection_url trove`
iniset $TROVE_TASKMANAGER_CONF DEFAULT taskmanager_manager trove.taskmanager.manager.Manager
iniset $TROVE_TASKMANAGER_CONF DEFAULT nova_proxy_admin_user radmin
iniset $TROVE_TASKMANAGER_CONF DEFAULT nova_proxy_admin_tenant_name trove
iniset $TROVE_TASKMANAGER_CONF DEFAULT nova_proxy_admin_pass $RADMIN_USER_PASS
iniset $TROVE_TASKMANAGER_CONF DEFAULT trove_auth_url $TROVE_AUTH_ENDPOINT
setup_trove_logging $TROVE_TASKMANAGER_CONF
fi
# (Re)create trove conductor conf file if needed
if is_service_enabled tr-cond; then
iniset $TROVE_CONDUCTOR_CONF DEFAULT rabbit_userid $RABBIT_USERID
iniset $TROVE_CONDUCTOR_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
iniset $TROVE_CONDUCTOR_CONF database connection `database_connection_url trove`
iniset $TROVE_CONDUCTOR_CONF DEFAULT nova_proxy_admin_user radmin
iniset $TROVE_CONDUCTOR_CONF DEFAULT nova_proxy_admin_tenant_name trove
iniset $TROVE_CONDUCTOR_CONF DEFAULT nova_proxy_admin_pass $RADMIN_USER_PASS
iniset $TROVE_CONDUCTOR_CONF DEFAULT trove_auth_url $TROVE_AUTH_ENDPOINT
iniset $TROVE_CONDUCTOR_CONF DEFAULT control_exchange trove
setup_trove_logging $TROVE_CONDUCTOR_CONF
fi
# Set up Guest Agent conf
iniset $TROVE_GUESTAGENT_CONF DEFAULT rabbit_userid $RABBIT_USERID
iniset $TROVE_GUESTAGENT_CONF DEFAULT rabbit_host $TROVE_HOST_GATEWAY
iniset $TROVE_GUESTAGENT_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
iniset $TROVE_GUESTAGENT_CONF DEFAULT nova_proxy_admin_user radmin
iniset $TROVE_GUESTAGENT_CONF DEFAULT nova_proxy_admin_tenant_name trove
iniset $TROVE_GUESTAGENT_CONF DEFAULT nova_proxy_admin_pass $RADMIN_USER_PASS
iniset $TROVE_GUESTAGENT_CONF DEFAULT trove_auth_url $TROVE_AUTH_ENDPOINT
iniset $TROVE_GUESTAGENT_CONF DEFAULT control_exchange trove
iniset $TROVE_GUESTAGENT_CONF DEFAULT ignore_users os_admin
iniset $TROVE_GUESTAGENT_CONF DEFAULT log_dir /var/log/trove/
iniset $TROVE_GUESTAGENT_CONF DEFAULT log_file trove-guestagent.log
setup_trove_logging $TROVE_GUESTAGENT_CONF
}
# install_troveclient() - Collect source and prepare
function install_troveclient {
if use_library_from_git "python-troveclient"; then
git_clone_by_name "python-troveclient"
setup_dev_lib "python-troveclient"
fi
}
# 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
# Initialize the trove database
$TROVE_MANAGE db_sync
# If no guest image is specified, skip remaining setup
[ -z "$TROVE_GUEST_IMAGE_URL" ] && return 0
# Find the glance id for the trove guest image
# The image is uploaded by stack.sh -- see $IMAGE_URLS handling
GUEST_IMAGE_NAME=$(basename "$TROVE_GUEST_IMAGE_URL")
GUEST_IMAGE_NAME=${GUEST_IMAGE_NAME%.*}
TROVE_GUEST_IMAGE_ID=$(openstack --os-token $TOKEN --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image list | grep "${GUEST_IMAGE_NAME}" | get_field 1)
if [ -z "$TROVE_GUEST_IMAGE_ID" ]; then
# If no glance id is found, skip remaining setup
echo "Datastore ${TROVE_DATASTORE_TYPE} will not be created: guest image ${GUEST_IMAGE_NAME} not found."
return 1
fi
# Now that we have the guest image id, initialize appropriate datastores / datastore versions
$TROVE_MANAGE datastore_update "$TROVE_DATASTORE_TYPE" ""
$TROVE_MANAGE datastore_version_update "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION" "$TROVE_DATASTORE_TYPE" \
"$TROVE_GUEST_IMAGE_ID" "$TROVE_DATASTORE_PACKAGE" 1
$TROVE_MANAGE datastore_version_update "$TROVE_DATASTORE_TYPE" "inactive_version" "inactive_manager" "$TROVE_GUEST_IMAGE_ID" "" 0
$TROVE_MANAGE datastore_update "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION"
$TROVE_MANAGE datastore_update "Inactive_Datastore" ""
}
# start_trove() - Start running processes, including screen
function start_trove {
run_process tr-api "$TROVE_BIN_DIR/trove-api --config-file=$TROVE_CONF --debug"
run_process tr-tmgr "$TROVE_BIN_DIR/trove-taskmanager --config-file=$TROVE_TASKMANAGER_CONF --debug"
run_process tr-cond "$TROVE_BIN_DIR/trove-conductor --config-file=$TROVE_CONDUCTOR_CONF --debug"
}
# stop_trove() - Stop running processes
function stop_trove {
# Kill the trove screen windows
local serv
for serv in tr-api tr-tmgr tr-cond; do
stop_process $serv
done
}
# Restore xtrace
$XTRACE
# Tell emacs to use shell-script-mode
## Local variables:
## mode: shell-script
## End:

28
stackrc
View File

@ -231,11 +231,6 @@ SAHARA_BRANCH=${SAHARA_BRANCH:-master}
SWIFT_REPO=${SWIFT_REPO:-${GIT_BASE}/openstack/swift.git}
SWIFT_BRANCH=${SWIFT_BRANCH:-master}
# trove service
TROVE_REPO=${TROVE_REPO:-${GIT_BASE}/openstack/trove.git}
TROVE_BRANCH=${TROVE_BRANCH:-master}
##############
#
# Testing Components
@ -301,10 +296,6 @@ GITBRANCH["python-saharaclient"]=${SAHARACLIENT_BRANCH:-master}
GITREPO["python-swiftclient"]=${SWIFTCLIENT_REPO:-${GIT_BASE}/openstack/python-swiftclient.git}
GITBRANCH["python-swiftclient"]=${SWIFTCLIENT_BRANCH:-master}
# trove client library test
GITREPO["python-troveclient"]=${TROVECLIENT_REPO:-${GIT_BASE}/openstack/python-troveclient.git}
GITBRANCH["python-troveclient"]=${TROVECLIENT_BRANCH:-master}
# consolidated openstack python client
GITREPO["python-openstackclient"]=${OPENSTACKCLIENT_REPO:-${GIT_BASE}/openstack/python-openstackclient.git}
GITBRANCH["python-openstackclient"]=${OPENSTACKCLIENT_BRANCH:-master}
@ -577,16 +568,15 @@ case "$VIRT_DRIVER" in
IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec.tar.gz"};;
esac
# Trove needs a custom image for its work
if [[ "$ENABLED_SERVICES" =~ 'tr-api' ]]; then
case "$VIRT_DRIVER" in
libvirt|ironic|xenapi)
TROVE_GUEST_IMAGE_URL=${TROVE_GUEST_IMAGE_URL:-"http://tarballs.openstack.org/trove/images/ubuntu/mysql.qcow2"}
IMAGE_URLS+=",${TROVE_GUEST_IMAGE_URL}"
;;
*)
;;
esac
# Staging Area for New Images, have them here for at least 24hrs for nodepool
# to cache them otherwise the failure rates in the gate are too high
PRECACHE_IMAGES=$(trueorfalse False PRECACHE_IMAGES)
if [[ "$PRECACHE_IMAGES" == "True" ]]; then
IMAGE_URL="http://tarballs.openstack.org/trove/images/ubuntu/mysql.qcow2"
if ! [[ "$IMAGE_URLS" =~ "$IMAGE_URL" ]]; then
IMAGE_URLS+=",$IMAGE_URL"
fi
fi
# 10Gb default volume backing file size

View File

@ -29,7 +29,7 @@ for i in $TOP/lib/*; do
fi
done
ALL_LIBS="python-novaclient oslo.config pbr oslo.context python-troveclient"
ALL_LIBS="python-novaclient oslo.config pbr oslo.context"
ALL_LIBS+=" python-keystoneclient taskflow oslo.middleware pycadf"
ALL_LIBS+=" python-glanceclient python-ironicclient tempest-lib"
ALL_LIBS+=" oslo.messaging oslo.log cliff python-heatclient stevedore"

View File

@ -173,10 +173,6 @@ if is_service_enabled neutron; then
cleanup_neutron
fi
if is_service_enabled trove; then
cleanup_trove
fi
if is_service_enabled dstat; then
stop_dstat
fi