CONF file structure refactor
This is the openstack governance goal that the config files should be merged into one folder to make the code to be better understood and managed. Change-Id: I33dd85145d9f5b0384323ffa51b4d68de0aeb5b7changes/81/564981/12
parent
c214c608e3
commit
a7df08deb9
|
@ -48,10 +48,9 @@ extensions = ['sphinx.ext.coverage',
|
|||
'openstackdocstheme',
|
||||
]
|
||||
|
||||
config_generator_config_file = [
|
||||
('../../etc/oslo-config-generator/zaqar.conf',
|
||||
'_static/zaqar'),
|
||||
]
|
||||
config_generator_config_file = '../../etc/oslo-config-generator/zaqar.conf'
|
||||
sample_config_basename = '_static/zaqar'
|
||||
|
||||
|
||||
# autodoc generation is a bit aggressive and a nuisance
|
||||
# when doing heavy text edit cycles. Execute "export SPHINX_DEBUG=1"
|
||||
|
|
|
@ -6,4 +6,3 @@ zaqar.conf
|
|||
|
||||
.. show-options::
|
||||
:config-file: etc/oslo-config-generator/zaqar.conf
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ Install and configure ``memcached``, ``uWSGI`` and Messaging on the web server
|
|||
|
||||
.. code-block:: console
|
||||
|
||||
# oslopolicy-sample-generator --config-file etc/oslo-config-generator/zaqar-policy-generator.conf
|
||||
# oslopolicy-sample-generator --config-file etc/zaqar-policy-generator.conf
|
||||
# cp etc/zaqar.policy.yaml.sample /etc/zaqar/policy.yaml
|
||||
|
||||
Edit any item as needed in policy.yaml.
|
||||
|
|
|
@ -278,7 +278,7 @@ Install and configure ``memcached``, ``uWSGI`` and Messaging on the web server
|
|||
|
||||
.. code-block:: console
|
||||
|
||||
# oslopolicy-sample-generator --config-file etc/oslo-config-generator/zaqar-policy-generator.conf
|
||||
# oslopolicy-sample-generator --config-file etc/zaqar-policy-generator.conf
|
||||
# cp etc/zaqar.policy.yaml.sample /etc/zaqar/policy.yaml
|
||||
|
||||
Edit any item as needed in policy.yaml.
|
||||
|
|
|
@ -266,7 +266,7 @@ Install and configure ``memcached``, ``uWSGI`` and Messaging on the web server
|
|||
|
||||
.. code-block:: console
|
||||
|
||||
# oslopolicy-sample-generator --config-file etc/oslo-config-generator/zaqar-policy-generator.conf
|
||||
# oslopolicy-sample-generator --config-file etc/zaqar-policy-generator.conf
|
||||
# cp etc/zaqar.policy.yaml.sample /etc/zaqar/policy.yaml
|
||||
|
||||
Edit any item as needed in policy.yaml.
|
||||
|
|
|
@ -3,6 +3,6 @@ level of the zaqar directory:
|
|||
tox -egenpolicy
|
||||
|
||||
Or run the command directly:
|
||||
oslopolicy-sample-generator --config-file etc/oslo-config-generator/zaqar-policy-generator.conf
|
||||
oslopolicy-sample-generator --config-file etc/zaqar-policy-generator.conf
|
||||
The output file will be in etc folder, named "zaqar.policy.yaml.sample" by
|
||||
default.
|
|
@ -1,18 +1,7 @@
|
|||
[DEFAULT]
|
||||
wrap_width = 80
|
||||
wrap_width = 79
|
||||
output_file = etc/zaqar.conf.sample
|
||||
namespace = zaqar.common.auth
|
||||
namespace = zaqar.common.configs
|
||||
namespace = zaqar.storage.pipeline
|
||||
namespace = zaqar.storage.pooling
|
||||
namespace = zaqar.storage.mongodb
|
||||
namespace = zaqar.storage.redis
|
||||
namespace = zaqar.storage.sqlalchemy
|
||||
namespace = zaqar.storage.swift
|
||||
namespace = zaqar.transport.wsgi
|
||||
namespace = zaqar.transport.websocket
|
||||
namespace = zaqar.transport.base
|
||||
namespace = zaqar.transport.validation
|
||||
namespace = zaqar
|
||||
namespace = keystonemiddleware.auth_token
|
||||
namespace = oslo.cache
|
||||
namespace = oslo.log
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
other:
|
||||
- |
|
||||
The code structure for configuration files are changed. This is insensitvie
|
||||
for end users, but the persons who work for downstream changes should pay
|
||||
attention. Please refactor your private configurations to ``zaqar/conf/``
|
||||
folder as well.
|
13
setup.cfg
13
setup.cfg
|
@ -46,18 +46,7 @@ zaqar.transport =
|
|||
websocket = zaqar.transport.websocket.driver:Driver
|
||||
|
||||
oslo.config.opts =
|
||||
zaqar.common.auth = zaqar.common.auth:_config_options
|
||||
zaqar.common.configs = zaqar.common.configs:_config_options
|
||||
zaqar.storage.pipeline = zaqar.storage.pipeline:_config_options
|
||||
zaqar.storage.pooling = zaqar.storage.pooling:_config_options
|
||||
zaqar.storage.mongodb = zaqar.storage.mongodb.options:_config_options
|
||||
zaqar.storage.redis = zaqar.storage.redis.options:_config_options
|
||||
zaqar.storage.sqlalchemy = zaqar.storage.sqlalchemy.options:_config_options
|
||||
zaqar.storage.swift = zaqar.storage.swift.options:_config_options
|
||||
zaqar.transport.wsgi = zaqar.transport.wsgi.driver:_config_options
|
||||
zaqar.transport.websocket = zaqar.transport.websocket.driver:_config_options
|
||||
zaqar.transport.base = zaqar.transport.base:_config_options
|
||||
zaqar.transport.validation = zaqar.transport.validation:_config_options
|
||||
zaqar = zaqar.conf.opts:list_opts
|
||||
|
||||
zaqar.storage.stages =
|
||||
zaqar.notification.notifier = zaqar.notification.notifier:NotifierDriver
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -32,7 +32,7 @@ commands =
|
|||
|
||||
[testenv:genpolicy]
|
||||
commands =
|
||||
oslopolicy-sample-generator --config-file etc/oslo-config-generator/zaqar-policy-generator.conf
|
||||
oslopolicy-sample-generator --config-file etc/zaqar-policy-generator.conf
|
||||
|
||||
[testenv:cover]
|
||||
commands =
|
||||
|
|
|
@ -22,10 +22,11 @@ from stevedore import driver
|
|||
|
||||
from zaqar.api import handler
|
||||
from zaqar.common import cache as oslo_cache
|
||||
from zaqar.common import configs
|
||||
from zaqar.common import consts
|
||||
from zaqar.common import decorators
|
||||
from zaqar.common import errors
|
||||
from zaqar.conf import drivers as driver_opts
|
||||
from zaqar.conf import opts as opts_tool
|
||||
from zaqar.storage import pipeline
|
||||
from zaqar.storage import pooling
|
||||
from zaqar.storage import utils as storage_utils
|
||||
|
@ -46,7 +47,7 @@ class Bootstrap(object):
|
|||
def __init__(self, conf):
|
||||
self.conf = conf
|
||||
|
||||
for group, opts in configs._config_options():
|
||||
for group, opts in opts_tool.list_opts_by_group():
|
||||
self.conf.register_opts(opts, group=group)
|
||||
profiler_opts.set_defaults(self.conf)
|
||||
|
||||
|
@ -54,7 +55,7 @@ class Bootstrap(object):
|
|||
# wsgi. Websocket part will be added in the future.
|
||||
profile.setup(self.conf, 'Zaqar-server', socket.gethostname())
|
||||
|
||||
self.driver_conf = self.conf[configs._DRIVER_GROUP]
|
||||
self.driver_conf = self.conf[driver_opts.GROUP_NAME]
|
||||
|
||||
@decorators.lazy_property(write=False)
|
||||
def api(self):
|
||||
|
|
|
@ -21,12 +21,12 @@ from oslo_reports import opts as gmr_opts
|
|||
|
||||
from zaqar import bootstrap
|
||||
from zaqar.common import cli
|
||||
from zaqar.common import configs
|
||||
from zaqar.conf import default
|
||||
from zaqar import version
|
||||
|
||||
# NOTE(eggmaster): define command line options for zaqar-server
|
||||
_CLI_OPTIONS = (
|
||||
configs._ADMIN_MODE_OPT,
|
||||
default.admin_mode,
|
||||
cfg.BoolOpt('daemon', default=False,
|
||||
help='Run Zaqar server in the background.'),
|
||||
)
|
||||
|
|
|
@ -1,129 +0,0 @@
|
|||
# Copyright (c) 2015 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
_ADMIN_MODE_OPT = cfg.BoolOpt('admin_mode', default=False,
|
||||
help='Activate privileged endpoints.')
|
||||
|
||||
|
||||
_GENERAL_OPTIONS = (
|
||||
_ADMIN_MODE_OPT,
|
||||
cfg.BoolOpt('pooling', default=False,
|
||||
help=('Enable pooling across multiple storage backends. '
|
||||
'If pooling is enabled, the storage driver '
|
||||
'configuration is used to determine where the '
|
||||
'catalogue/control plane data is kept.'),
|
||||
deprecated_opts=[cfg.DeprecatedOpt('sharding')]),
|
||||
cfg.BoolOpt('unreliable', default=False,
|
||||
help='Disable all reliability constraints.'),
|
||||
cfg.ListOpt('enable_deprecated_api_versions', default=[],
|
||||
item_type=cfg.types.List(item_type=cfg.types.String(
|
||||
choices=('1', '1.1'))),
|
||||
help='List of deprecated API versions to enable.'),
|
||||
cfg.BoolOpt('enable_checksum', default=False,
|
||||
help='Enable a checksum for message body. The default value '
|
||||
'is False.'),
|
||||
)
|
||||
|
||||
_DRIVER_OPTIONS = (
|
||||
cfg.StrOpt('transport', default='wsgi',
|
||||
help='Transport driver to use.'),
|
||||
cfg.StrOpt('message_store', default='mongodb',
|
||||
deprecated_opts=[cfg.DeprecatedOpt('storage')],
|
||||
help='Storage driver to use as the messaging store.'),
|
||||
cfg.StrOpt('management_store', default='mongodb',
|
||||
help='Storage driver to use as the management store.'),
|
||||
)
|
||||
|
||||
_DRIVER_GROUP = 'drivers'
|
||||
|
||||
|
||||
_SIGNED_URL_OPTIONS = (
|
||||
cfg.StrOpt('secret_key',
|
||||
help=('Secret key used to encrypt pre-signed URLs.')),
|
||||
)
|
||||
|
||||
_SIGNED_URL_GROUP = 'signed_url'
|
||||
|
||||
|
||||
_NOTIFICATION_OPTIONS = (
|
||||
cfg.StrOpt('smtp_command', default='/usr/sbin/sendmail -t -oi',
|
||||
help=('The command of smtp to send email. The format is '
|
||||
'"command_name arg1 arg2".')),
|
||||
cfg.IntOpt('max_notifier_workers', default=10,
|
||||
help='The max amount of the notification workers.'),
|
||||
cfg.BoolOpt('require_confirmation', default=False,
|
||||
help='Whether the http/https/email subscription need to be '
|
||||
'confirmed before notification.'),
|
||||
cfg.StrOpt('external_confirmation_url',
|
||||
help='The confirmation page url that will be used in email '
|
||||
'subscription confirmation before notification.'),
|
||||
cfg.DictOpt("subscription_confirmation_email_template",
|
||||
default={'topic': 'Zaqar Notification - Subscription '
|
||||
'Confirmation',
|
||||
'body': 'You have chosen to subscribe to the '
|
||||
'queue: {0}. This queue belongs to '
|
||||
'project: {1}. '
|
||||
'To confirm this subscription, '
|
||||
'click or visit this link below: {2}',
|
||||
'sender': 'Zaqar Notifications '
|
||||
'<no-reply@openstack.org>'},
|
||||
help="Defines the set of subscription confirmation email "
|
||||
"content, including topic, body and sender. There is "
|
||||
"a mapping is {0} -> queue name, {1} ->project id, "
|
||||
"{2}-> confirm url in body string. User can use any of "
|
||||
"the three value. But they can't use more than three."),
|
||||
cfg.DictOpt("unsubscribe_confirmation_email_template",
|
||||
default={'topic': 'Zaqar Notification - '
|
||||
'Unsubscribe Confirmation',
|
||||
'body': 'You have unsubscribed successfully to the '
|
||||
'queue: {0}. This queue belongs to '
|
||||
'project: {1}. '
|
||||
'To resubscribe this subscription, '
|
||||
'click or visit this link below: {2}',
|
||||
'sender': 'Zaqar Notifications '
|
||||
'<no-reply@openstack.org>'},
|
||||
help="Defines the set of unsubscribe confirmation email "
|
||||
"content, including topic, body and sender. There is "
|
||||
"a mapping is {0} -> queue name, {1} ->project id, "
|
||||
"{2}-> confirm url in body string. User can use any of "
|
||||
"the three value. But they can't use more than three."),
|
||||
)
|
||||
|
||||
_NOTIFICATION_GROUP = 'notification'
|
||||
|
||||
|
||||
_PROFILER_OPTIONS = [
|
||||
cfg.BoolOpt("trace_wsgi_transport", default=False,
|
||||
help="If False doesn't trace any transport requests."
|
||||
"Please note that it doesn't work for websocket now."),
|
||||
cfg.BoolOpt("trace_message_store", default=False,
|
||||
help="If False doesn't trace any message store requests."),
|
||||
cfg.BoolOpt("trace_management_store", default=False,
|
||||
help="If False doesn't trace any management store requests.")
|
||||
]
|
||||
|
||||
_PROFILER_GROUP = "profiler"
|
||||
|
||||
|
||||
def _config_options():
|
||||
return [(None, _GENERAL_OPTIONS),
|
||||
(_DRIVER_GROUP, _DRIVER_OPTIONS),
|
||||
(_SIGNED_URL_GROUP, _SIGNED_URL_OPTIONS),
|
||||
(_NOTIFICATION_GROUP, _NOTIFICATION_OPTIONS),
|
||||
(_PROFILER_GROUP, _PROFILER_OPTIONS)]
|
|
@ -0,0 +1,74 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
|
||||
from oslo_cache import core as cache
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from zaqar.conf import default
|
||||
from zaqar.conf import drivers
|
||||
from zaqar.conf import drivers_management_store_mongodb
|
||||
from zaqar.conf import drivers_management_store_redis
|
||||
from zaqar.conf import drivers_management_store_sqlalchemy
|
||||
from zaqar.conf import drivers_message_store_mongodb
|
||||
from zaqar.conf import drivers_message_store_redis
|
||||
from zaqar.conf import drivers_message_store_swift
|
||||
from zaqar.conf import drivers_transport_websocket
|
||||
from zaqar.conf import drivers_transport_wsgi
|
||||
from zaqar.conf import notification
|
||||
from zaqar.conf import pooling_catalog
|
||||
from zaqar.conf import profiler
|
||||
from zaqar.conf import signed_url
|
||||
from zaqar.conf import storage
|
||||
from zaqar.conf import transport
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
conf_modules = [
|
||||
default,
|
||||
drivers,
|
||||
drivers_management_store_mongodb,
|
||||
drivers_management_store_redis,
|
||||
drivers_management_store_sqlalchemy,
|
||||
drivers_message_store_mongodb,
|
||||
drivers_message_store_redis,
|
||||
drivers_message_store_swift,
|
||||
drivers_transport_websocket,
|
||||
drivers_transport_wsgi,
|
||||
notification,
|
||||
pooling_catalog,
|
||||
profiler,
|
||||
signed_url,
|
||||
storage,
|
||||
transport
|
||||
]
|
||||
|
||||
|
||||
def setup_logging():
|
||||
"""Set up logging for the keystone package."""
|
||||
log.setup(CONF, 'zaqar')
|
||||
logging.captureWarnings(True)
|
||||
|
||||
|
||||
def configure(conf=None):
|
||||
if conf is None:
|
||||
conf = CONF
|
||||
|
||||
for module in conf_modules:
|
||||
module.register_opts(conf)
|
||||
|
||||
# add oslo.cache related config options
|
||||
cache.configure(conf)
|
|
@ -0,0 +1,70 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
admin_mode = cfg.BoolOpt(
|
||||
'admin_mode', default=False,
|
||||
help='Activate privileged endpoints.')
|
||||
|
||||
|
||||
pooling = cfg.BoolOpt(
|
||||
'pooling', default=False,
|
||||
help=('Enable pooling across multiple storage backends. '
|
||||
'If pooling is enabled, the storage driver '
|
||||
'configuration is used to determine where the '
|
||||
'catalogue/control plane data is kept.'),
|
||||
deprecated_opts=[cfg.DeprecatedOpt('sharding')])
|
||||
|
||||
|
||||
unreliable = cfg.BoolOpt(
|
||||
'unreliable', default=False,
|
||||
help='Disable all reliability constraints.')
|
||||
|
||||
|
||||
enable_deprecated_api_versions = cfg.ListOpt(
|
||||
'enable_deprecated_api_versions', default=[],
|
||||
item_type=cfg.types.List(item_type=cfg.types.String(choices=('1', '1.1'))),
|
||||
help='List of deprecated API versions to enable.')
|
||||
|
||||
|
||||
enable_checksum = cfg.BoolOpt(
|
||||
'enable_checksum', default=False,
|
||||
help='Enable a checksum for message body. The default value is False.')
|
||||
|
||||
|
||||
auth_strategy = cfg.StrOpt(
|
||||
'auth_strategy', default='',
|
||||
help=('Backend to use for authentication. '
|
||||
'For no auth, keep it empty. '
|
||||
'Existing strategies: keystone. '
|
||||
'See also the keystone_authtoken section below'))
|
||||
|
||||
GROUP_NAME = 'DEFAULT'
|
||||
ALL_OPTS = [
|
||||
admin_mode,
|
||||
pooling,
|
||||
unreliable,
|
||||
enable_deprecated_api_versions,
|
||||
enable_checksum,
|
||||
auth_strategy
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,46 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
transport = cfg.StrOpt(
|
||||
'transport', default='wsgi',
|
||||
help='Transport driver to use.')
|
||||
|
||||
|
||||
message_store = cfg.StrOpt(
|
||||
'message_store', default='mongodb',
|
||||
deprecated_opts=[cfg.DeprecatedOpt('storage')],
|
||||
help='Storage driver to use as the messaging store.')
|
||||
|
||||
|
||||
management_store = cfg.StrOpt(
|
||||
'management_store', default='mongodb',
|
||||
help='Storage driver to use as the management store.')
|
||||
|
||||
|
||||
GROUP_NAME = 'drivers'
|
||||
ALL_OPTS = [
|
||||
transport,
|
||||
message_store,
|
||||
management_store
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,157 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
_deprecated_group = 'drivers:storage:mongodb'
|
||||
|
||||
|
||||
ssl_keyfile = cfg.StrOpt(
|
||||
'ssl_keyfile',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'ssl_keyfile',
|
||||
group=_deprecated_group), ],
|
||||
help='The private keyfile used to identify the local '
|
||||
'connection against mongod. If included with '
|
||||
'the ``certifle`` then only the ``ssl_certfile``'
|
||||
' is needed.')
|
||||
|
||||
|
||||
ssl_certfile = cfg.StrOpt(
|
||||
'ssl_certfile',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'ssl_certfile',
|
||||
group=_deprecated_group), ],
|
||||
help='The certificate file used to identify the '
|
||||
'local connection against mongod.')
|
||||
|
||||
|
||||
ssl_cert_reqs = cfg.StrOpt(
|
||||
'ssl_cert_reqs', default='CERT_REQUIRED',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'ssl_cert_reqs',
|
||||
group=_deprecated_group), ],
|
||||
help='Specifies whether a certificate is required '
|
||||
'from the other side of the connection, and '
|
||||
'whether it will be validated if provided. It '
|
||||
'must be one of the three values ``CERT_NONE``'
|
||||
'(certificates ignored), ``CERT_OPTIONAL``'
|
||||
'(not required, but validated if provided), or'
|
||||
' ``CERT_REQUIRED``(required and validated). '
|
||||
'If the value of this parameter is not '
|
||||
'``CERT_NONE``, then the ``ssl_ca_cert`` '
|
||||
'parameter must point to a file of CA '
|
||||
'certificates.')
|
||||
|
||||
|
||||
ssl_ca_certs = cfg.StrOpt(
|
||||
'ssl_ca_certs',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'ssl_ca_certs',
|
||||
group=_deprecated_group), ],
|
||||
help='The ca_certs file contains a set of concatenated '
|
||||
'"certification authority" certificates, which are '
|
||||
'used to validate certificates passed from the other '
|
||||
'end of the connection.')
|
||||
|
||||
|
||||
uri = cfg.StrOpt(
|
||||
'uri',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'uri',
|
||||
group=_deprecated_group), ],
|
||||
help='Mongodb Connection URI. If ssl connection enabled, '
|
||||
'then ``ssl_keyfile``, ``ssl_certfile``, '
|
||||
'``ssl_cert_reqs``, ``ssl_ca_certs`` need to be set '
|
||||
'accordingly.')
|
||||
|
||||
|
||||
database = cfg.StrOpt(
|
||||
'database', default='zaqar',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'database',
|
||||
group=_deprecated_group), ],
|
||||
help='Database name.')
|
||||
|
||||
max_attempts = cfg.IntOpt(
|
||||
'max_attempts', min=0, default=1000,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'max_attempts',
|
||||
group=_deprecated_group), ],
|
||||
help=('Maximum number of times to retry a failed operation. '
|
||||
'Currently only used for retrying a message post.'))
|
||||
|
||||
|
||||
max_retry_sleep = cfg.FloatOpt(
|
||||
'max_retry_sleep', default=0.1,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'max_retry_sleep',
|
||||
group=_deprecated_group), ],
|
||||
help=('Maximum sleep interval between retries '
|
||||
'(actual sleep time increases linearly '
|
||||
'according to number of attempts performed).'))
|
||||
|
||||
|
||||
max_retry_jitter = cfg.FloatOpt(
|
||||
'max_retry_jitter', default=0.005,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'max_retry_jitter',
|
||||
group=_deprecated_group), ],
|
||||
help=('Maximum jitter interval, to be added to the '
|
||||
'sleep interval, in order to decrease probability '
|
||||
'that parallel requests will retry at the '
|
||||
'same instant.'))
|
||||
|
||||
|
||||
max_reconnect_attempts = cfg.IntOpt(
|
||||
'max_reconnect_attempts', default=10,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'max_reconnect_attempts',
|
||||
group=_deprecated_group), ],
|
||||
help=('Maximum number of times to retry an operation that '
|
||||
'failed due to a primary node failover.'))
|
||||
|
||||
|
||||
reconnect_sleep = cfg.FloatOpt(
|
||||
'reconnect_sleep', default=0.020,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'reconnect_sleep',
|
||||
group=_deprecated_group), ],
|
||||
help=('Base sleep interval between attempts to reconnect '
|
||||
'after a primary node failover. '
|
||||
'The actual sleep time increases exponentially (power '
|
||||
'of 2) each time the operation is retried.'))
|
||||
|
||||
|
||||
GROUP_NAME = 'drivers:management_store:mongodb'
|
||||
ALL_OPTS = [
|
||||
ssl_keyfile,
|
||||
ssl_certfile,
|
||||
ssl_cert_reqs,
|
||||
ssl_ca_certs,
|
||||
uri,
|
||||
database,
|
||||
max_attempts,
|
||||
max_retry_sleep,
|
||||
max_retry_jitter,
|
||||
max_reconnect_attempts,
|
||||
reconnect_sleep
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,86 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
_deprecated_group = 'drivers:storage:redis'
|
||||
|
||||
|
||||
uri = cfg.StrOpt(
|
||||
'uri', default="redis://127.0.0.1:6379",
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'uri',
|
||||
group=_deprecated_group), ],
|
||||
help=('Redis connection URI, taking one of three forms. '
|
||||
'For a direct connection to a Redis server, use '
|
||||
'the form "redis://[:password]@host[:port][?options]", '
|
||||
'where password is redis-server\'s password, when'
|
||||
'redis-server is set password, the password option'
|
||||
'needs to be set. port defaults to 6379 if not'
|
||||
'specified. For an HA master-slave Redis cluster using'
|
||||
' Redis Sentinel, use the form '
|
||||
'"redis://[:password]@host1[:port1]'
|
||||
'[,host2[:port2],...,hostN[:portN]][?options]", '
|
||||
'where each host specified corresponds to an '
|
||||
'instance of redis-sentinel. In this form, the '
|
||||
'name of the Redis master used in the Sentinel '
|
||||
'configuration must be included in the query '
|
||||
'string as "master=<name>". Finally, to connect '
|
||||
'to a local instance of Redis over a unix socket, '
|
||||
'you may use the form '
|
||||
'"redis:[:password]@/path/to/redis.sock[?options]".'
|
||||
' In all forms, the "socket_timeout" option may be'
|
||||
'specified in the query string. Its value is '
|
||||
'given in seconds. If not provided, '
|
||||
'"socket_timeout" defaults to 0.1 seconds.'
|
||||
'There are multiple database instances in redis '
|
||||
'database, for example in the /etc/redis/redis.conf, '
|
||||
'if the parameter is "database 16", there are 16 '
|
||||
'database instances. By default, the data is stored '
|
||||
'in db = 0 database, if you want to use db = 1 '
|
||||
'database, you can use the following form: '
|
||||
'"redis://host[:port][?dbid=1]".'))
|
||||
|
||||
|
||||
max_reconnect_attempts = cfg.IntOpt(
|
||||
'max_reconnect_attempts', default=10,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'max_reconnect_attempts',
|
||||
group=_deprecated_group), ],
|
||||
help=('Maximum number of times to retry an operation that '
|
||||
'failed due to a redis node failover.'))
|
||||
|
||||
|
||||
reconnect_sleep = cfg.FloatOpt(
|
||||
'reconnect_sleep', default=1.0,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'reconnect_sleep',
|
||||
group=_deprecated_group), ],
|
||||
help=('Base sleep interval between attempts to reconnect '
|
||||
'after a redis node failover. '))
|
||||
|
||||
|
||||
GROUP_NAME = 'drivers:management_store:redis'
|
||||
ALL_OPTS = [
|
||||
uri,
|
||||
max_reconnect_attempts,
|
||||
reconnect_sleep
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,38 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
_deprecated_group = 'drivers:storage:sqlalchemy'
|
||||
|
||||
uri = cfg.StrOpt(
|
||||
'uri', default='sqlite:///:memory:',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'uri',
|
||||
group=_deprecated_group), ],
|
||||
help='An sqlalchemy URL')
|
||||
|
||||
|
||||
GROUP_NAME = 'drivers:management_store:sqlalchemy'
|
||||
ALL_OPTS = [
|
||||
uri
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,173 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
_deprecated_group = 'drivers:storage:mongodb'
|
||||
|
||||
|
||||
ssl_keyfile = cfg.StrOpt(
|
||||
'ssl_keyfile',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'ssl_keyfile',
|
||||
group=_deprecated_group), ],
|
||||
help='The private keyfile used to identify the local '
|
||||
'connection against mongod. If included with '
|
||||
'the ``certifle`` then only the ``ssl_certfile``'
|
||||
' is needed.')
|
||||
|
||||
|
||||
ssl_certfile = cfg.StrOpt(
|
||||
'ssl_certfile',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'ssl_certfile',
|
||||
group=_deprecated_group), ],
|
||||
help='The certificate file used to identify the '
|
||||
'local connection against mongod.')
|
||||
|
||||
|
||||
ssl_cert_reqs = cfg.StrOpt(
|
||||
'ssl_cert_reqs', default='CERT_REQUIRED',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'ssl_cert_reqs',
|
||||
group=_deprecated_group), ],
|
||||
help='Specifies whether a certificate is required '
|
||||
'from the other side of the connection, and '
|
||||
'whether it will be validated if provided. It '
|
||||
'must be one of the three values ``CERT_NONE``'
|
||||
'(certificates ignored), ``CERT_OPTIONAL``'
|
||||
'(not required, but validated if provided), or'
|
||||
' ``CERT_REQUIRED``(required and validated). '
|
||||
'If the value of this parameter is not '
|
||||
'``CERT_NONE``, then the ``ssl_ca_cert`` '
|
||||
'parameter must point to a file of CA '
|
||||
'certificates.')
|
||||
|
||||
|
||||
ssl_ca_certs = cfg.StrOpt(
|
||||
'ssl_ca_certs',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'ssl_ca_certs',
|
||||
group=_deprecated_group), ],
|
||||
help='The ca_certs file contains a set of concatenated '
|
||||
'"certification authority" certificates, which are '
|
||||
'used to validate certificates passed from the other '
|
||||
'end of the connection.')
|
||||
|
||||
|
||||
uri = cfg.StrOpt(
|
||||
'uri',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'uri',
|
||||
group=_deprecated_group), ],
|
||||
help='Mongodb Connection URI. If ssl connection enabled, '
|
||||
'then ``ssl_keyfile``, ``ssl_certfile``, '
|
||||
'``ssl_cert_reqs``, ``ssl_ca_certs`` need to be set '
|
||||
'accordingly.')
|
||||
|
||||
|
||||
database = cfg.StrOpt(
|
||||
'database', default='zaqar',
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'database',
|
||||
group=_deprecated_group), ],
|
||||
help='Database name.')
|
||||
|
||||
max_attempts = cfg.IntOpt(
|
||||
'max_attempts', min=0, default=1000,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'max_attempts',
|
||||
group=_deprecated_group), ],
|
||||
help=('Maximum number of times to retry a failed operation. '
|
||||
'Currently only used for retrying a message post.'))
|
||||
|
||||
|
||||
max_retry_sleep = cfg.FloatOpt(
|
||||
'max_retry_sleep', default=0.1,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'max_retry_sleep',
|
||||
group=_deprecated_group), ],
|
||||
help=('Maximum sleep interval between retries '
|
||||
'(actual sleep time increases linearly '
|
||||
'according to number of attempts performed).'))
|
||||
|
||||
|
||||
max_retry_jitter = cfg.FloatOpt(
|
||||
'max_retry_jitter', default=0.005,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'max_retry_jitter',
|
||||
group=_deprecated_group), ],
|
||||
help=('Maximum jitter interval, to be added to the '
|
||||
'sleep interval, in order to decrease probability '
|
||||
'that parallel requests will retry at the '
|
||||
'same instant.'))
|
||||
|
||||
|
||||
max_reconnect_attempts = cfg.IntOpt(
|
||||
'max_reconnect_attempts', default=10,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'max_reconnect_attempts',
|
||||
group=_deprecated_group), ],
|
||||
help=('Maximum number of times to retry an operation that '
|
||||
'failed due to a primary node failover.'))
|
||||
|
||||
|
||||
reconnect_sleep = cfg.FloatOpt(
|
||||
'reconnect_sleep', default=0.020,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'reconnect_sleep',
|
||||
group=_deprecated_group), ],
|
||||
help=('Base sleep interval between attempts to reconnect '
|
||||
'after a primary node failover. '
|
||||
'The actual sleep time increases exponentially (power '
|
||||
'of 2) each time the operation is retried.'))
|
||||
|
||||
|
||||
partitions = cfg.IntOpt(
|
||||
'partitions', default=2,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'partitions',
|
||||
group=_deprecated_group), ],
|
||||
help=('Number of databases across which to '
|
||||
'partition message data, in order to '
|
||||
'reduce writer lock %. DO NOT change '
|
||||
'this setting after initial deployment. '
|
||||
'It MUST remain static. Also, you '
|
||||
'should not need a large number of partitions '
|
||||
'to improve performance, esp. if deploying '
|
||||
'MongoDB on SSD storage.'))
|
||||
|
||||
|
||||
GROUP_NAME = 'drivers:message_store:mongodb'
|
||||
ALL_OPTS = [
|
||||
ssl_keyfile,
|
||||
ssl_certfile,
|
||||
ssl_cert_reqs,
|
||||
ssl_ca_certs,
|
||||
uri,
|
||||
database,
|
||||
max_attempts,
|
||||
max_retry_sleep,
|
||||
max_retry_jitter,
|
||||
max_reconnect_attempts,
|
||||
reconnect_sleep,
|
||||
partitions
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,86 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
_deprecated_group = 'drivers:storage:redis'
|
||||
|
||||
|
||||
uri = cfg.StrOpt(
|
||||
'uri', default="redis://127.0.0.1:6379",
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'uri',
|
||||
group=_deprecated_group), ],
|
||||
help=('Redis connection URI, taking one of three forms. '
|
||||
'For a direct connection to a Redis server, use '
|
||||
'the form "redis://[:password]@host[:port][?options]", '
|
||||
'where password is redis-server\'s password, when'
|
||||
'redis-server is set password, the password option'
|
||||
'needs to be set. port defaults to 6379 if not'
|
||||
'specified. For an HA master-slave Redis cluster using'
|
||||
' Redis Sentinel, use the form '
|
||||
'"redis://[:password]@host1[:port1]'
|
||||
'[,host2[:port2],...,hostN[:portN]][?options]", '
|
||||
'where each host specified corresponds to an '
|
||||
'instance of redis-sentinel. In this form, the '
|
||||
'name of the Redis master used in the Sentinel '
|
||||
'configuration must be included in the query '
|
||||
'string as "master=<name>". Finally, to connect '
|
||||
'to a local instance of Redis over a unix socket, '
|
||||
'you may use the form '
|
||||
'"redis:[:password]@/path/to/redis.sock[?options]".'
|
||||
' In all forms, the "socket_timeout" option may be'
|
||||
'specified in the query string. Its value is '
|
||||
'given in seconds. If not provided, '
|
||||
'"socket_timeout" defaults to 0.1 seconds.'
|
||||
'There are multiple database instances in redis '
|
||||
'database, for example in the /etc/redis/redis.conf, '
|
||||
'if the parameter is "database 16", there are 16 '
|
||||
'database instances. By default, the data is stored '
|
||||
'in db = 0 database, if you want to use db = 1 '
|
||||
'database, you can use the following form: '
|
||||
'"redis://host[:port][?dbid=1]".'))
|
||||
|
||||
|
||||
max_reconnect_attempts = cfg.IntOpt(
|
||||
'max_reconnect_attempts', default=10,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'max_reconnect_attempts',
|
||||
group=_deprecated_group), ],
|
||||
help=('Maximum number of times to retry an operation that '
|
||||
'failed due to a redis node failover.'))
|
||||
|
||||
|
||||
reconnect_sleep = cfg.FloatOpt(
|
||||
'reconnect_sleep', default=1.0,
|
||||
deprecated_opts=[cfg.DeprecatedOpt(
|
||||
'reconnect_sleep',
|
||||
group=_deprecated_group), ],
|
||||
help=('Base sleep interval between attempts to reconnect '
|
||||
'after a redis node failover. '))
|
||||
|
||||
|
||||
GROUP_NAME = 'drivers:message_store:redis'
|
||||
ALL_OPTS = [
|
||||
uri,
|
||||
max_reconnect_attempts,
|
||||
reconnect_sleep
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,80 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
auth_url = cfg.StrOpt(
|
||||
"auth_url", default="http://127.0.0.1:5000/v3/",
|
||||
help="URI of Keystone endpoint to discover Swift")
|
||||
|
||||
|
||||
uri = cfg.StrOpt(
|
||||
"uri",
|
||||
default="swift://demo:nomoresecrete@/demo",
|
||||
help="Custom URI describing the swift connection.")
|
||||
|
||||
|
||||
insecure = cfg.StrOpt(
|
||||
"insecure", default=False,
|
||||
help="Don't check SSL certificate")
|
||||
|
||||
|
||||
project_domain_id = cfg.StrOpt(
|
||||
"project_domain_id", default="default",
|
||||
help="Domain ID containing project")
|
||||
|
||||
|
||||
project_domain_name = cfg.StrOpt(
|
||||
"project_domain_name",
|
||||
help="Domain name containing project")
|
||||
|
||||
|
||||
user_domain_id = cfg.StrOpt(
|
||||
"user_domain_id", default="default",
|
||||
help="User's domain id")
|
||||
|
||||
|
||||
user_domain_name = cfg.StrOpt(
|
||||
"user_domain_name", help="User's domain name")
|
||||
|
||||
|
||||
region_name = cfg.StrOpt(
|
||||
"region_name", help="Region name")
|
||||
|
||||
|
||||
interface = cfg.StrOpt(
|
||||
"interface", default="publicURL",
|
||||
help="The default interface for endpoint URL "
|
||||
"discovery.")
|
||||
|
||||
|
||||
GROUP_NAME = 'drivers:message_store:swift'
|
||||
ALL_OPTS = [
|
||||
auth_url,
|
||||
uri,
|
||||
insecure,
|
||||
project_domain_id,
|
||||
project_domain_name,
|
||||
user_domain_id,
|
||||
user_domain_name,
|
||||
region_name,
|
||||
interface
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,59 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
bind = cfg.HostAddressOpt(
|
||||
'bind', default='127.0.0.1',
|
||||
help='Address on which the self-hosting server will '
|
||||
'listen.')
|
||||
|
||||
|
||||
port = cfg.PortOpt(
|
||||
'port', default=9000,
|
||||
help='Port on which the self-hosting server will listen.')
|
||||
|
||||
|
||||
external_port = cfg.PortOpt(
|
||||
'external-port',
|
||||
help='Port on which the service is provided to the user.')
|
||||
|
||||
|
||||
notification_bind = cfg.HostAddressOpt(
|
||||
'notification-bind',
|
||||
help='Address on which the notification server will '
|
||||
'listen.')
|
||||
|
||||
|
||||
notification_port = cfg.PortOpt(
|
||||
'notification-port', default=0,
|
||||
help='Port on which the notification server will listen.')
|
||||
|
||||
|
||||
GROUP_NAME = 'drivers:transport:websocket'
|
||||
ALL_OPTS = [
|
||||
bind,
|
||||
port,
|
||||
external_port,
|
||||
notification_bind,
|
||||
notification_port
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,39 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
bind = cfg.HostAddressOpt(
|
||||
'bind', default='127.0.0.1',
|
||||
help='Address on which the self-hosting server will '
|
||||
'listen.')
|
||||
|
||||
|
||||
port = cfg.PortOpt(
|
||||
'port', default=8888,
|
||||
help='Port on which the self-hosting server will listen.')
|
||||
|
||||
|
||||
GROUP_NAME = 'drivers:transport:wsgi'
|
||||
ALL_OPTS = [
|
||||
bind,
|
||||
port
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,93 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
smtp_command = cfg.StrOpt(
|
||||
'smtp_command', default='/usr/sbin/sendmail -t -oi',
|
||||
help=(
|
||||
'The command of smtp to send email. The format is '
|
||||
'"command_name arg1 arg2".'))
|
||||
|
||||
|
||||
max_notifier_workers = cfg.IntOpt(
|
||||
'max_notifier_workers', default=10,
|
||||
help='The max amount of the notification workers.')
|
||||
|
||||
|
||||
require_confirmation = cfg.BoolOpt(
|
||||
'require_confirmation', default=False,
|
||||
help='Whether the http/https/email subscription need to be confirmed '
|
||||
'before notification.')
|
||||
|
||||
|
||||
external_confirmation_url = cfg.StrOpt(
|
||||
'external_confirmation_url',
|
||||
help='The confirmation page url that will be used in email subscription '
|
||||
'confirmation before notification.')
|
||||
|
||||
|
||||
subscription_confirmation_email_template = cfg.DictOpt(
|
||||
"subscription_confirmation_email_template",
|
||||
default={'topic': 'Zaqar Notification - Subscription '
|
||||
'Confirmation',
|
||||
'body': 'You have chosen to subscribe to the '
|
||||
'queue: {0}. This queue belongs to '
|
||||
'project: {1}. '
|
||||
'To confirm this subscription, '
|
||||
'click or visit this link below: {2}',
|
||||
'sender': 'Zaqar Notifications '
|
||||
'<no-reply@openstack.org>'},
|
||||
help="Defines the set of subscription confirmation email content, "
|
||||
"including topic, body and sender. There is a mapping is "
|
||||
"{0} -> queue name, {1} ->project id, {2}-> confirm url in body "
|
||||
"string. User can use any of the three values. But they can't use "
|
||||
"more than three.")
|
||||
|
||||
|
||||
unsubscribe_confirmation_email_template = cfg.DictOpt(
|
||||
"unsubscribe_confirmation_email_template",
|
||||
default={'topic': 'Zaqar Notification - '
|
||||
'Unsubscribe Confirmation',
|
||||
'body': 'You have unsubscribed successfully to the '
|
||||
'queue: {0}. This queue belongs to '
|
||||
'project: {1}. '
|
||||
'To resubscribe this subscription, '
|
||||
'click or visit this link below: {2}',
|
||||
'sender': 'Zaqar Notifications '
|
||||
'<no-reply@openstack.org>'},
|
||||
help="Defines the set of unsubscribe confirmation email content, "
|
||||
"including topic, body and sender. There is a mapping is "
|
||||
"{0} -> queue name, {1} ->project id, {2}-> confirm url in body "
|
||||
"string. User can use any of the three values. But they can't use "
|
||||
"more than three.")
|
||||
|
||||
|
||||
GROUP_NAME = 'notification'
|
||||
ALL_OPTS = [
|
||||
smtp_command,
|
||||
max_notifier_workers,
|
||||
require_confirmation,
|
||||
external_confirmation_url,
|
||||
subscription_confirmation_email_template,
|
||||
unsubscribe_confirmation_email_template
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|
|
@ -0,0 +1,109 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Single point of entry to generate the sample configuration file.
|
||||
|
||||
This module collects all the necessary info from the other modules in this
|
||||
package. It is assumed that:
|
||||
|
||||
* Every other module in this package has a 'list_opts' function which
|
||||
returns a dict where:
|
||||
|
||||
* The keys are strings which are the group names.
|
||||
|
||||
* The value of each key is a list of config options for that group.
|
||||
|
||||
* The conf package doesn't have further packages with config options.
|
||||
|
||||
* This module is only used in the context of sample file generation.
|
||||
|
||||
"""
|
||||
|
||||
import collections
|
||||
import importlib
|
||||
import os
|
||||
import pkgutil
|
||||
|
||||
|
||||
LIST_OPTS_FUNC_NAME = 'list_opts'
|
||||
IGNORED_MODULES = ('opts', 'constants', 'utils')
|
||||
|
||||
|
||||
def list_opts():
|
||||
opts = collections.defaultdict(list)
|
||||
module_names = _list_module_names()
|
||||
imported_modules = _import_modules(module_names)
|
||||
_append_config_options(imported_modules, opts)
|
||||
return _tupleize(opts)
|
||||
|
||||
|
||||
def list_opts_by_group():
|
||||
opts = []
|
||||
module_names = _list_module_names()
|
||||
imported_modules = _import_modules(module_names)
|
||||
for module in imported_modules:
|
||||
configs = module.list_opts()
|
||||
group_name = (module.GROUP_NAME if module.GROUP_NAME != 'DEFAULT'
|
||||
else None)
|
||||
opts.append((group_name, configs[module.GROUP_NAME]))
|
||||
return opts
|
||||
|
||||
|
||||
def _tupleize(d):
|
||||
"""Convert a dict of options to the 2-tuple format."""
|
||||
return [(key, value) for key, value in d.items()]
|
||||
|
||||
|
||||
def _list_module_names():
|
||||
module_names = []
|
||||
package_path = os.path.dirname(os.path.abspath(__file__))
|
||||
for _, module_name, ispkg in pkgutil.iter_modules(path=[package_path]):
|
||||
if module_name in IGNORED_MODULES or ispkg:
|
||||
# Skip this module.
|
||||
continue
|
||||
else:
|
||||
module_names.append(module_name)
|
||||
return module_names
|
||||
|
||||
|
||||
def _import_modules(module_names):
|
||||
imported_modules = []
|
||||
for module_name in module_names:
|
||||
full_module_path = '.'.join(__name__.split('.')[:-1] + [module_name])
|
||||
module = importlib.import_module(full_module_path)
|
||||
if not hasattr(module, LIST_OPTS_FUNC_NAME):
|
||||
raise Exception(
|
||||
"The module '%s' should have a '%s' function which "
|
||||
"returns the config options." % (
|
||||
full_module_path,
|
||||
LIST_OPTS_FUNC_NAME))
|
||||
else:
|
||||
imported_modules.append(module)
|
||||
return imported_modules
|
||||
|
||||
|
||||
def _process_old_opts(configs):
|
||||
"""Convert old-style 2-tuple configs to dicts."""
|
||||
if isinstance(configs, tuple):
|
||||
configs = [configs]
|
||||
return {label: options for label, options in configs}
|
||||
|
||||
|
||||
def _append_config_options(imported_modules, config_options):
|
||||
for module in imported_modules:
|
||||
configs = module.list_opts()
|
||||
# TODO(markus_z): Remove this compatibility shim once all list_opts()
|
||||
# functions have been updated to return dicts.
|
||||
if not isinstance(configs, dict):
|
||||
configs = _process_old_opts(configs)
|
||||
for key, val in configs.items():
|
||||
config_options[key].extend(val)
|
|
@ -0,0 +1,33 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
enable_virtual_pool = cfg.BoolOpt(
|
||||
'enable_virtual_pool', default=False,
|
||||
help='If enabled, the message_store will be used as the storage for the '
|
||||
'virtual pool.')
|
||||
|
||||
|
||||
GROUP_NAME = 'pooling:catalog'
|
||||
ALL_OPTS = [
|
||||
enable_virtual_pool
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {GROUP_NAME: ALL_OPTS}
|