Merge "add dstat to see top process info"
diff --git a/clean.sh b/clean.sh
index e16bdb7..09f08dc 100755
--- a/clean.sh
+++ b/clean.sh
@@ -97,7 +97,7 @@
fi
# Do the hypervisor cleanup until this can be moved back into lib/nova
-if [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
+if is_service_enabled nova && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
cleanup_nova_hypervisor
fi
diff --git a/exercises/boot_from_volume.sh b/exercises/boot_from_volume.sh
index ed8ba63..7912046 100755
--- a/exercises/boot_from_volume.sh
+++ b/exercises/boot_from_volume.sh
@@ -30,14 +30,12 @@
# Import common functions
source $TOP_DIR/functions
+# Import project functions
+source $TOP_DIR/lib/cinder
+
# Import configuration
source $TOP_DIR/openrc
-# Import neutron functions if needed
-if is_service_enabled neutron; then
- source $TOP_DIR/lib/neutron
-fi
-
# Import exercise configuration
source $TOP_DIR/exerciserc
diff --git a/exercises/euca.sh b/exercises/euca.sh
index 51b2644..ad852a4 100755
--- a/exercises/euca.sh
+++ b/exercises/euca.sh
@@ -33,11 +33,6 @@
# Import EC2 configuration
source $TOP_DIR/eucarc
-# Import neutron functions if needed
-if is_service_enabled neutron; then
- source $TOP_DIR/lib/neutron
-fi
-
# Import exercise configuration
source $TOP_DIR/exerciserc
diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh
index 4ca90a5..b981aa8 100755
--- a/exercises/floating_ips.sh
+++ b/exercises/floating_ips.sh
@@ -27,14 +27,12 @@
# Import common functions
source $TOP_DIR/functions
+# Import project functions
+source $TOP_DIR/lib/neutron
+
# Import configuration
source $TOP_DIR/openrc
-# Import neutron functions if needed
-if is_service_enabled neutron; then
- source $TOP_DIR/lib/neutron
-fi
-
# Import exercise configuration
source $TOP_DIR/exerciserc
diff --git a/exercises/volumes.sh b/exercises/volumes.sh
index 21b5d21..33e2458 100755
--- a/exercises/volumes.sh
+++ b/exercises/volumes.sh
@@ -27,14 +27,12 @@
# Import common functions
source $TOP_DIR/functions
+# Import project functions
+source $TOP_DIR/lib/cinder
+
# Import configuration
source $TOP_DIR/openrc
-# Import neutron functions if needed
-if is_service_enabled neutron; then
- source $TOP_DIR/lib/neutron
-fi
-
# Import exercise configuration
source $TOP_DIR/exerciserc
diff --git a/functions b/functions
index 281b676..dc3278b 100644
--- a/functions
+++ b/functions
@@ -840,6 +840,16 @@
services=$@
for service in ${services}; do
[[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
+
+ # Look for top-level 'enabled' function for this service
+ if type is_${service}_enabled >/dev/null 2>&1; then
+ # A function exists for this service, use it
+ is_${service}_enabled
+ return $?
+ fi
+
+ # TODO(dtroyer): Remove these legacy special-cases after the is_XXX_enabled()
+ # are implemented
[[ ${service} == n-cell-* && ${ENABLED_SERVICES} =~ "n-cell" ]] && return 0
[[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && return 0
[[ ${service} == "cinder" && ${ENABLED_SERVICES} =~ "c-" ]] && return 0
diff --git a/lib/ceilometer b/lib/ceilometer
index f9c7691..4ca77bb 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -59,7 +59,14 @@
# Functions
# ---------
-#
+
+# Test if any Ceilometer services are enabled
+# is_ceilometer_enabled
+function is_ceilometer_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"ceilometer-" ]] && return 0
+ return 1
+}
+
# create_ceilometer_accounts() - Set up common required ceilometer accounts
create_ceilometer_accounts() {
diff --git a/lib/cinder b/lib/cinder
index 9f70b2a..3ec0fd4 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -85,6 +85,14 @@
# Functions
# ---------
+
+# Test if any Cinder services are enabled
+# is_cinder_enabled
+function is_cinder_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"c-" ]] && return 0
+ return 1
+}
+
# _clean_lvm_lv removes all cinder LVM volumes
#
# Usage: _clean_lvm_lv $VOLUME_GROUP $VOLUME_NAME_PREFIX
diff --git a/lib/glance b/lib/glance
index a5cb360..1ebeeb3 100644
--- a/lib/glance
+++ b/lib/glance
@@ -59,6 +59,13 @@
# Functions
# ---------
+# Test if any Glance services are enabled
+# is_glance_enabled
+function is_glance_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"g-" ]] && return 0
+ return 1
+}
+
# cleanup_glance() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_glance() {
diff --git a/lib/neutron b/lib/neutron
index 81db2a7..5bd38bc 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -244,6 +244,13 @@
# Functions
# ---------
+# Test if any Neutron services are enabled
+# is_neutron_enabled
+function is_neutron_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0
+ return 1
+}
+
# configure_neutron()
# Set common config for all neutron server and agents.
function configure_neutron() {
diff --git a/lib/nova b/lib/nova
index dcf1617..eaaaa62 100644
--- a/lib/nova
+++ b/lib/nova
@@ -129,6 +129,20 @@
# Functions
# ---------
+# Test if any Nova services are enabled
+# is_nova_enabled
+function is_nova_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"n-" ]] && return 0
+ return 1
+}
+
+# Test if any Nova Cell services are enabled
+# is_nova_enabled
+function is_n-cell_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"n-cell-" ]] && return 0
+ return 1
+}
+
# Helper to clean iptables rules
function clean_iptables() {
# Delete rules
diff --git a/lib/swift b/lib/swift
index 4412608..0febb00 100644
--- a/lib/swift
+++ b/lib/swift
@@ -118,6 +118,13 @@
# Functions
# ---------
+# Test if any Swift services are enabled
+# is_swift_enabled
+function is_swift_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"s-" ]] && return 0
+ return 1
+}
+
# cleanup_swift() - Remove residual data files
function cleanup_swift() {
rm -f ${SWIFT_CONF_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz}
diff --git a/lib/template b/lib/template
index 629e110..b8e7c4d 100644
--- a/lib/template
+++ b/lib/template
@@ -10,6 +10,7 @@
# ``stack.sh`` calls the entry points in this order:
#
+# - is_XXXX_enabled
# - install_XXXX
# - configure_XXXX
# - init_XXXX
@@ -35,6 +36,13 @@
# Entry Points
# ------------
+# Test if any XXXX services are enabled
+# is_XXXX_enabled
+function is_XXXX_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"XX-" ]] && return 0
+ return 1
+}
+
# cleanup_XXXX() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_XXXX() {
diff --git a/stack.sh b/stack.sh
index 1dfd4dd..e45707b 100755
--- a/stack.sh
+++ b/stack.sh
@@ -1097,7 +1097,7 @@
fi
# Launch the Glance services
-if is_service_enabled g-api g-reg; then
+if is_service_enabled glance; then
echo_summary "Starting Glance"
start_glance
fi
diff --git a/stackrc b/stackrc
index 7eed60c..9166a17 100644
--- a/stackrc
+++ b/stackrc
@@ -35,7 +35,7 @@
# enable_service neutron
# # Optional, to enable tempest configuration as part of devstack
# enable_service tempest
-ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysql
+ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysql
# Tell Tempest which services are available. The default is set here as
# Tempest falls late in the configuration sequence. This differs from
diff --git a/tools/build_tempest.sh b/tools/build_tempest.sh
deleted file mode 100755
index 6c527f5..0000000
--- a/tools/build_tempest.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env bash
-#
-# **build_tempest.sh**
-
-# Checkout and prepare a Tempest repo: git://git.openstack.org/openstack/tempest.git
-
-function usage {
- echo "$0 - Check out and prepare a Tempest repo"
- echo ""
- echo "Usage: $0"
- exit 1
-}
-
-if [ "$1" = "-h" ]; then
- usage
-fi
-
-# Clean up any resources that may be in use
-cleanup() {
- set +o errexit
-
- # Kill ourselves to signal any calling process
- trap 2; kill -2 $$
-}
-
-trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
-
-# Import common functions
-. $TOP_DIR/functions
-
-# Abort if localrc is not set
-if [ ! -e $TOP_DIR/localrc ]; then
- echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding."
- echo "See stack.sh for required passwords."
- exit 1
-fi
-
-# Source params
-source ./stackrc
-
-# Where Openstack code lives
-DEST=${DEST:-/opt/stack}
-
-TEMPEST_DIR=$DEST/tempest
-
-# Install tests and prerequisites
-git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
-
-trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
diff --git a/unstack.sh b/unstack.sh
index ea9c27d..6351fe0 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -103,7 +103,7 @@
stop_nova
fi
-if is_service_enabled g-api g-reg; then
+if is_service_enabled glance; then
stop_glance
fi