-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathctos6-controller-uninst.sh
executable file
·124 lines (101 loc) · 1.93 KB
/
ctos6-controller-uninst.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
#
# Copyright (C) 2014 Eric Miao <[email protected]>. All rights reserved.
# License: GPL
#
set -e
set -u
MYSQL_PW=${MYSQL_PW:-admin}
usage() {
cat <<EOF
Usage: $(basename $0) <all|horizon|nova|neutron|cinder|glance|keystone>
EOF
exit 1
}
remove_horizon() {
yum remove -y openstack-dashboard
rm -rf /etc/openstack-dashboard
}
remove_nova() {
yum remove -y libvirt openstack-nova-common
rm -rf /etc/libvirt
rm -rf /var/{log,lib,run}/libvirt
rm -rf /etc/nova
rm -rf /var/{log,lib,run}/nova
mysql -u root --password=$MYSQL_PW <<EOF
drop user nova@'%';
drop database nova;
EOF
}
remove_neutron() {
yum remove -y openvswitch openstack-neutron
rm -rf /etc/openvswitch
rm -rf /var/{log,lib,run}/openvswitch
rm -rf /etc/neutron
rm -rf /var/{log,lib,run}/neutron
mysql -u root --password=$MYSQL_PW <<EOF
drop user neutron@'%';
drop database neutron;
EOF
}
remove_cinder() {
yum remove -y openstack-cinder
rm -rf /etc/cinder
rm -rf /var/{log,lib,run}/cinder
mysql -u root --password=$MYSQL_PW <<EOF
drop user cinder@'%';
drop database cinder;
EOF
}
remove_glance() {
yum remove -y openstack-glance
rm -rf /etc/glance
rm -rf /var/{log,lib,run}/glance
mysql -u root --password=$MYSQL_PW <<EOF
drop user glance@'%';
drop database glance;
EOF
}
remove_keystone() {
yum remove -y openstack-keystone
rm -rf /etc/keystone
rm -rf /var/{log,lib,run}/keystone
mysql -u root --password=$MYSQL_PW <<EOF
drop user keystone@'%';
drop database keystone;
EOF
}
if [ $# != 1 ]; then
usage
fi
case $1 in
all)
remove_horizon
remove_nova
remove_neutron
remove_cinder
remove_glance
remove_keystone
;;
horizon)
remove_horizon
;;
nova)
remove_nova
;;
neutron)
remove_neutron
;;
cinder)
remove_cinder
;;
glance)
remove_glance
;;
keystone)
remove_keystone
;;
*)
usage
;;
esac