Merge "Fix uncaught DB exception when trying to get a spare amphora"

This commit is contained in:
Zuul 2020-02-22 14:19:33 +00:00 committed by Gerrit Code Review
commit e0ae8a3cac

View File

@ -529,10 +529,17 @@ class MapLoadbalancerToAmphora(BaseDatabaseTask):
else:
amp_az = CONF.nova.availability_zone
try:
amp = self.amphora_repo.allocate_and_associate(
db_apis.get_session(),
loadbalancer_id,
amp_az)
except Exception as e:
LOG.error("Failed to get a spare amphora (AZ: {}) for "
"loadbalancer {} due to: {}".format(
amp_az, loadbalancer_id, e))
return None
if amp is None:
LOG.debug("No Amphora available for load balancer with id %s",
loadbalancer_id)