From f84eb5ba43ec0d548e59d982ec149a8feaa4d4d0 Mon Sep 17 00:00:00 2001 From: Don Dugger Date: Thu, 30 Jan 2014 09:59:30 -0700 Subject: [PATCH] Add support for Gantt Gantt is the new breakout of the scheduler code from the Nova source tree. These changes allow devstack to install/configure/startup gantt as the scheduler service for openstack. Change-Id: Ia2b6001f5ccf2469ee9fdee67564c9a915a13862 --- extras.d/70-gantt.sh | 31 ++++++++++++++ lib/gantt | 96 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 extras.d/70-gantt.sh create mode 100644 lib/gantt diff --git a/extras.d/70-gantt.sh b/extras.d/70-gantt.sh new file mode 100644 index 0000000000..ac1efba748 --- /dev/null +++ b/extras.d/70-gantt.sh @@ -0,0 +1,31 @@ +# gantt.sh - Devstack extras script to install Gantt + +if is_service_enabled n-sch; then + disable_service gantt +fi + +if is_service_enabled gantt; then + if [[ "$1" == "source" ]]; then + # Initial source + source $TOP_DIR/lib/gantt + elif [[ "$1" == "stack" && "$2" == "install" ]]; then + echo_summary "Installing Gantt" + install_gantt + cleanup_gantt + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + echo_summary "Configuring Gantt" + configure_gantt + + elif [[ "$1" == "stack" && "$2" == "extra" ]]; then + # Initialize gantt + init_gantt + + # Start gantt + echo_summary "Starting Gantt" + start_gantt + fi + + if [[ "$1" == "unstack" ]]; then + stop_gantt + fi +fi diff --git a/lib/gantt b/lib/gantt new file mode 100644 index 0000000000..832d7590df --- /dev/null +++ b/lib/gantt @@ -0,0 +1,96 @@ +# lib/gantt +# Install and start **Gantt** scheduler service + +# Dependencies: +# +# - functions +# - DEST, DATA_DIR, STACK_USER must be defined + +# stack.sh +# --------- +# - install_gantt +# - configure_gantt +# - init_gantt +# - start_gantt +# - stop_gantt +# - cleanup_gantt + +# Save trace setting +XTRACE=$(set +o | grep xtrace) +set +o xtrace + +# Defaults +# -------- + +# set up default directories +GANTT_DIR=$DEST/gantt +GANTT_STATE_PATH=${GANTT_STATE_PATH:=$DATA_DIR/gantt} +GANTT_REPO=${GANTT_REPO:-${GIT_BASE}/openstack/gantt.git} +GANTT_BRANCH=${GANTT_BRANCH:-master} + +GANTTCLIENT_DIR=$DEST/python-ganttclient +GANTTCLIENT_REPO=${GANTT_REPO:-${GIT_BASE}/openstack/python-ganttclient.git} +GANTTCLIENT_BRANCH=${GANTT_BRANCH:-master} + +# eventually we will have a separate gantt config +# file but for compatibility reasone stick with +# nova.conf for now +GANTT_CONF_DIR=${GANTT_CONF_DIR:-/etc/nova} +GANTT_CONF=$GANTT_CONF_DIR/nova.conf + +# Support entry points installation of console scripts +GANTT_BIN_DIR=$(get_python_exec_prefix) + + +# Functions +# --------- + +# cleanup_gantt() - Remove residual data files, anything left over from previous +# runs that a clean run would need to clean up +function cleanup_gantt() { + echo "Cleanup Gantt" +} + +# configure_gantt() - Set config files, create data dirs, etc +function configure_gantt() { + echo "Configure Gantt" +} + +# init_gantt() - Initialize database and volume group +function init_gantt() { + echo "Initialize Gantt" +} + +# install_gantt() - Collect source and prepare +function install_gantt() { + git_clone $GANTT_REPO $GANTT_DIR $GANTT_BRANCH + setup_develop $GANTT_DIR +} + +# install_ganttclient() - Collect source and prepare +function install_ganttclient() { + echo "Install Gantt Client" +# git_clone $GANTTCLIENT_REPO $GANTTCLIENT_DIR $GANTTCLIENT_BRANCH +# setup_develop $GANTTCLIENT_DIR +} + +# start_gantt() - Start running processes, including screen +function start_gantt() { + if is_service_enabled gantt; then + screen_it gantt "cd $GANTT_DIR && $GANTT_BIN_DIR/gantt-scheduler --config-file $GANTT_CONF" + fi +} + +# stop_gantt() - Stop running processes +function stop_gantt() { + echo "Stop Gantt" + screen_stop gantt +} + +# Restore xtrace +$XTRACE + +# Tell emacs to use shell-script-mode +## Local variables: +## mode: shell-script +## End: