Merge "Convert trove to plugin"
diff --git a/extras.d/70-trove b/extras.d/70-trove
new file mode 100644
index 0000000..a4dc7fb
--- /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 8e817f5..9c91024 100644
--- a/lib/trove
+++ b/lib/trove
@@ -38,6 +38,16 @@
     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 a2469f1..45d47c8 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/baremetal
 source $TOP_DIR/lib/ldap
 source $TOP_DIR/lib/ironic
-source $TOP_DIR/lib/trove
 
 # Extras Source
 # --------------
@@ -739,12 +738,6 @@
     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 @@
     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 @@
     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 31f6f01..92d0642 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -56,7 +56,6 @@
 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 @@
 fi
 
 # Call service stop
-if is_service_enabled trove; then
-    stop_trove
-fi
 
 if is_service_enabled heat; then
     stop_heat