[OVN Migration] Remove qr and dhcp ports from the nodes

After migration from ML2/OVS to ML2/OVN tap ports which were created
by the DHCP agents and router ports (like e.g. qr- or qg-) which were
created by the L3 agents aren't needed at all and should be deleted.
Previously those ports were set to be DOWN only. With this patch
all such ports will be simply deleted from the openvswitch.

Related-bug: #1946479
Change-Id: I74cd5820389c86819c6884d3d61c9b2f7907cc88
This commit is contained in:
Slawek Kaplonski 2021-10-08 15:04:10 +02:00
parent dfcbb4cce0
commit 5092f3fb98

@ -1,21 +1,13 @@
---
- name: Quickly disable neutron router and dhcp interfaces
- name: Cleanup neutron router and dhcp interfaces
shell: |
for p in `ovs-vsctl show | egrep 'qr-|ha-|qg-|rfp-' | grep Interface | awk '{print $2}'`
do
# p will be having quotes. Eg. "hr-xxxx". So strip the quotes
p=`echo $p | sed -e 's/"//g'`
ovs-vsctl clear Interface $p external-ids
ovs-vsctl set Interface $p admin-state=down
done
ovs-vsctl list interface | awk '/name[ ]*: qr-|ha-|qg-|rfp-/ { print $3 }' | xargs -n1 ovs-vsctl del-port
# dhcp tap ports cannot be easily distinguished from ovsfw ports, so we
# list them from within the qdhcp namespaces
for netns in `ip netns | awk '{ print $1 }' | grep qdhcp-`; do
for dhcp_port in `ip netns exec $netns ip -o link show | awk -F': ' '{print $2}' | grep tap`; do
ovs-vsctl clear Interface $dhcp_port external-ids
ovs-vsctl set Interface $dhcp_port admin-state=down
ovs-vsctl del-port $dhcp_port
done
done