forked from contiv/netplugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup
More file actions
executable file
·48 lines (39 loc) · 1.23 KB
/
cleanup
File metadata and controls
executable file
·48 lines (39 loc) · 1.23 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
#!/bin/bash
# the script cleans up any remnants from previous run of netdeamon
# like etcd state, ovs configuration, etc.
# the script is not meant to be used in production, rather something to
# allow easy experimentation on failure runs or crashes that leaves
# system in invalid state
# Note: issuing ovs-vsctl needs 'root' permission otherwise
# cleanup will silently fail. Make sure the caller invokes this script
# as 'root' or 'sudo'.
if [ "$(id -u)" != "0" ]; then
echo "Please run as root:$(id -u):"
exit 1
fi
if ! $(which etcdctl > /dev/null 2>&1)
then
echo "etcdctl not found !\n"
exit 1
fi
if ! $(which ovs-vsctl > /dev/null 2>&1)
then
echo "ovs-vsctl not found !\n"
exit 1
fi
# stop netmaster and netplugin if they are running
killall netplugin
killall netmaster
# Cleanup etcd and consul state
etcdctl rm -recursive /contiv > /dev/null 2>&1
etcdctl rm -recursive /contiv.io > /dev/null 2>&1
curl -X DELETE http://localhost:8500/v1/kv/contiv?recurse > /dev/null 2>&1
# Cleanup ovs state
ovs-vsctl del-br contivVlanBridge > /dev/null 2>&1
ovs-vsctl del-br contivVxlanBridge > /dev/null 2>&1
for p in `ifconfig | grep vport | awk '{print $1}'`
do
ip link delete $p type veth
done
echo "cleanup complete!"
exit 0