Handle exception raised in FIP allocation

In case an exception is raised in FIP allocation
(due to wrong configuration), Kuryr will not annotate LB components
and a result of that we'll end up with orphan LB after service deletion.
With this patch, Kuryr will log the exception and
annotate LB components.

Change-Id: Iada0891786883d2348fca52a621bb196a3438df7
Closes-Bug:#1813015
This commit is contained in:
Yossi Boaron 2019-01-23 18:01:06 +02:00
parent 3fbb26b011
commit 0f9f5bc594
1 changed files with 6 additions and 3 deletions

View File

@ -69,12 +69,15 @@ class FloatingIpServicePubIPDriver(base.ServicePubIpDriver):
if not public_network_id:
raise cfg.RequiredOptError('external_svc_net',
cfg.OptGroup('neutron_defaults'))
res_id, alloc_ip_addr = (
self._drv_pub_ip.allocate_ip(
try:
res_id, alloc_ip_addr = (self._drv_pub_ip.allocate_ip(
public_network_id, project_id, pub_subnet_id=public_subnet_id,
description='kuryr_lb',
port_id_to_be_associated=port_id_to_be_associated))
except Exception:
LOG.exception("Failed to allocate public IP - net_id:%s",
public_network_id)
return None
service_pub_ip_info = obj_lbaas.LBaaSPubIp(ip_id=res_id,
ip_addr=alloc_ip_addr,
alloc_method='pool')