From 966687652eadba37d61c3ca6d099184bc0d13a8d Mon Sep 17 00:00:00 2001 From: Mark McClain Date: Wed, 23 Dec 2015 10:55:47 -0500 Subject: [PATCH] This is the first step in removing auto added resources Change-Id: Ie8ca7d0af012367fd669ca5c5afec649f2954e39 --- astara_neutron/plugins/decorators.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/astara_neutron/plugins/decorators.py b/astara_neutron/plugins/decorators.py index 913b4d7..2617d57 100644 --- a/astara_neutron/plugins/decorators.py +++ b/astara_neutron/plugins/decorators.py @@ -56,7 +56,12 @@ astara_opts = [ deprecated_opts=[ cfg.DeprecatedOpt('akanda_allowed_cidr_ranges') - ]) + ]), + cfg.BoolOpt( + 'astara_auto_add_resources', + default=True, + help='Attempt to auto add resources to speed up network construction' + ) ] cfg.CONF.register_opts(astara_opts) @@ -71,7 +76,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 @@ -82,7 +88,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