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