# 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 neutron_lib.api.definitions import portbindings from oslo_config import cfg from dragonflow._i18n import _ df_opts = [ cfg.IPOpt('remote_db_ip', default='127.0.0.1', deprecated_for_removal=True, help=_('The remote db server ip address')), cfg.PortOpt('remote_db_port', default=4001, deprecated_for_removal=True, help=_('The remote db server port')), cfg.ListOpt('remote_db_hosts', default=['$remote_db_ip:$remote_db_port'], help=_('Remote DB cluster host:port pairs.')), cfg.StrOpt('nb_db_class', default='etcd_nb_db_driver', help=_('The driver to use for the NB database')), cfg.IPOpt('local_ip', default='127.0.0.1', help=_('Local host VTEP IP')), cfg.IPOpt('management_ip', default='127.0.0.1', help=_('Local host management IP')), cfg.ListOpt('tunnel_types', default=['geneve', 'vxlan', 'gre'], help=_("The encapsulation types for the tunnels")), cfg.BoolOpt('enable_dpdk', default=False, help=_("Enable dpdk")),
from cinder.volume import driver from oslo_config import cfg from oslo_log import log as logging from subprocess import PIPE, Popen from volumedriver.storagerouter.storagerouterclient import ClusterContact, StorageRouterClient logger = logging.getLogger(__name__) options = [ cfg.StrOpt( name='storage_ip', help='IP address of a storage node on which the vPool is extended'), cfg.StrOpt(name='vpool_guid', help='The GUID of the vPool being used'), cfg.StrOpt(name='edge_protocol', default='tcp', help='Protocol to use - edge client'), cfg.PortOpt(name='edge_port', help='Port of the edge server'), cfg.PortOpt(name='xml_rpc_port', help='XML RPC port used by the StorageDriver python API') ] config = cfg.CONF config.register_opts(options) # noinspection PyAbstractClass class OpenvStorageEdgeBaseVD(driver.BaseVD): """ Open vStorage Edge Volume Driver plugin for Cinder base functionality """ VERSION = '0.0.1' OVS_FILE_NAME = '/{0}.raw'
ERR_FILE_NOT_FOUND = 2 gpfs_share_opts = [ cfg.StrOpt('gpfs_share_export_ip', help='IP to be added to GPFS export string.'), cfg.StrOpt('gpfs_mount_point_base', default='$state_path/mnt', help='Base folder where exported shares are located.'), cfg.StrOpt('gpfs_nfs_server_type', default='KNFS', help=('NFS Server type. Valid choices are "KNFS" (kernel NFS) ' 'or "GNFS" (Ganesha NFS).')), cfg.ListOpt('gpfs_nfs_server_list', help=('A list of the fully qualified NFS server names that ' 'make up the OpenStack Manila configuration.')), cfg.PortOpt('gpfs_ssh_port', default=22, help='GPFS server SSH port.'), cfg.StrOpt('gpfs_ssh_login', help='GPFS server SSH login name.'), cfg.StrOpt('gpfs_ssh_password', secret=True, help='GPFS server SSH login password. ' 'The password is not needed, if \'gpfs_ssh_private_key\' ' 'is configured.'), cfg.StrOpt('gpfs_ssh_private_key', help='Path to GPFS server SSH private key for login.'), cfg.ListOpt('gpfs_share_helpers', default=[ 'KNFS=manila.share.drivers.ibm.gpfs.KNFSHelper', 'GNFS=manila.share.drivers.ibm.gpfs.GNFSHelper', ], help='Specify list of share export helpers.'), cfg.StrOpt('knfs_export_options',
'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, help='TEMPLATES[OPTIONS]'), ] db_opts = [ # cfg.StrOpt('engine', default='django.db.backends.mysql', help='DATABASE[ENGINE]'), cfg.StrOpt('engine', default='django_mysqlpool.backends.mysqlpool', help='DATABASE[ENGINE]'), cfg.HostAddressOpt('host', default='127.0.0.1', help='DATABASE[HOST]'), cfg.PortOpt('port', default=3306, help='DATABASE[PORT]'), cfg.StrOpt('name', default='banbantong', help='DATABASE[NAME]'), cfg.StrOpt('user', default='root', help='DATABASE[USER]'), cfg.StrOpt('password', default='oseasydads_db', help='DATABASE[PASSWORD]'), # cfg.DictOpt('test', default={'CHARSET': 'utf8'}, help='DATABASE[TEST]'), cfg.BoolOpt('auto_optimize', default=True, help='DATABASE[AUTO_OPTIMIZE]'), cfg.IntOpt('auto_optimize_days', default=5, help='DATABASE[AUTO_OPTIMIZE_DAYS]'), cfg.IntOpt('conn_max_age', default=3600, help='DATABASE[CONN_MAX_AGE]'), ] server_opts = [ cfg.HostAddressOpt('rp_host', default='banbantong.os-easy.com', help='SERVER[RP_HOST]'),
# 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 api_service_opts = [ cfg.PortOpt('port', default=9517, help='The port for the zun API server.'), cfg.IPOpt('host_ip', default='$my_ip', help="The listen IP for the zun API server. " "The default is ``$my_ip``, " "the IP address of this host."), cfg.BoolOpt('enable_ssl_api', default=False, help="Enable the integrated stand-alone API to service " "requests via HTTPS instead of HTTP. If there is a " "front-end service performing HTTPS offloading from " "the service, this option should be False; note, you " "will want to change public API endpoint to represent " "SSL termination URL with 'public_endpoint' option."), cfg.IntOpt('workers', help="Number of workers for zun-api service. "
from oslo_db import options as db_options from oslo_log import log as logging import oslo_messaging as messaging from octavia.common import constants from octavia.common import utils from octavia.i18n import _LI from octavia import version LOG = logging.getLogger(__name__) core_opts = [ cfg.IPOpt('bind_host', default='127.0.0.1', help=_("The host IP to bind to")), cfg.PortOpt('bind_port', default=9876, help=_("The port to bind to")), cfg.StrOpt('auth_strategy', default=constants.NOAUTH, choices=[constants.NOAUTH, constants.KEYSTONE], help=_("The auth strategy for API requests.")), cfg.StrOpt('api_handler', default='queue_producer', help=_("The handler that the API communicates with")), cfg.StrOpt('api_paste_config', default="api-paste.ini", help=_("The API paste config file to use")), cfg.StrOpt('api_extensions_path', default="", help=_("The path for API extensions")), cfg.BoolOpt('allow_bulk', default=True,
default=10, help='Interval, in seconds, between nodes reporting state ' 'to datastore'), cfg.IntOpt('periodic_interval', default=60, help='Interval, in seconds, between running periodic tasks'), cfg.IntOpt('periodic_fuzzy_delay', default=60, help='Range, in seconds, to randomly delay when starting the' ' periodic task OperationEngine to reduce stampeding.' ' (Disable by setting to 0)'), cfg.StrOpt('osapi_karbor_listen', default="0.0.0.0", help='IP address on which OpenStack Karbor API listens'), cfg.PortOpt('osapi_karbor_listen_port', default=8799, help='Port on which OpenStack Karbor API listens'), cfg.IntOpt('osapi_karbor_workers', help='Number of workers for OpenStack Karbor API service. ' 'The default is equal to the number of CPUs available.'), ] CONF = cfg.CONF CONF.register_opts(service_opts) class Service(service.Service): """Service object for binaries running on hosts. A service takes a manager and enables rpc by listening to queues based on topic. It also periodically runs tasks on the manager and reports
import six from ceilometer.compute.virt import inspector as virt_inspector from ceilometer.compute.virt.vmware import vsphere_operations from ceilometer.i18n import _ vmware_api = None opt_group = cfg.OptGroup(name='vmware', title='Options for VMware') OPTS = [ cfg.HostAddressOpt('host_ip', default='127.0.0.1', help='IP address of the VMware vSphere host.'), cfg.PortOpt('host_port', default=443, help='Port of the VMware vSphere host.'), cfg.StrOpt('host_username', default='', help='Username of VMware vSphere.'), cfg.StrOpt('host_password', default='', help='Password of VMware vSphere.', secret=True), cfg.StrOpt('ca_file', help='CA bundle file to use in verifying the vCenter server ' 'certificate.'), cfg.BoolOpt('insecure', default=False, help='If true, the vCenter server certificate is not ' 'verified. If false, then the default CA truststore is ' 'used for verification. This option is ignored if '
cfg.ListOpt('mgt_net_proxy_ips', default=[], help=_('(Optional) Comma separated list of management network ' 'IP addresses for metadata proxy.')), cfg.StrOpt('mgt_net_proxy_netmask', help=_("(Optional) Management network netmask for metadata " "proxy.")), cfg.StrOpt('mgt_net_default_gateway', help=_("(Optional) Management network default gateway for " "metadata proxy.")), cfg.ListOpt('nova_metadata_ips', default=[], help=_("(Optional) IP addresses used by Nova metadata " "service.")), cfg.PortOpt('nova_metadata_port', default=8775, help=_("(Optional) TCP Port used by Nova metadata server.")), cfg.StrOpt('metadata_shared_secret', secret=True, help=_("(Optional) Shared secret to sign metadata requests.")), cfg.BoolOpt('metadata_insecure', default=True, help=_("(Optional) If True, the end to end connection for " "metadata service is not verified. If False, the " "default CA truststore is used for verification.")), cfg.StrOpt('metadata_nova_client_cert', help=_('(Optional) Client certificate to use when metadata ' 'connection is to be verified. If not provided, ' 'a self signed certificate will be used.')), cfg.StrOpt('metadata_nova_client_priv_key', help=_("(Optional) Private key of client certificate.")),
LOG = log.getLogger(__name__) auth_opts = [ cfg.StrOpt('api_paste_config', default="api_paste.ini", help="Configuration file for WSGI definition of API."), cfg.StrOpt('auth_strategy', choices=['noauth', 'keystone'], default='keystone', help=("The strategy to use for auth. Supports noauth and " "keystone")), ] api_opts = [ cfg.IPOpt('host_ip', default="0.0.0.0", help='Host serving the API.'), cfg.PortOpt('port', default=8889, help='Host port serving the API.'), cfg.BoolOpt('pecan_debug', default=False, help='Toggle Pecan Debug Middleware.'), ] CONF = cfg.CONF CONF.register_opts(auth_opts) CONF.register_opts(api_opts, group='api') def get_pecan_config(): # Set up the pecan configuration filename = api_config.__file__.replace('.pyc', '.py') return pecan.configuration.conf_from_file(filename)
from gnocchi import exceptions from gnocchi import incoming as gnocchi_incoming from gnocchi import indexer as gnocchi_indexer from gnocchi import json from gnocchi import storage as gnocchi_storage LOG = daiquiri.getLogger(__name__) API_OPTS = ( cfg.HostAddressOpt('host', default="0.0.0.0", help="Host to listen on"), cfg.PortOpt('port', default=8041, help="Port to listen on"), ) # Register our encoder by default for everything jsonify.jsonify.register(object)(json.to_primitive) class GnocchiHook(pecan.hooks.PecanHook): def __init__(self, storage, indexer, incoming, conf): self.storage = storage self.indexer = indexer self.incoming = incoming self.conf = conf
from six import string_types from cinder import exception from cinder.i18n import _ from cinder.objects import snapshot from cinder.objects import volume from cinder import utils from cinder.volume import configuration from cinder.volume import utils as volutils cinder_opts = [ cfg.StrOpt('synology_pool_name', default='', help='Volume on Synology storage to be used for creating lun.'), cfg.PortOpt('synology_admin_port', default=5000, help='Management port for Synology storage.'), cfg.StrOpt('synology_username', default='admin', help='Administrator of Synology storage.'), cfg.StrOpt('synology_password', default='', help='Password of administrator for logging in ' 'Synology storage.', secret=True), cfg.BoolOpt('synology_ssl_verify', default=True, help='Do certificate validation or not if ' '$driver_use_ssl is True'), cfg.StrOpt('synology_one_time_pass', default=None,
# 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 neutron_lib.utils import net from oslo_config import cfg from oslo_service import wsgi from neutron._i18n import _ from neutron.common import constants core_opts = [ cfg.HostAddressOpt('bind_host', default='0.0.0.0', help=_("The host IP to bind to.")), cfg.PortOpt('bind_port', default=9696, help=_("The port to bind to")), cfg.StrOpt('api_extensions_path', default="", help=_("The path for API extensions. " "Note that this can be a colon-separated list of paths. " "For example: api_extensions_path = " "extensions:/path/to/more/exts:/even/more/exts. " "The __path__ of neutron.extensions is appended to " "this, so if your extensions are in there you don't " "need to specify them here.")), cfg.StrOpt('auth_strategy', default='keystone', help=_("The type of authentication to use")), cfg.StrOpt('core_plugin', help=_("The core plugin Neutron will use")), cfg.ListOpt('service_plugins', default=[], help=_("The service plugins Neutron will use")), cfg.StrOpt('base_mac', default="fa:16:3e:00:00:00",
from nova.virt.vmwareapi import constants from nova.virt.vmwareapi import error_util from nova.virt.vmwareapi import host from nova.virt.vmwareapi import vim_util as nova_vim_util from nova.virt.vmwareapi import vm_util from nova.virt.vmwareapi import vmops from nova.virt.vmwareapi import volumeops LOG = logging.getLogger(__name__) vmwareapi_opts = [ cfg.StrOpt('host_ip', help='Hostname or IP address for connection to VMware ' 'vCenter host.'), cfg.PortOpt('host_port', default=443, help='Port for connection to VMware vCenter host.'), cfg.StrOpt('host_username', help='Username for connection to VMware vCenter host.'), cfg.StrOpt('host_password', help='Password for connection to VMware vCenter host.', secret=True), cfg.StrOpt('ca_file', help='Specify a CA bundle file to use in verifying the ' 'vCenter server certificate.'), cfg.BoolOpt('insecure', default=False, help='If true, the vCenter server certificate is not ' 'verified. If false, then the default CA truststore is ' 'used for verification. This option is ignored if ' '"ca_file" is set.'),
choices=['ovs-ofctl', 'native'], help=_("OpenFlow interface to use.")), cfg.StrOpt( 'datapath_type', default=constants.OVS_DATAPATH_SYSTEM, choices=[constants.OVS_DATAPATH_SYSTEM, constants.OVS_DATAPATH_NETDEV], help=_("OVS datapath to use.")), cfg.StrOpt('vhostuser_socket_dir', default=constants.VHOST_USER_SOCKET_DIR, help=_("OVS vhost-user socket directory.")), cfg.IPOpt('of_listen_address', default='127.0.0.1', help=_("Address to listen on for OpenFlow connections. " "Used only for 'native' driver.")), cfg.PortOpt('of_listen_port', default=6633, help=_("Port to listen on for OpenFlow connections. " "Used only for 'native' driver.")), cfg.IntOpt('of_connect_timeout', default=30, help=_("Timeout in seconds to wait for " "the local switch connecting the controller. " "Used only for 'native' driver.")), cfg.IntOpt('of_request_timeout', default=10, help=_("Timeout in seconds to wait for a single " "OpenFlow request. " "Used only for 'native' driver.")), ] agent_opts = [ cfg.IntOpt('polling_interval',
import os import socket from oslo_config import cfg from oslo_db import options as db_options from oslo_log import log as logging from oslo_middleware import cors from oslo_policy import opts as policy_opts from congress import version LOG = logging.getLogger(__name__) core_opts = [ cfg.StrOpt('bind_host', default='0.0.0.0', help="The host IP to bind to"), cfg.PortOpt('bind_port', default=1789, help="The port to bind to"), cfg.IntOpt('max_simultaneous_requests', default=1024, help="Thread pool size for eventlet."), cfg.BoolOpt('tcp_keepalive', default=False, help='Set this to true to enable TCP_KEEALIVE socket option ' 'on connections received by the API server.'), cfg.IntOpt('tcp_keepidle', default=600, help='Sets the value of TCP_KEEPIDLE in seconds for each ' 'server socket. Only applies if tcp_keepalive is ' 'true. Not supported on OS X.'), cfg.StrOpt('policy_path', help="The path to the latest policy dump", deprecated_for_removal=True,
cfg.StrOpt('global_request_id', default=APARAMS.get('ipa-global-request-id'), help='Global request ID header to provide to Ironic API. ' 'Can be supplied as "ipa-global-request-id" kernel ' 'parameter. The value must be in form "req-<UUID>".'), cfg.StrOpt('listen_host', default=APARAMS.get('ipa-listen-host', netutils.get_wildcard_address()), sample_default='::', help='The IP address to listen on. ' 'Can be supplied as "ipa-listen-host" kernel parameter.'), cfg.PortOpt('listen_port', default=int(APARAMS.get('ipa-listen-port', 9999)), help='The port to listen on. ' 'Can be supplied as "ipa-listen-port" kernel parameter.'), # This is intentionally not settable via kernel command line, as it # requires configuration parameters from oslo_service which are not # configurable over the command line and require files-on-disk. # Operators who want to use this support should configure it statically # as part of a ramdisk build. cfg.BoolOpt('listen_tls', default=False, help='When true, IPA will host API behind TLS. You will also ' 'need to configure [ssl] group options for cert_file, ' 'key_file, and, if desired, ca_file to validate client ' 'certificates.'), cfg.BoolOpt('enable_auto_tls',
# 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}
* attestation_port * attestation_api_url * attestation_auth_blob * attestation_auth_timeout * attestation_insecure_ssl """), cfg.PortOpt("attestation_port", default=8443, help=""" The port to use when connecting to the attestation server. See the `attestation_server` help text for more information about host verification. This option is only used by the FilterScheduler and its subclasses; if you use a different scheduler, this option has no effect. Also note that this setting only affects scheduling if the 'TrustedFilter' filter is enabled. Related options: * attestation_server * attestation_server_ca_file * attestation_api_url * attestation_auth_blob * attestation_auth_timeout * attestation_insecure_ssl """), cfg.StrOpt("attestation_api_url", default="/OpenAttestationWebServices/V1.0", help=""" The URL on the attestation server to use. See the `attestation_server` help text for more information about host verification.
* Ensure that this is the same IP address which is defined in the option ``base_url`` of this section or use ``0.0.0.0`` to listen on all addresses. """) serialproxy_port_opt = cfg.PortOpt('serialproxy_port', default=6083, help=""" The port number which is used by the ``nova-serialproxy`` service to listen for incoming requests. The ``nova-serialproxy`` service listens on this port number for incoming connection requests to instances which expose serial console. Possible values: * A port number Services which consume this: * ``nova-serialproxy`` Interdependencies to other options: * Ensure that this is the same port number which is defined in the option ``base_url`` of this section. """) ALL_OPTS = [enabled_opt, port_range_opt, base_url_opt, proxyclient_address_opt,
cfg.IntOpt('periodic_fuzzy_delay', default=60, help='Range of seconds to randomly delay when starting the' ' periodic task scheduler to reduce stampeding.' ' (Disable by setting to 0)'), cfg.ListOpt('enabled_apis', default=['osapi_compute', 'metadata'], help='A list of APIs to enable by default'), cfg.ListOpt('enabled_ssl_apis', default=[], help='A list of APIs with enabled SSL'), cfg.StrOpt('osapi_compute_listen', default="0.0.0.0", help='The IP address on which the OpenStack API will listen.'), cfg.PortOpt('osapi_compute_listen_port', default=8774, help='The port on which the OpenStack API will listen.'), cfg.IntOpt('osapi_compute_workers', help='Number of workers for OpenStack API service. The default ' 'will be the number of CPUs available.'), cfg.StrOpt('metadata_manager', default='nova.api.manager.MetadataManager', help='DEPRECATED: OpenStack metadata service manager', deprecated_for_removal=True), cfg.StrOpt('metadata_listen', default="0.0.0.0", help='The IP address on which the metadata API will listen.'), cfg.PortOpt('metadata_listen_port', default=8775, help='The port on which the metadata API will listen.'), cfg.IntOpt('metadata_workers',
from oslo_utils import netutils from oslo_utils import units from ceilometer import dispatcher from ceilometer.i18n import _ from ceilometer import messaging from ceilometer.publisher import utils as publisher_utils from ceilometer import utils OPTS = [ cfg.HostAddressOpt('udp_address', default='0.0.0.0', help='Address to which the UDP socket is bound. Set to ' 'an empty string to disable.'), cfg.PortOpt('udp_port', default=4952, help='Port to which the UDP socket is bound.'), cfg.IntOpt('batch_size', default=1, help='Number of notification messages to wait before ' 'dispatching them'), cfg.IntOpt('batch_timeout', help='Number of seconds to wait before dispatching samples ' 'when batch_size is not reached (None means indefinitely)'), cfg.IntOpt('workers', default=1, min=1, deprecated_group='DEFAULT', deprecated_name='collector_workers', help='Number of workers for collector service. ' 'default value is 1.')
* A valid IPv4 address * A valid IPv6 address Related options: * None """)), cfg.PortOpt('bind_port', help=_(""" Port number on which the server will listen. Provide a valid port number to bind the server's socket to. This port is then set to identify processes and forward network messages that arrive at the server. The default bind_port value for the API server is 9292 and for the registry server is 9191. Possible values: * A valid port number (0 to 65535) Related options: * None """)), ] socket_opts = [ cfg.IntOpt('backlog', default=4096, min=1, help=_(""" Set the number of incoming connection requests.
from cinder.db.sqlalchemy import api from cinder import exception from cinder.i18n import _ from cinder.image import image_utils from cinder import interface from cinder import utils from cinder.volume import driver LOG = logging.getLogger(__name__) disco_opts = [ cfg.IPOpt('disco_client', default='127.0.0.1', help='The IP of DMS client socket server'), cfg.PortOpt('disco_client_port', default='9898', help='The port to connect DMS client socket server'), cfg.StrOpt('disco_wsdl_path', default='/etc/cinder/DISCOService.wsdl', help='Path to the wsdl file ' 'to communicate with DISCO request manager'), cfg.StrOpt('volume_name_prefix', default='openstack-', help='Prefix before volume name to differentiate ' 'DISCO volume created through openstack ' 'and the other ones'), cfg.IntOpt('snapshot_check_timeout', default=3600, help='How long we check whether a snapshot ' 'is finished before we give up'), cfg.IntOpt('restore_check_timeout',
from oslo_config import cfg from ironic.common.i18n import _ opts = [ cfg.StrOpt('manager_ip', help=_('IP address of the XClarity Controller. ' 'Configuration here is deprecated and will be removed ' 'in the Stein release. Please update the driver_info ' 'field to use "xclarity_manager_ip" instead')), cfg.StrOpt('username', help=_('Username for the XClarity Controller. ' 'Configuration here is deprecated and will be removed ' 'in the Stein release. Please update the driver_info ' 'field to use "xclarity_username" instead')), cfg.StrOpt('password', secret=True, help=_('Password for XClarity Controller username. ' 'Configuration here is deprecated and will be removed ' 'in the Stein release. Please update the driver_info ' 'field to use "xclarity_password" instead')), cfg.PortOpt('port', default=443, help=_('Port to be used for XClarity Controller ' 'connection.')), ] def register_opts(conf): conf.register_opts(opts, group='xclarity')
default=10, help='Interval, in seconds, between nodes reporting state ' 'to datastore'), cfg.IntOpt('periodic_interval', default=60, help='Interval, in seconds, between running periodic tasks'), cfg.IntOpt('periodic_fuzzy_delay', default=60, help='Range, in seconds, to randomly delay when starting the' ' periodic task scheduler to reduce stampeding.' ' (Disable by setting to 0)'), cfg.StrOpt('osapi_volume_listen', default="0.0.0.0", help='IP address on which OpenStack Volume API listens'), cfg.PortOpt('osapi_volume_listen_port', default=8776, help='Port on which OpenStack Volume API listens'), cfg.IntOpt('osapi_volume_workers', help='Number of workers for OpenStack Volume API service. ' 'The default is equal to the number of CPUs available.'), cfg.BoolOpt('osapi_volume_use_ssl', default=False, help='Wraps the socket in a SSL context if True is set. ' 'A certificate file and key file must be specified.'), ] CONF = cfg.CONF CONF.register_opts(service_opts) if profiler_opts: profiler_opts.set_defaults(CONF)
class GeneratorTestCase(base.BaseTestCase): groups = { 'group1': cfg.OptGroup(name='group1', help='Lorem ipsum dolor sit amet, consectetur ' 'adipisicing elit, sed do eiusmod tempor ' 'incididunt ut labore et dolore magna ' 'aliqua. Ut enim ad minim veniam, quis ' 'nostrud exercitation ullamco laboris ' 'nisi ut aliquip ex ea commodo ' 'consequat. Duis aute irure dolor in.'), 'group2': cfg.OptGroup(name='group2', title='Group 2'), 'foo': cfg.OptGroup(name='foo', title='Foo Title', help='foo help'), } opts = { 'foo': cfg.StrOpt('foo', help='foo option'), 'bar': cfg.StrOpt('bar', help='bar option'), 'foo-bar': cfg.StrOpt('foo-bar', help='foobar'), 'no_help': cfg.StrOpt('no_help'), 'long_help': cfg.StrOpt('long_help', help='Lorem ipsum dolor sit amet, consectetur ' 'adipisicing elit, sed do eiusmod tempor ' 'incididunt ut labore et dolore magna ' 'aliqua. Ut enim ad minim veniam, quis ' 'nostrud exercitation ullamco laboris ' 'nisi ut aliquip ex ea commodo ' 'consequat. Duis aute irure dolor in ' 'reprehenderit in voluptate velit esse ' 'cillum dolore eu fugiat nulla ' 'pariatur. Excepteur sint occaecat ' 'cupidatat non proident, sunt in culpa ' 'qui officia deserunt mollit anim id est ' 'laborum.'), 'long_help_pre': cfg.StrOpt('long_help_pre', help='This is a very long help text which ' 'is preformatted with line breaks. ' 'It should break when it is too long ' 'but also keep the specified line ' 'breaks. This makes it possible to ' 'create lists with items:\n' '\n' '* item 1\n' '* item 2\n' '\n' 'and should increase the ' 'readability.'), 'choices_opt': cfg.StrOpt('choices_opt', default='a', choices=(None, '', 'a', 'b', 'c'), help='a string with choices'), 'deprecated_opt': cfg.StrOpt('bar', deprecated_name='foobar', help='deprecated'), 'deprecated_for_removal_opt': cfg.StrOpt('bar', deprecated_for_removal=True, help='deprecated for removal'), 'deprecated_group': cfg.StrOpt('bar', deprecated_group='group1', deprecated_name='foobar', help='deprecated'), # Unknown Opt default must be a string 'unknown_type': cfg.Opt('unknown_opt', default='123', help='unknown', type=types.String(type_name='unknown type')), 'str_opt': cfg.StrOpt('str_opt', default='foo bar', help='a string'), 'str_opt_sample_default': cfg.StrOpt('str_opt', default='fooishbar', help='a string'), 'str_opt_with_space': cfg.StrOpt('str_opt', default=' foo bar ', help='a string with spaces'), 'bool_opt': cfg.BoolOpt('bool_opt', default=False, help='a boolean'), 'int_opt': cfg.IntOpt('int_opt', default=10, min=1, max=20, help='an integer'), 'float_opt': cfg.FloatOpt('float_opt', default=0.1, help='a float'), 'list_opt': cfg.ListOpt('list_opt', default=['1', '2', '3'], help='a list'), 'dict_opt': cfg.DictOpt('dict_opt', default={ '1': 'yes', '2': 'no' }, help='a dict'), 'ip_opt': cfg.IPOpt('ip_opt', default='127.0.0.1', help='an ip address'), 'port_opt': cfg.PortOpt('port_opt', default=80, help='a port'), 'multi_opt': cfg.MultiStrOpt('multi_opt', default=['1', '2', '3'], help='multiple strings'), 'multi_opt_none': cfg.MultiStrOpt('multi_opt_none', help='multiple strings'), 'multi_opt_empty': cfg.MultiStrOpt('multi_opt_empty', default=[], help='multiple strings'), 'multi_opt_sample_default': cfg.MultiStrOpt('multi_opt', default=['1', '2', '3'], sample_default=['5', '6'], help='multiple strings'), 'custom_type_name': cfg.Opt('custom_opt_type', type=types.Integer(type_name='port' ' number'), default=5511, help='this is a port'), } content_scenarios = [ ('empty', dict(opts=[], expected='''[DEFAULT] ''')), ('single_namespace', dict(opts=[('test', [(None, [opts['foo']])])], expected='''[DEFAULT] # # From test # # foo option (string value) #foo = <None> ''')), ('multiple_namespaces', dict(opts=[('test', [(None, [opts['foo']])]), ('other', [(None, [opts['bar']])])], expected='''[DEFAULT] # # From other # # bar option (string value) #bar = <None> # # From test # # foo option (string value) #foo = <None> ''')), ('group', dict(opts=[('test', [(groups['group1'], [opts['foo']])])], expected='''[DEFAULT] [group1] # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do # eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim # ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut # aliquip ex ea commodo consequat. Duis aute irure dolor in. # # From test # # foo option (string value) #foo = <None> ''')), ('empty_group', dict(opts=[('test', [(groups['group1'], [])])], expected='''[DEFAULT] ''')), ('multiple_groups', dict(opts=[('test', [(groups['group1'], [opts['foo']]), (groups['group2'], [opts['bar']])])], expected='''[DEFAULT] [group1] # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do # eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim # ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut # aliquip ex ea commodo consequat. Duis aute irure dolor in. # # From test # # foo option (string value) #foo = <None> [group2] # # From test # # bar option (string value) #bar = <None> ''')), ('group_in_multiple_namespaces', dict(opts=[('test', [(groups['group1'], [opts['foo']])]), ('other', [(groups['group1'], [opts['bar']])])], expected='''[DEFAULT] [group1] # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do # eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim # ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut # aliquip ex ea commodo consequat. Duis aute irure dolor in. # # From other # # bar option (string value) #bar = <None> # # From test # # foo option (string value) #foo = <None> ''')), ('hyphenated_name', dict(opts=[('test', [(None, [opts['foo-bar']])])], expected='''[DEFAULT] # # From test # # foobar (string value) #foo_bar = <None> ''')), ('no_help', dict(opts=[('test', [(None, [opts['no_help']])])], log_warning=('"%s" is missing a help string', 'no_help'), expected='''[DEFAULT] # # From test # # (string value) #no_help = <None> ''')), ('long_help', dict(opts=[('test', [(None, [opts['long_help']])])], expected='''[DEFAULT] # # From test # # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do # eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim # ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut # aliquip ex ea commodo consequat. Duis aute irure dolor in # reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla # pariatur. Excepteur sint occaecat cupidatat non proident, sunt in # culpa qui officia deserunt mollit anim id est laborum. (string # value) #long_help = <None> ''')), ('long_help_wrap_at_40', dict(opts=[('test', [(None, [opts['long_help']])])], wrap_width=40, expected='''[DEFAULT] # # From test # # Lorem ipsum dolor sit amet, # consectetur adipisicing elit, sed do # eiusmod tempor incididunt ut labore et # dolore magna aliqua. Ut enim ad minim # veniam, quis nostrud exercitation # ullamco laboris nisi ut aliquip ex ea # commodo consequat. Duis aute irure # dolor in reprehenderit in voluptate # velit esse cillum dolore eu fugiat # nulla pariatur. Excepteur sint # occaecat cupidatat non proident, sunt # in culpa qui officia deserunt mollit # anim id est laborum. (string value) #long_help = <None> ''')), ( 'long_help_no_wrapping', dict( opts=[('test', [(None, [opts['long_help']])])], wrap_width=0, expected='''[DEFAULT] # # From test # ''' # noqa '# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod ' 'tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, ' 'quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo ' 'consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse ' 'cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat ' 'non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ' '(string value)' ''' #long_help = <None> ''')), ('long_help_with_preformatting', dict(opts=[('test', [(None, [opts['long_help_pre']])])], wrap_width=70, expected='''[DEFAULT] # # From test # # This is a very long help text which is preformatted with line # breaks. It should break when it is too long but also keep the # specified line breaks. This makes it possible to create lists with # items: # # * item 1 # * item 2 # # and should increase the readability. (string value) #long_help_pre = <None> ''')), ('choices_opt', dict(opts=[('test', [(None, [opts['choices_opt']])])], expected='''[DEFAULT] # # From test # # a string with choices (string value) # Allowed values: <None>, '', a, b, c #choices_opt = a ''')), ('deprecated', dict(opts=[('test', [(groups['foo'], [opts['deprecated_opt']])])], expected='''[DEFAULT] [foo] # foo help # # From test # # deprecated (string value) # Deprecated group/name - [DEFAULT]/foobar #bar = <None> ''')), ('deprecated_for_removal', dict(opts=[('test', [(groups['foo'], [opts['deprecated_for_removal_opt']])])], expected='''[DEFAULT] [foo] # foo help # # From test # # deprecated for removal (string value) # This option is deprecated for removal. # Its value may be silently ignored in the future. #bar = <None> ''')), ('deprecated_group', dict(opts=[('test', [(groups['foo'], [opts['deprecated_group']])])], expected='''[DEFAULT] [foo] # foo help # # From test # # deprecated (string value) # Deprecated group/name - [group1]/foobar #bar = <None> ''')), ('unknown_type', dict(opts=[('test', [(None, [opts['unknown_type']])])], log_warning=('Unknown option type: %s', repr(opts['unknown_type'])), expected='''[DEFAULT] # # From test # # unknown (unknown type) #unknown_opt = 123 ''')), ('str_opt', dict(opts=[('test', [(None, [opts['str_opt']])])], expected='''[DEFAULT] # # From test # # a string (string value) #str_opt = foo bar ''')), ('str_opt_with_space', dict(opts=[('test', [(None, [opts['str_opt_with_space']])])], expected='''[DEFAULT] # # From test # # a string with spaces (string value) #str_opt = " foo bar " ''')), ('bool_opt', dict(opts=[('test', [(None, [opts['bool_opt']])])], expected='''[DEFAULT] # # From test # # a boolean (boolean value) #bool_opt = false ''')), ('int_opt', dict(opts=[('test', [(None, [opts['int_opt']])])], expected='''[DEFAULT] # # From test # # an integer (integer value) # Minimum value: 1 # Maximum value: 20 #int_opt = 10 ''')), ('float_opt', dict(opts=[('test', [(None, [opts['float_opt']])])], expected='''[DEFAULT] # # From test # # a float (floating point value) #float_opt = 0.1 ''')), ('list_opt', dict(opts=[('test', [(None, [opts['list_opt']])])], expected='''[DEFAULT] # # From test # # a list (list value) #list_opt = 1,2,3 ''')), ('dict_opt', dict(opts=[('test', [(None, [opts['dict_opt']])])], expected='''[DEFAULT] # # From test # # a dict (dict value) #dict_opt = 1:yes,2:no ''')), ('ip_opt', dict(opts=[('test', [(None, [opts['ip_opt']])])], expected='''[DEFAULT] # # From test # # an ip address (ip address value) #ip_opt = 127.0.0.1 ''')), ('port_opt', dict(opts=[('test', [(None, [opts['port_opt']])])], expected='''[DEFAULT] # # From test # # a port (port value) # Minimum value: 1 # Maximum value: 65535 #port_opt = 80 ''')), ('multi_opt', dict(opts=[('test', [(None, [opts['multi_opt']])])], expected='''[DEFAULT] # # From test # # multiple strings (multi valued) #multi_opt = 1 #multi_opt = 2 #multi_opt = 3 ''')), ('multi_opt_none', dict(opts=[('test', [(None, [opts['multi_opt_none']])])], expected='''[DEFAULT] # # From test # # multiple strings (multi valued) #multi_opt_none = ''')), ('multi_opt_empty', dict(opts=[('test', [(None, [opts['multi_opt_empty']])])], expected='''[DEFAULT] # # From test # # multiple strings (multi valued) #multi_opt_empty = ''')), ('str_opt_sample_default', dict(opts=[('test', [(None, [opts['str_opt_sample_default']])])], expected='''[DEFAULT] # # From test # # a string (string value) #str_opt = fooishbar ''')), ('multi_opt_sample_default', dict(opts=[('test', [(None, [opts['multi_opt_sample_default']])])], expected='''[DEFAULT] # # From test # # multiple strings (multi valued) #multi_opt = 5 #multi_opt = 6 ''')), ('custom_type_name', dict(opts=[('test', [(None, [opts['custom_type_name']])])], log_warning=('Unknown option type: %s', repr(opts['custom_type_name'])), expected='''[DEFAULT] # # From test # # this is a port (port number) #custom_opt_type = 5511 ''')), ] output_file_scenarios = [ ('stdout', dict(stdout=True, output_file=None)), ('output_file', dict(output_file='sample.conf', stdout=False)), ] @classmethod def generate_scenarios(cls): cls.scenarios = testscenarios.multiply_scenarios( cls.content_scenarios, cls.output_file_scenarios) def setUp(self): super(GeneratorTestCase, self).setUp() self.conf = cfg.ConfigOpts() self.config_fixture = config_fixture.Config(self.conf) self.config = self.config_fixture.config self.useFixture(self.config_fixture) self.tempdir = self.useFixture(fixtures.TempDir()) def _capture_stream(self, stream_name): self.useFixture( fixtures.MonkeyPatch("sys.%s" % stream_name, moves.StringIO())) return getattr(sys, stream_name) def _capture_stdout(self): return self._capture_stream('stdout') @mock.patch('stevedore.named.NamedExtensionManager') @mock.patch.object(generator, 'LOG') def test_generate(self, mock_log, named_mgr): generator.register_cli_opts(self.conf) namespaces = [i[0] for i in self.opts] self.config(namespace=namespaces) for group in self.groups.values(): self.conf.register_group(group) wrap_width = getattr(self, 'wrap_width', None) if wrap_width is not None: self.config(wrap_width=wrap_width) if self.stdout: stdout = self._capture_stdout() else: output_file = self.tempdir.join(self.output_file) self.config(output_file=output_file) mock_eps = [] for name, opts in self.opts: mock_ep = mock.Mock() mock_ep.configure_mock(name=name, obj=opts) mock_eps.append(mock_ep) named_mgr.return_value = mock_eps generator.generate(self.conf) if self.stdout: self.assertEqual(self.expected, stdout.getvalue()) else: content = open(output_file).read() self.assertEqual(self.expected, content) named_mgr.assert_called_once_with( 'oslo.config.opts', names=namespaces, on_load_failure_callback=generator.on_load_failure_callback, invoke_on_load=True) log_warning = getattr(self, 'log_warning', None) if log_warning is not None: mock_log.warning.assert_called_once_with(*log_warning) else: self.assertFalse(mock_log.warning.called)
import oslo_messaging as om from pprint import pprint import logging logging.basicConfig() log = logging.getLogger() log.addHandler(logging.StreamHandler()) log.setLevel(logging.INFO) rabbit_group = cfg.OptGroup(name='rabbit', title='RabbitMQ options') opts = [ cfg.StrOpt('rpc_backend'), cfg.StrOpt('rabbit_host'), cfg.PortOpt('rabbit_port'), cfg.StrOpt('rabbit_virtual_host'), cfg.StrOpt('rabbita_login_method'), cfg.StrOpt('rabbit_userid'), cfg.StrOpt('rabbit_password'), ] # #CONF = cfg.ConfigOpts() CONF = cfg.CONF CONF(['--config-file', 'rabbit.conf']) CONF.register_opts(opts) #CONF.register_opts(opts, group=rabbit_group) # or #CONF.register_opts(opts, group='rabbit')) cfg.CONF.set_override('rpc_backend', 'rabbit') cfg.CONF.set_override('rabbit_host', '192.168.111.39')
import webob.dec import webob.exc from webob import multidict from glance.common import config from glance.common import exception from glance.common import utils from glance import i18n from glance.i18n import _, _LE, _LI, _LW bind_opts = [ cfg.StrOpt('bind_host', default='0.0.0.0', help=_('Address to bind the server. Useful when ' 'selecting a particular network interface.')), cfg.PortOpt('bind_port', help=_('The port on which the server will listen.')), ] socket_opts = [ cfg.IntOpt('backlog', default=4096, help=_('The backlog value that will be used when creating the ' 'TCP listener socket.')), cfg.IntOpt('tcp_keepidle', default=600, help=_('The value for the socket option TCP_KEEPIDLE. This is ' 'the time in seconds that the connection must be idle ' 'before TCP starts sending keepalive probes.')), cfg.StrOpt('ca_file', help=_('CA certificate file to use to verify ' 'connecting clients.')), cfg.StrOpt('cert_file', help=_('Certificate file to use when starting API ' 'server securely.')), cfg.StrOpt('key_file', help=_('Private key file to use when starting API '
# 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 from mogan.common.i18n import _ opts = [ cfg.HostAddressOpt('host_ip', default='0.0.0.0', help=_('The IP address on which mogan-api listens.')), cfg.PortOpt('port', default=6688, help=_('The TCP port on which mogan-api listens.')), cfg.IntOpt('max_limit', default=1000, help=_('The maximum number of items returned in a single ' 'response from a collection resource.')), cfg.StrOpt('public_endpoint', help=_("Public URL to use when building the links to the API " "resources (for example, \"https://mogan.rocks:6688\")." " If None the links will be built using the request's " "host URL. If the API is operating behind a proxy, you " "will want to change this to represent the proxy's URL. " "Defaults to None.")), cfg.IntOpt('api_workers', help=_('Number of workers for OpenStack Mogan API service. ' 'The default is equal to the number of CPUs available '