From 10dd21be3b0690ef796aeccfe9191ab006c2285e Mon Sep 17 00:00:00 2001 From: Mark McClain Date: Wed, 20 Apr 2016 15:28:32 -0400 Subject: [PATCH] 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 --- akanda/neutron/plugins/decorators.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/akanda/neutron/plugins/decorators.py b/akanda/neutron/plugins/decorators.py index 640fcf0..1cac9f8 100644 --- a/akanda/neutron/plugins/decorators.py +++ b/akanda/neutron/plugins/decorators.py @@ -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