blob: 5bd28c28238515e090883179aec912cbfed1804a [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
Don Duggerf84eb5b2014-01-30 09:59:30 -07003# lib/gantt
4# Install and start **Gantt** scheduler service
5
6# Dependencies:
7#
8# - functions
9# - DEST, DATA_DIR, STACK_USER must be defined
10
11# stack.sh
12# ---------
13# - install_gantt
14# - configure_gantt
15# - init_gantt
16# - start_gantt
17# - stop_gantt
18# - cleanup_gantt
19
20# Save trace setting
21XTRACE=$(set +o | grep xtrace)
22set +o xtrace
23
24# Defaults
25# --------
26
27# set up default directories
28GANTT_DIR=$DEST/gantt
29GANTT_STATE_PATH=${GANTT_STATE_PATH:=$DATA_DIR/gantt}
30GANTT_REPO=${GANTT_REPO:-${GIT_BASE}/openstack/gantt.git}
31GANTT_BRANCH=${GANTT_BRANCH:-master}
32
33GANTTCLIENT_DIR=$DEST/python-ganttclient
34GANTTCLIENT_REPO=${GANTT_REPO:-${GIT_BASE}/openstack/python-ganttclient.git}
35GANTTCLIENT_BRANCH=${GANTT_BRANCH:-master}
36
37# eventually we will have a separate gantt config
38# file but for compatibility reasone stick with
39# nova.conf for now
40GANTT_CONF_DIR=${GANTT_CONF_DIR:-/etc/nova}
41GANTT_CONF=$GANTT_CONF_DIR/nova.conf
42
43# Support entry points installation of console scripts
44GANTT_BIN_DIR=$(get_python_exec_prefix)
45
46
47# Functions
48# ---------
49
50# cleanup_gantt() - Remove residual data files, anything left over from previous
51# runs that a clean run would need to clean up
Ian Wienandaee18c72014-02-21 15:35:08 +110052function cleanup_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070053 echo "Cleanup Gantt"
54}
55
56# configure_gantt() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +110057function configure_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070058 echo "Configure Gantt"
59}
60
61# init_gantt() - Initialize database and volume group
Ian Wienandaee18c72014-02-21 15:35:08 +110062function init_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070063 echo "Initialize Gantt"
64}
65
66# install_gantt() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110067function install_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070068 git_clone $GANTT_REPO $GANTT_DIR $GANTT_BRANCH
69 setup_develop $GANTT_DIR
70}
71
72# install_ganttclient() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110073function install_ganttclient {
Don Duggerf84eb5b2014-01-30 09:59:30 -070074 echo "Install Gantt Client"
75# git_clone $GANTTCLIENT_REPO $GANTTCLIENT_DIR $GANTTCLIENT_BRANCH
76# setup_develop $GANTTCLIENT_DIR
77}
78
79# start_gantt() - Start running processes, including screen
Ian Wienandaee18c72014-02-21 15:35:08 +110080function start_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070081 if is_service_enabled gantt; then
Chris Dent2f27a0e2014-09-09 13:46:02 +010082 run_process gantt "$GANTT_BIN_DIR/gantt-scheduler --config-file $GANTT_CONF"
Don Duggerf84eb5b2014-01-30 09:59:30 -070083 fi
84}
85
86# stop_gantt() - Stop running processes
Ian Wienandaee18c72014-02-21 15:35:08 +110087function stop_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070088 echo "Stop Gantt"
Chris Dent2f27a0e2014-09-09 13:46:02 +010089 stop_process gantt
Don Duggerf84eb5b2014-01-30 09:59:30 -070090}
91
92# Restore xtrace
93$XTRACE
94
95# Tell emacs to use shell-script-mode
96## Local variables:
97## mode: shell-script
98## End: