Repository navigation
Expand file tree
/
Copy pathclean.sh
More file actions
executable file
·134 lines (117 loc) · 3.25 KB
/
Copy pathclean.sh
File metadata and controls
executable file
·134 lines (117 loc) · 3.25 KB
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
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
EDPM_CR=0
EDPM_NODE=0
NOVA_DB=0
CONTROL=0
CEPH_CLI=0
OPERATORS=0
CEPH_K8S=0
PVC=0
LVMS=0
CRC=0
if [[ $LVMS -gt 0 && $PVC -gt 0 ]]; then
echo "LVMS and PVC are mutually exclusive."
exit 1
fi
# node0 node1 node2
NODES=2
NODE_START=0
eval $(crc oc-env)
oc login -u kubeadmin -p 12345678 https://api.crc.testing:6443
if [ $EDPM_CR -eq 1 ]; then
oc get openstackdataplanedeployment.dataplane.openstack.org -o name | xargs oc delete
oc get openstackdataplanenodeset.dataplane.openstack.org -o name | xargs oc delete
fi
if [ $EDPM_NODE -eq 1 ]; then
pushd ~/install_yamls/devsetup
for I in $(seq $NODE_START $NODES); do
make edpm_compute_cleanup EDPM_COMPUTE_SUFFIX=$I;
done
popd
fi
if [ $NOVA_DB -eq 1 ]; then
# nova_compute pod flapped with
# nova.exception.InvalidConfiguration: No local node identity found,
# but this is not our first startup on this host. Refusing to start
# after potentially having lost that state!
#
# Related Codde:
# https://review.opendev.org/q/topic:bp%252Fstable-compute-uuid
#
# But this should have prevented it
# `make openstack_cleanup` and `make crc_storage_cleanup`
#
# Dropping unwanted data to ensure it is clean.
echo "Dropping nova DBs containing the following entries:"
oc exec -it pod/openstack-cell1-galera-0 -- mysql -uroot -p12345678 -e \
"use nova_cell1; select * from services;"
oc exec -it pod/openstack-galera-0 -- mysql -uroot -p12345678 -e \
"use nova_cell0; select * from services;"
oc exec -it pod/openstack-cell1-galera-0 -- mysql -uroot -p12345678 -e \
"drop database nova_cell1;"
oc exec -it pod/openstack-galera-0 -- mysql -uroot -p12345678 -e \
"drop database nova_cell0; drop database nova_api;"
fi
if [ $CONTROL -eq 1 ]; then
pushd ~/install_yamls
make openstack_deploy_cleanup
echo "Deleted control plane pods"
popd
fi
if [ $CEPH_CLI -eq 1 ]; then
oc get secret | grep ceph
oc delete secret ceph-conf-files
oc get secret | grep ceph
fi
if [ $OPERATORS -eq 1 ]; then
pushd ~/install_yamls
date
make openstack_cleanup
popd
fi
if [ $CEPH_K8S -eq 1 ]; then
pushd ~/install_yamls
make ceph_cleanup
popd
fi
if [ $PVC -eq 1 ]; then
echo -n "Waiting to ensure all Galera pods are have stopped running..."
while [[ 1 ]]; do
if [[ $(oc get pods 2> /dev/null | grep -i galera | wc -l) -gt 0 ]]; then
echo -n "."
sleep 1
else
echo "Galera is not running"
break
fi
done
pushd ~/install_yamls
make crc_storage_cleanup
make crc_storage_cleanup
popd
fi
if [ $LVMS -eq 1 ]; then
echo -n "Waiting to ensure all Galera pods are have stopped running..."
while [[ 1 ]]; do
if [[ $(oc get pods 2> /dev/null | grep -i galera | wc -l) -gt 0 ]]; then
echo -n "."
sleep 1
else
echo "Galera is not running"
break
fi
done
pushd ~/install_yamls
make lvms_deploy_cleanup
sleep 2
make lvms_cleanup
rm -f ~/.crc/vdb
popd
fi
if [ $CRC -eq 1 ]; then
pushd ~/install_yamls/devsetup
make crc_cleanup
popd
fi
unset OPENSTACK_CTLPLANE
env | grep -i openstack