Allow repeated creation of subnetpool
After we switch to 'local' capacity scope, each host will call kuryr to create a subnetpool. To handle this, we create the subnetpool at the first call, and return the existing subnetpool at subsequent calls. Change-Id: I987dba992fa5fe590c17a8ee49d14d03bcc08dd3
This commit is contained in:
parent
00ab075497
commit
36942efa88
@ -624,10 +624,12 @@ def _create_kuryr_subnetpool(pool_cidr, pool_tag, shared):
|
||||
if pool_tag:
|
||||
kwargs['tags'] = [pool_tag]
|
||||
pools = _get_subnetpools_by_attrs(**kwargs)
|
||||
if len(pools):
|
||||
if len(pools) == 1:
|
||||
LOG.info("Subnetpool has already been created")
|
||||
return pools[0]
|
||||
elif len(pools) > 1:
|
||||
raise exceptions.KuryrException(
|
||||
"Another pool with same cidr exist. ipam and network"
|
||||
" options not used to pass pool name")
|
||||
"Multiple subnetpools have the same pool name")
|
||||
|
||||
cidr = ipaddress.ip_network(str(pool_cidr))
|
||||
new_subnetpool = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user