Propagate retry exception in implicit subnet allocation

In concurrent execution cases a failure can occur in the Neutron
IPAM component due to failure to obtaining a lock. In such cases
the IPAM component raises a retry exception which should be not
be eaten, but relayed as is so that the operation can be retried.

This patch checks if the exception raised during a subnet allocation
from a subnetpool fails due to a retry exception, and if so, raises
it as is to facilitate a retry.

Change-Id: I381cdf533b27d710f68903f0cfb516043b4607d6
This commit is contained in:
Sumit Naiksatam 2017-06-09 01:35:58 -07:00
parent 98e7f7bbd4
commit b41c3fc959
1 changed files with 4 additions and 1 deletions

View File

@ -27,6 +27,7 @@ from neutron.db import models_v2
from neutron.extensions import l3 as ext_l3
from neutron.extensions import securitygroup as ext_sg
from oslo_config import cfg
from oslo_db import exception as oslo_db_excp
from oslo_log import helpers as log
from oslo_log import log as logging
from oslo_utils import excutils
@ -609,11 +610,13 @@ class ImplicitResourceOperations(local_api.LocalAPI,
subnets.append(subnet)
break
except Exception as e:
if isinstance(e, oslo_db_excp.RetryRequest):
raise e
LOG.info(_LI("Allocating subnet from subnetpool %(sp)s "
"failed. Allocation will be attempted "
"from any other configured "
"subnetpool(s). Exception: %(excp)s"),
{'sp': pool['id'], 'excp': e})
{'sp': pool['id'], 'excp': type(e)})
last = e
continue