From fc744f9713fcccfebeb52e35c7fc1ce955b89200 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 27 Jan 2014 13:45:21 -0600 Subject: [PATCH] Convert trove to plugin Also adds an is_trove_enabled() function to match https://review.openstack.org/69497 changes for is_service_enabled(). Change-Id: Ic0408ff6d9816aec8a3506931470470342a5dcd7 --- extras.d/70-trove | 33 +++++++++++++++++++++++++++++++++ lib/trove | 10 ++++++++++ stack.sh | 26 +------------------------- unstack.sh | 4 ---- 4 files changed, 44 insertions(+), 29 deletions(-) create mode 100644 extras.d/70-trove diff --git a/extras.d/70-trove b/extras.d/70-trove new file mode 100644 index 0000000000..a4dc7fbc5b --- /dev/null +++ b/extras.d/70-trove @@ -0,0 +1,33 @@ +# 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_troveclient + 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 diff --git a/lib/trove b/lib/trove index 8e817f5145..9c91024211 100644 --- a/lib/trove +++ b/lib/trove @@ -38,6 +38,16 @@ else TROVE_BIN_DIR=$(get_python_exec_prefix) fi +# 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 diff --git a/stack.sh b/stack.sh index a2469f1868..45d47c819c 100755 --- a/stack.sh +++ b/stack.sh @@ -3,7 +3,7 @@ # ``stack.sh`` is an opinionated OpenStack developer installation. It # installs and configures various combinations of **Ceilometer**, **Cinder**, # **Glance**, **Heat**, **Horizon**, **Keystone**, **Nova**, **Neutron**, -# **Swift**, and **Trove** +# and **Swift** # This script allows you to specify configuration options of what git # repositories to use, enabled services, network configuration and various @@ -337,7 +337,6 @@ source $TOP_DIR/lib/neutron source $TOP_DIR/lib/baremetal source $TOP_DIR/lib/ldap source $TOP_DIR/lib/ironic -source $TOP_DIR/lib/trove # Extras Source # -------------- @@ -739,12 +738,6 @@ if is_service_enabled heat; then 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 @@ -927,10 +920,6 @@ if is_service_enabled key; then create_cinder_accounts create_neutron_accounts - if is_service_enabled trove; then - create_trove_accounts - fi - if is_service_enabled ceilometer; then create_ceilometer_accounts fi @@ -1204,19 +1193,6 @@ if is_service_enabled heat; then 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/unstack.sh b/unstack.sh index 31f6f01c8f..92d0642c38 100755 --- a/unstack.sh +++ b/unstack.sh @@ -56,7 +56,6 @@ source $TOP_DIR/lib/neutron source $TOP_DIR/lib/baremetal source $TOP_DIR/lib/ldap source $TOP_DIR/lib/ironic -source $TOP_DIR/lib/trove # Extras Source # -------------- @@ -92,9 +91,6 @@ if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then fi # Call service stop -if is_service_enabled trove; then - stop_trove -fi if is_service_enabled heat; then stop_heat