From 9fcf42d3d524f03c8f49794bdd3730f654c146a1 Mon Sep 17 00:00:00 2001 From: Arnau Verdaguer Date: Mon, 31 Jan 2022 16:43:25 +0100 Subject: [PATCH] [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 --- .../migration/tasks/cleanup-dataplane.yml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/ovn_migration/tripleo_environment/playbooks/roles/migration/tasks/cleanup-dataplane.yml b/tools/ovn_migration/tripleo_environment/playbooks/roles/migration/tasks/cleanup-dataplane.yml index 9323f745a07..10f6ed134a4 100644 --- a/tools/ovn_migration/tripleo_environment/playbooks/roles/migration/tasks/cleanup-dataplane.yml +++ b/tools/ovn_migration/tripleo_environment/playbooks/roles/migration/tasks/cleanup-dataplane.yml @@ -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: |