[OVN] Check if exists trunk ports before cleanup

While migrating from OVS to OVN one of the steps of the migration
is clean all the OVS trunk ports, this will fail if the environment
does not have any trunk ports configured.

This will do a comprovation in order to know if it's necessary
to clean them or not.

Also, since this playbook it will only clean the ovn interfaces
it is not necessary to stop the whole migration. If any error
occured while deleting any ovs interface a message will be
printed so the user can take action if necessary.

Change-Id: I6ec0b392b13daa9f64e051fb12b4b97a6c0a1730
This commit is contained in:
Arnau Verdaguer 2022-01-31 16:43:25 +01:00
parent 30951fcdfa
commit 9fcf42d3d5

View File

@ -10,10 +10,35 @@
ovs-vsctl del-port $dhcp_port
done
done
register: router_dhcp_error
ignore_errors: True
- name: Cleanup neutron router and dhcp interfaces finished
debug:
msg: WARNING error while cleaning ovs interface with msg {{ router_dhcp_error.msg }}
when:
- router_dhcp_error.changed
- router_dhcp_error.rc != 0
- name: Check if neutron trunk subports need cleanup
shell: |
ovs-vsctl list interface | awk '/name[ ]*: sp[it]-/ { print $3 }' | grep 'spi-\|spt-'
register: do_cleanup
ignore_errors: True
- name: Cleanup neutron trunk subports
when: do_cleanup.rc == 0
shell: |
ovs-vsctl list interface | awk '/name[ ]*: sp[it]-/ { print $3 }' | xargs -n1 ovs-vsctl del-port
register: trunk_error
ignore_errors: True
- name: Cleanup trunk ports finished
debug:
msg: WARNING error while cleaning ovs interface with msg {{ trunk_error.msg }}
when:
- trunk_error.changed
- trunk_error.rc != 0
- name: Clean neutron datapath security groups from iptables
shell: |