Remove race between sync_pools and _get_port_from_pool
This patch ensures that if there is an attempt to allocate a port during the pod creation but the kuryr-controller has not yet finished its sync_pool initialization, a ResourceNotReady exception will be triggered and the port allocation attempt will be retried later Closes-Bug: 1800431 Change-Id: I92671523db6e9efc40ff248018c4e081fae750ed
This commit is contained in:
parent
b0b170f7a8
commit
a8567e9d4a
|
@ -294,7 +294,7 @@ class NeutronVIFPool(BaseVIFPool):
|
|||
def _get_port_from_pool(self, pool_key, pod, subnets):
|
||||
try:
|
||||
port_id = self._available_ports_pools[pool_key].pop()
|
||||
except IndexError:
|
||||
except (IndexError, AttributeError):
|
||||
raise exceptions.ResourceNotReady(pod)
|
||||
if config.CONF.kubernetes.port_debug:
|
||||
neutron = clients.get_neutron_client()
|
||||
|
@ -456,7 +456,7 @@ class NestedVIFPool(BaseVIFPool):
|
|||
def _get_port_from_pool(self, pool_key, pod, subnets):
|
||||
try:
|
||||
port_id = self._available_ports_pools[pool_key].pop()
|
||||
except IndexError:
|
||||
except (IndexError, AttributeError):
|
||||
raise exceptions.ResourceNotReady(pod)
|
||||
if config.CONF.kubernetes.port_debug:
|
||||
neutron = clients.get_neutron_client()
|
||||
|
|
Loading…
Reference in New Issue