forked from skolekonov/fuel-kvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.sh
executable file
·53 lines (43 loc) · 905 Bytes
/
manage.sh
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
#!/bin/bash
source functions.sh
if [ $# -lt 1 ]
then
echo "Usage: $0 [cleanup|snapshot-nodes <name>|revert-nodes <name>]"
exit 1
fi
OPERATION=$1
case "$OPERATION" in
"cleanup")
echo "Cleaning up..."
remove_master
remove_slaves
;;
"snapshot-nodes")
echo "Snapshotting nodes..."
SNAP_NAME=$2
for i in $(virsh list | grep fuel- | awk '{print $2}')
do
virsh suspend $i
done
for i in $(virsh list | grep fuel- | awk '{print $2}')
do
virsh snapshot-create-as $i $SNAP_NAME
done
;;
"revert-nodes")
echo "Reverting nodes..."
SNAP_NAME=$2
for i in $(virsh list | grep fuel- | awk '{print $2}')
do
virsh snapshot-revert $i $SNAP_NAME
done
for i in $(virsh list | grep fuel- | awk '{print $2}')
do
virsh resume $i
done
;;
*)
echo "Unsupported command"
echo "Usage: $0 [cleanup|snapshot-nodes <name>|revert-nodes <name>]"
exit 1
esac