NSX|V3: Retry getting the LB service in case of creation failure

In case of concurrent loadbalancer creation on the same router, service creation
may fail because another worker already created it.
In this case the driver will attempt to get it from the NSX again.

Change-Id: Ib7f9bdba2604a282384cfb9513d64ab5f6179c48
This commit is contained in:
Adit Sarfaty
2019-07-03 11:36:14 +03:00
parent 1889ac93df
commit 7766989157

View File

@@ -114,6 +114,11 @@ class EdgeLoadBalancerManagerFromDict(base_mgr.Nsxv3LoadbalancerBaseManager):
attachment=attachment,
size=lb_size)
except nsxlib_exc.ManagerError as e:
# If it failed, it is probably because the service was already
# created by another loadbalancer simultaneously
lb_service = service_client.get_router_lb_service(nsx_router_id)
if lb_service:
return lb_service
LOG.error("Failed to create LB service: %s", e)
return