| Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash | 
 | 2 | # | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 3 | # 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 | 
 | 21 | XTRACE=$(set +o | grep xtrace) | 
 | 22 | set +o xtrace | 
 | 23 |  | 
 | 24 | # Defaults | 
 | 25 | # -------- | 
 | 26 |  | 
 | 27 | # set up default directories | 
 | 28 | GANTT_DIR=$DEST/gantt | 
 | 29 | GANTT_STATE_PATH=${GANTT_STATE_PATH:=$DATA_DIR/gantt} | 
 | 30 | GANTT_REPO=${GANTT_REPO:-${GIT_BASE}/openstack/gantt.git} | 
 | 31 | GANTT_BRANCH=${GANTT_BRANCH:-master} | 
 | 32 |  | 
 | 33 | GANTTCLIENT_DIR=$DEST/python-ganttclient | 
 | 34 | GANTTCLIENT_REPO=${GANTT_REPO:-${GIT_BASE}/openstack/python-ganttclient.git} | 
 | 35 | GANTTCLIENT_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 | 
 | 40 | GANTT_CONF_DIR=${GANTT_CONF_DIR:-/etc/nova} | 
 | 41 | GANTT_CONF=$GANTT_CONF_DIR/nova.conf | 
 | 42 |  | 
 | 43 | # Support entry points installation of console scripts | 
 | 44 | GANTT_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 Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 52 | function cleanup_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 53 |     echo "Cleanup Gantt" | 
 | 54 | } | 
 | 55 |  | 
 | 56 | # configure_gantt() - Set config files, create data dirs, etc | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 57 | function configure_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 58 |     echo "Configure Gantt" | 
 | 59 | } | 
 | 60 |  | 
 | 61 | # init_gantt() - Initialize database and volume group | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 62 | function init_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 63 |     echo "Initialize Gantt" | 
 | 64 | } | 
 | 65 |  | 
 | 66 | # install_gantt() - Collect source and prepare | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 67 | function install_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 68 |     git_clone $GANTT_REPO $GANTT_DIR $GANTT_BRANCH | 
 | 69 |     setup_develop $GANTT_DIR | 
 | 70 | } | 
 | 71 |  | 
 | 72 | # install_ganttclient() - Collect source and prepare | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 73 | function install_ganttclient { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 74 |     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 Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 80 | function start_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 81 |     if is_service_enabled gantt; then | 
| Chris Dent | 2f27a0e | 2014-09-09 13:46:02 +0100 | [diff] [blame] | 82 |         run_process gantt "$GANTT_BIN_DIR/gantt-scheduler --config-file $GANTT_CONF" | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 83 |     fi | 
 | 84 | } | 
 | 85 |  | 
 | 86 | # stop_gantt() - Stop running processes | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 87 | function stop_gantt { | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 88 |     echo "Stop Gantt" | 
| Chris Dent | 2f27a0e | 2014-09-09 13:46:02 +0100 | [diff] [blame] | 89 |     stop_process gantt | 
| Don Dugger | f84eb5b | 2014-01-30 09:59:30 -0700 | [diff] [blame] | 90 | } | 
 | 91 |  | 
 | 92 | # Restore xtrace | 
 | 93 | $XTRACE | 
 | 94 |  | 
 | 95 | # Tell emacs to use shell-script-mode | 
 | 96 | ## Local variables: | 
 | 97 | ## mode: shell-script | 
 | 98 | ## End: |