Remove only non-alive agents during migration

During the migration process we were cleaning up all ml2/ovs
neutron agents, but, in some cases we still rely on the
neutron-dhcp-agents, and we need to avoid cleaning those up.

Change-Id: I6064bb207e27928f29d39773b30d98a2345efd43
Closes-bug: 1814812
changes/22/635022/1
Miguel Angel Ajo 2019-02-05 14:13:57 -05:00
parent 319ec6f54e
commit 20e17d56b5
2 changed files with 7 additions and 2 deletions

View File

@ -4,8 +4,8 @@ set -x
source {{ overcloudrc }}
# Delete neutron agents
for i in `openstack network agent list | grep neutron- | awk {'print $2'}`
# Delete non alive neutron agents
for i in `openstack network agent list | grep neutron- | grep -v ':-)' | awk {'print $2'}`
do
openstack network agent delete $i
done

View File

@ -36,6 +36,11 @@
- name: Cleanup neutron datapath resources
shell: |
# avoid cleaning up dhcp namespaces if the neutron dhcp agent is up (SR-IOV use case)
if [[ "{{ item.value.cleanup_type }}" == "dhcp" ]]; then
docker inspect neutron_dhcp && echo "Shouldn't clean DHCP namespaces if neutron_dhcp docker is up" && exit 0
fi
if ip netns | egrep -e "{{ item.value.netns_regex }}"
then
echo "Cleaning up"