blob: 8db2ca1406354b663bc4884a0bf4d9b4b9987cfb [file] [log] [blame]
Don Duggerf84eb5b2014-01-30 09:59:30 -07001# lib/gantt
2# Install and start **Gantt** scheduler service
3
4# Dependencies:
5#
6# - functions
7# - DEST, DATA_DIR, STACK_USER must be defined
8
9# stack.sh
10# ---------
11# - install_gantt
12# - configure_gantt
13# - init_gantt
14# - start_gantt
15# - stop_gantt
16# - cleanup_gantt
17
18# Save trace setting
19XTRACE=$(set +o | grep xtrace)
20set +o xtrace
21
22# Defaults
23# --------
24
25# set up default directories
26GANTT_DIR=$DEST/gantt
27GANTT_STATE_PATH=${GANTT_STATE_PATH:=$DATA_DIR/gantt}
28GANTT_REPO=${GANTT_REPO:-${GIT_BASE}/openstack/gantt.git}
29GANTT_BRANCH=${GANTT_BRANCH:-master}
30
31GANTTCLIENT_DIR=$DEST/python-ganttclient
32GANTTCLIENT_REPO=${GANTT_REPO:-${GIT_BASE}/openstack/python-ganttclient.git}
33GANTTCLIENT_BRANCH=${GANTT_BRANCH:-master}
34
35# eventually we will have a separate gantt config
36# file but for compatibility reasone stick with
37# nova.conf for now
38GANTT_CONF_DIR=${GANTT_CONF_DIR:-/etc/nova}
39GANTT_CONF=$GANTT_CONF_DIR/nova.conf
40
41# Support entry points installation of console scripts
42GANTT_BIN_DIR=$(get_python_exec_prefix)
43
44
45# Functions
46# ---------
47
48# cleanup_gantt() - Remove residual data files, anything left over from previous
49# runs that a clean run would need to clean up
Ian Wienandaee18c72014-02-21 15:35:08 +110050function cleanup_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070051 echo "Cleanup Gantt"
52}
53
54# configure_gantt() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +110055function configure_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070056 echo "Configure Gantt"
57}
58
59# init_gantt() - Initialize database and volume group
Ian Wienandaee18c72014-02-21 15:35:08 +110060function init_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070061 echo "Initialize Gantt"
62}
63
64# install_gantt() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110065function install_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070066 git_clone $GANTT_REPO $GANTT_DIR $GANTT_BRANCH
67 setup_develop $GANTT_DIR
68}
69
70# install_ganttclient() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110071function install_ganttclient {
Don Duggerf84eb5b2014-01-30 09:59:30 -070072 echo "Install Gantt Client"
73# git_clone $GANTTCLIENT_REPO $GANTTCLIENT_DIR $GANTTCLIENT_BRANCH
74# setup_develop $GANTTCLIENT_DIR
75}
76
77# start_gantt() - Start running processes, including screen
Ian Wienandaee18c72014-02-21 15:35:08 +110078function start_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070079 if is_service_enabled gantt; then
80 screen_it gantt "cd $GANTT_DIR && $GANTT_BIN_DIR/gantt-scheduler --config-file $GANTT_CONF"
81 fi
82}
83
84# stop_gantt() - Stop running processes
Ian Wienandaee18c72014-02-21 15:35:08 +110085function stop_gantt {
Don Duggerf84eb5b2014-01-30 09:59:30 -070086 echo "Stop Gantt"
87 screen_stop gantt
88}
89
90# Restore xtrace
91$XTRACE
92
93# Tell emacs to use shell-script-mode
94## Local variables:
95## mode: shell-script
96## End: