Adding oslo.config entry points for yaql and cache opts

To assist with automated configuration validation, we need entry points
for oslo.config.opts for yaql and cache options.

Change-Id: I228282d2c05f6583fe972470b326e7182f635b39
This commit is contained in:
David Vallee Delisle 2021-05-04 21:50:35 -04:00 committed by Takashi Kajinami
parent a9ccce8b0c
commit 0f7ce2cfa6
4 changed files with 68 additions and 49 deletions

View File

@ -1,16 +1,19 @@
[DEFAULT] [DEFAULT]
output_file = etc/heat/heat.conf.sample output_file = etc/heat/heat.conf.sample
wrap_width = 79 wrap_width = 79
namespace = heat.common.cache
namespace = heat.common.config namespace = heat.common.config
namespace = heat.common.context namespace = heat.common.context
namespace = heat.common.crypt namespace = heat.common.crypt
namespace = heat.engine.clients.os.keystone.heat_keystoneclient namespace = heat.engine.clients.os.keystone.heat_keystoneclient
namespace = heat.engine.hot.functions
namespace = heat.common.wsgi namespace = heat.common.wsgi
namespace = heat.engine.clients namespace = heat.engine.clients
namespace = heat.engine.notification namespace = heat.engine.notification
namespace = heat.engine.resources namespace = heat.engine.resources
namespace = heat.api.aws.ec2token namespace = heat.api.aws.ec2token
namespace = keystonemiddleware.auth_token namespace = keystonemiddleware.auth_token
namespace = oslo.cache
namespace = oslo.messaging namespace = oslo.messaging
namespace = oslo.middleware namespace = oslo.middleware
namespace = oslo.cache namespace = oslo.cache

View File

@ -21,6 +21,56 @@ from oslo_config import cfg
from heat.common.i18n import _ from heat.common.i18n import _
constraint_cache_group = cfg.OptGroup('constraint_validation_cache')
constraint_cache_opts = [
cfg.IntOpt('expiration_time', default=60,
help=_(
'TTL, in seconds, for any cached item in the '
'dogpile.cache region used for caching of validation '
'constraints.')),
cfg.BoolOpt("caching", default=True,
help=_(
'Toggle to enable/disable caching when Orchestration '
'Engine validates property constraints of stack. '
'During property validation with constraints '
'Orchestration Engine caches requests to other '
'OpenStack services. Please note that the global '
'toggle for oslo.cache(enabled=True in [cache] group) '
'must be enabled to use this feature.'))
]
extension_cache_group = cfg.OptGroup('service_extension_cache')
extension_cache_opts = [
cfg.IntOpt('expiration_time', default=3600,
help=_(
'TTL, in seconds, for any cached item in the '
'dogpile.cache region used for caching of service '
'extensions.')),
cfg.BoolOpt('caching', default=True,
help=_(
'Toggle to enable/disable caching when Orchestration '
'Engine retrieves extensions from other OpenStack '
'services. Please note that the global toggle for '
'oslo.cache(enabled=True in [cache] group) must be '
'enabled to use this feature.'))
]
find_cache_group = cfg.OptGroup('resource_finder_cache')
find_cache_opts = [
cfg.IntOpt('expiration_time', default=3600,
help=_(
'TTL, in seconds, for any cached item in the '
'dogpile.cache region used for caching of OpenStack '
'service finder functions.')),
cfg.BoolOpt('caching', default=True,
help=_(
'Toggle to enable/disable caching when Orchestration '
'Engine looks for other OpenStack service resources '
'using name or id. Please note that the global '
'toggle for oslo.cache(enabled=True in [cache] group) '
'must be enabled to use this feature.'))
]
def register_cache_configurations(conf): def register_cache_configurations(conf):
"""Register all configurations required for oslo.cache. """Register all configurations required for oslo.cache.
@ -35,65 +85,24 @@ def register_cache_configurations(conf):
core.configure(conf) core.configure(conf)
# register heat specific configurations # register heat specific configurations
constraint_cache_group = cfg.OptGroup('constraint_validation_cache')
constraint_cache_opts = [
cfg.IntOpt('expiration_time', default=60,
help=_(
'TTL, in seconds, for any cached item in the '
'dogpile.cache region used for caching of validation '
'constraints.')),
cfg.BoolOpt("caching", default=True,
help=_(
'Toggle to enable/disable caching when Orchestration '
'Engine validates property constraints of stack. '
'During property validation with constraints '
'Orchestration Engine caches requests to other '
'OpenStack services. Please note that the global '
'toggle for oslo.cache(enabled=True in [cache] group) '
'must be enabled to use this feature.'))
]
conf.register_group(constraint_cache_group) conf.register_group(constraint_cache_group)
conf.register_opts(constraint_cache_opts, group=constraint_cache_group) conf.register_opts(constraint_cache_opts, group=constraint_cache_group)
extension_cache_group = cfg.OptGroup('service_extension_cache')
extension_cache_opts = [
cfg.IntOpt('expiration_time', default=3600,
help=_(
'TTL, in seconds, for any cached item in the '
'dogpile.cache region used for caching of service '
'extensions.')),
cfg.BoolOpt('caching', default=True,
help=_(
'Toggle to enable/disable caching when Orchestration '
'Engine retrieves extensions from other OpenStack '
'services. Please note that the global toggle for '
'oslo.cache(enabled=True in [cache] group) must be '
'enabled to use this feature.'))
]
conf.register_group(extension_cache_group) conf.register_group(extension_cache_group)
conf.register_opts(extension_cache_opts, group=extension_cache_group) conf.register_opts(extension_cache_opts, group=extension_cache_group)
find_cache_group = cfg.OptGroup('resource_finder_cache')
find_cache_opts = [
cfg.IntOpt('expiration_time', default=3600,
help=_(
'TTL, in seconds, for any cached item in the '
'dogpile.cache region used for caching of OpenStack '
'service finder functions.')),
cfg.BoolOpt('caching', default=True,
help=_(
'Toggle to enable/disable caching when Orchestration '
'Engine looks for other OpenStack service resources '
'using name or id. Please note that the global '
'toggle for oslo.cache(enabled=True in [cache] group) '
'must be enabled to use this feature.'))
]
conf.register_group(find_cache_group) conf.register_group(find_cache_group)
conf.register_opts(find_cache_opts, group=find_cache_group) conf.register_opts(find_cache_opts, group=find_cache_group)
return conf return conf
def list_opts():
yield constraint_cache_group.name, constraint_cache_opts
yield extension_cache_group.name, extension_cache_opts
yield find_cache_group.name, find_cache_opts
# variable that stores an initialized cache region for heat # variable that stores an initialized cache region for heat
_REGION = None _REGION = None

View File

@ -31,7 +31,8 @@ from heat.engine import function
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
opts = [ yaql_group = cfg.OptGroup('yaql')
yaql_opts = [
cfg.IntOpt('limit_iterators', cfg.IntOpt('limit_iterators',
default=200, default=200,
help=_('The maximum number of elements in collection ' help=_('The maximum number of elements in collection '
@ -41,7 +42,11 @@ opts = [
help=_('The maximum size of memory in bytes that ' help=_('The maximum size of memory in bytes that '
'expression can take for its evaluation.')) 'expression can take for its evaluation.'))
] ]
cfg.CONF.register_opts(opts, group='yaql') cfg.CONF.register_opts(yaql_opts, group=yaql_group)
def list_opts():
yield yaql_group.name, yaql_opts
class GetParam(function.Function): class GetParam(function.Function):

View File

@ -49,10 +49,12 @@ wsgi_scripts =
heat-wsgi-api-cfn = heat.httpd.heat_api_cfn:init_application heat-wsgi-api-cfn = heat.httpd.heat_api_cfn:init_application
oslo.config.opts = oslo.config.opts =
heat.common.cache = heat.common.cache:list_opts
heat.common.config = heat.common.config:list_opts heat.common.config = heat.common.config:list_opts
heat.common.context = heat.common.context:list_opts heat.common.context = heat.common.context:list_opts
heat.common.crypt = heat.common.crypt:list_opts heat.common.crypt = heat.common.crypt:list_opts
heat.engine.clients.os.keystone.heat_keystoneclient = heat.engine.clients.os.keystone.heat_keystoneclient:list_opts heat.engine.clients.os.keystone.heat_keystoneclient = heat.engine.clients.os.keystone.heat_keystoneclient:list_opts
heat.engine.hot.functions = heat.engine.hot.functions:list_opts
heat.common.wsgi = heat.common.wsgi:list_opts heat.common.wsgi = heat.common.wsgi:list_opts
heat.engine.clients = heat.engine.clients:list_opts heat.engine.clients = heat.engine.clients:list_opts
heat.engine.notification = heat.engine.notification:list_opts heat.engine.notification = heat.engine.notification:list_opts