Fix zun delete fail as port not exist.
When delete container, will try to delete the created port. but if neutron not enabled or support tag extension or kuryr-libnetwork without https://review.openstack.org/#/c/441024/ patch, kuryr-libnetwork will delete port before zun to delete. Then zun failed to delete the port and delete container failed. When zun try to delete the neutron port, if it's deleted, just ignore the portnotfound exception. Change-Id: Ibb3a5abee0f96e3a5f920efff515f9dfd386b2ec Close-bug: #1686312
This commit is contained in:
parent
522d613fe0
commit
99f3c40cf1
@ -13,6 +13,7 @@
|
||||
import ipaddress
|
||||
import six
|
||||
|
||||
from neutronclient.common import exceptions
|
||||
from oslo_log import log as logging
|
||||
|
||||
from zun.common import clients
|
||||
@ -158,5 +159,11 @@ class KuryrNetwork(network.Network):
|
||||
self.docker.disconnect_container_from_network(container_id,
|
||||
network_name)
|
||||
if neutron_ports:
|
||||
port_id = neutron_ports[0]['id']
|
||||
self.neutron.delete_port(port_id)
|
||||
try:
|
||||
port_id = neutron_ports[0]['id']
|
||||
self.neutron.delete_port(port_id)
|
||||
except exceptions.PortNotFoundClient:
|
||||
LOG.warning('Maybe your libnetwork distribution do not have'
|
||||
'patch https://review.openstack.org/#/c/441024/'
|
||||
'or neutron tag extension does not supported or'
|
||||
' not enabled.')
|
||||
|
Loading…
x
Reference in New Issue
Block a user