Backport Mitaka option to disable auto added resources. The default

value for the new configuration option preserves the original behavior
at the time of Liberty release.

Change-Id: Ie8ca7d0af012367fd669ca5c5afec649f2954e39
This commit is contained in:
Mark McClain 2016-04-20 15:28:32 -04:00 committed by mark mcclain
parent 811a7e1467
commit 10dd21be3b
1 changed files with 10 additions and 3 deletions

View File

@ -44,7 +44,12 @@ akanda_opts = [
cfg.ListOpt(
'akanda_allowed_cidr_ranges',
default=['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', 'fc00::/7'],
help='List of allowed subnet cidrs for non-admin users')
help='List of allowed subnet cidrs for non-admin users'),
cfg.BoolOpt(
'astara_auto_add_resources',
default=True,
help='Attempt to auto add resources to speed up network construction'
)
]
cfg.CONF.register_opts(akanda_opts)
@ -59,7 +64,8 @@ def auto_add_ipv6_subnet(f):
def wrapper(self, context, network):
LOG.debug('auto_add_ipv6_subnet')
net = f(self, context, network)
_add_ipv6_subnet(context, net)
if cfg.CONF.astara_auto_add_resources:
_add_ipv6_subnet(context, net)
return net
return wrapper
@ -70,7 +76,8 @@ def auto_add_subnet_to_router(f):
LOG.debug('auto_add_subnet_to_router')
check_subnet_cidr_meets_policy(context, subnet)
subnet = f(self, context, subnet)
_add_subnet_to_router(context, subnet)
if cfg.CONF.astara_auto_add_resources:
_add_subnet_to_router(context, subnet)
return subnet
return wrapper