Dean Troyer | f4d2395 | 2012-03-28 11:19:24 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Stops that which is started by ``stack.sh`` (mostly) |
| 4 | # mysql and rabbit are left running as OpenStack code refreshes |
| 5 | # do not require them to be restarted. |
| 6 | # |
| 7 | # Stop all processes by setting UNSTACK_ALL or specifying ``--all`` |
| 8 | # on the command line |
| 9 | |
| 10 | # Keep track of the current devstack directory. |
| 11 | TOP_DIR=$(cd $(dirname "$0") && pwd) |
| 12 | |
| 13 | # Import common functions |
| 14 | source $TOP_DIR/functions |
| 15 | |
| 16 | # Load local configuration |
| 17 | source $TOP_DIR/stackrc |
| 18 | |
| 19 | # Determine what system we are running on. This provides ``os_VENDOR``, |
| 20 | # ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME`` |
| 21 | GetOSVersion |
| 22 | |
| 23 | if [[ "$1" == "--all" ]]; then |
| 24 | UNSTACK_ALL=${UNSTACK_ALL:-1} |
| 25 | fi |
| 26 | |
| 27 | # Shut down devstack's screen to get the bulk of OpenStack services in one shot |
Dean Troyer | eeaf266 | 2012-06-14 09:11:38 -0500 | [diff] [blame] | 28 | SCREEN=$(which screen) |
| 29 | if [[ -n "$SCREEN" ]]; then |
| 30 | SESSION=$(screen -ls | awk '/[0-9].stack/ { print $1 }') |
| 31 | if [[ -n "$SESSION" ]]; then |
| 32 | screen -X -S $SESSION quit |
| 33 | fi |
Dean Troyer | f4d2395 | 2012-03-28 11:19:24 -0500 | [diff] [blame] | 34 | fi |
| 35 | |
| 36 | # Swift runs daemons |
| 37 | if is_service_enabled swift; then |
| 38 | swift-init all stop |
| 39 | fi |
| 40 | |
| 41 | # Apache has the WSGI processes |
| 42 | if is_service_enabled horizon; then |
| 43 | stop_service apache2 |
| 44 | fi |
| 45 | |
| 46 | # Get the iSCSI volumes |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame^] | 47 | if is_service_enabled cinder n-vol; then |
Dean Troyer | f4d2395 | 2012-03-28 11:19:24 -0500 | [diff] [blame] | 48 | TARGETS=$(sudo tgtadm --op show --mode target) |
| 49 | if [[ -n "$TARGETS" ]]; then |
| 50 | # FIXME(dtroyer): this could very well require more here to |
| 51 | # clean up left-over volumes |
| 52 | echo "iSCSI target cleanup needed:" |
| 53 | echo "$TARGETS" |
| 54 | fi |
Dean Troyer | 5218d45 | 2012-02-04 02:13:23 -0600 | [diff] [blame] | 55 | stop_service tgt |
Dean Troyer | f4d2395 | 2012-03-28 11:19:24 -0500 | [diff] [blame] | 56 | fi |
| 57 | |
| 58 | if [[ -n "$UNSTACK_ALL" ]]; then |
| 59 | # Stop MySQL server |
| 60 | if is_service_enabled mysql; then |
| 61 | stop_service mysql |
| 62 | fi |
| 63 | fi |