| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 1 | # 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 | 
 | 19 | XTRACE=$(set +o | grep xtrace) | 
 | 20 | set +o xtrace | 
 | 21 |  | 
 | 22 | # Defaults | 
 | 23 | # -------- | 
 | 24 |  | 
 | 25 | # set up default directories | 
 | 26 | GANTT_DIR=$DEST/gantt | 
 | 27 | GANTT_STATE_PATH=${GANTT_STATE_PATH:=$DATA_DIR/gantt} | 
 | 28 | GANTT_REPO=${GANTT_REPO:-${GIT_BASE}/openstack/gantt.git} | 
 | 29 | GANTT_BRANCH=${GANTT_BRANCH:-master} | 
 | 30 |  | 
 | 31 | GANTTCLIENT_DIR=$DEST/python-ganttclient | 
 | 32 | GANTTCLIENT_REPO=${GANTT_REPO:-${GIT_BASE}/openstack/python-ganttclient.git} | 
 | 33 | GANTTCLIENT_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 | 
 | 38 | GANTT_CONF_DIR=${GANTT_CONF_DIR:-/etc/nova} | 
 | 39 | GANTT_CONF=$GANTT_CONF_DIR/nova.conf | 
 | 40 |  | 
 | 41 | # Support entry points installation of console scripts | 
 | 42 | GANTT_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 Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 50 | function cleanup_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 51 |     echo "Cleanup Gantt" | 
 | 52 | } | 
 | 53 |  | 
 | 54 | # configure_gantt() - Set config files, create data dirs, etc | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 55 | function configure_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 56 |     echo "Configure Gantt" | 
 | 57 | } | 
 | 58 |  | 
 | 59 | # init_gantt() - Initialize database and volume group | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 60 | function init_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 61 |     echo "Initialize Gantt" | 
 | 62 | } | 
 | 63 |  | 
 | 64 | # install_gantt() - Collect source and prepare | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 65 | function install_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 66 |     git_clone $GANTT_REPO $GANTT_DIR $GANTT_BRANCH | 
 | 67 |     setup_develop $GANTT_DIR | 
 | 68 | } | 
 | 69 |  | 
 | 70 | # install_ganttclient() - Collect source and prepare | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 71 | function install_ganttclient { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 72 |     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 Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 78 | function start_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 79 |     if is_service_enabled gantt; then | 
| Chris Dent | 2f27a0e | 2014-09-09 13:46:02 +0100 | [diff] [blame] | 80 |         run_process gantt "$GANTT_BIN_DIR/gantt-scheduler --config-file $GANTT_CONF" | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 81 |     fi | 
 | 82 | } | 
 | 83 |  | 
 | 84 | # stop_gantt() - Stop running processes | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 85 | function stop_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 86 |     echo "Stop Gantt" | 
| Chris Dent | 2f27a0e | 2014-09-09 13:46:02 +0100 | [diff] [blame] | 87 |     stop_process gantt | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 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: |