-
Notifications
You must be signed in to change notification settings - Fork 19
/
save-state
executable file
·72 lines (53 loc) · 2.07 KB
/
save-state
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
# ``save-state``
echo "*********************************************************************"
echo "Begin $0"
echo "*********************************************************************"
set -o errexit
# Clean up any resources that may be in use
cleanup() {
set +o errexit
echo "*********************************************************************"
echo "ERROR: Abort $0"
echo "*********************************************************************"
# Kill ourselves to signal any calling process
trap 2; kill -2 $$
}
# Keep track of the grenade directory
GRENADE_DIR=$(cd $(dirname "$0") && pwd)
# Source params
source $GRENADE_DIR/grenaderc
# Import common functions
source $GRENADE_DIR/functions
# Determine what system we are running on. This provides ``os_VENDOR``,
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
# and ``DISTRO``
GetDistro
# For debugging
set -o xtrace
# Save databases
# --------------
save_data $BASE_RELEASE $BASE_DEVSTACK_DIR
# Save ebtables/iptables
# ----------------------
# NOTE(sileht): If nova is not installed these tools are not present
if [[ $(type -P iptables-save) != "" ]]; then
sudo iptables-save >$SAVE_DIR/iptables.$BASE_RELEASE
fi
if [[ $(type -P ebtables) != "" ]]; then
# FIXME: ebtables may be available, but based on nft, and broute
# is not available -> do not end the script because of this
sudo ebtables -t broute -L >$SAVE_DIR/ebtables-broute.$BASE_RELEASE || true
sudo ebtables -t filter -L >$SAVE_DIR/ebtables-filter.$BASE_RELEASE
sudo ebtables -t nat -L >$SAVE_DIR/ebtables-nat.$BASE_RELEASE
fi
# Log RabbitMQ state
# ------------------
if $(source $BASE_DEVSTACK_DIR/stackrc; is_service_enabled rabbit); then
sudo rabbitmqctl list_queues messages consumers arguments name >$SAVE_DIR/rabbitmq-queues.txt
sudo rabbitmqctl report >$SAVE_DIR/rabbitmq-report.txt
fi
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End $0"
echo "*********************************************************************"