def _register_app_opts(): # Note "host" and "port" options are registerd as part of st2common since they are also used # outside st2api api_opts = [ cfg.ListOpt('allow_origin', default=['http://localhost:3000'], help='List of origins allowed'), cfg.IntOpt( 'heartbeat', default=25, help='Send empty message every N seconds to keep connection open') ] CONF.register_opts(api_opts, group='api') pecan_opts = [ cfg.StrOpt('root', default='st2api.controllers.root.RootController', help='Action root controller'), cfg.StrOpt('static_root', default='%(confdir)s/public'), cfg.StrOpt('template_path', default='%(confdir)s/st2api/st2api/templates'), cfg.ListOpt('modules', default=['st2api']), cfg.BoolOpt('debug', default=True), cfg.BoolOpt('auth_enable', default=True), cfg.DictOpt('errors', default={'__force_dict__': True}) ] CONF.register_opts(pecan_opts, group='api_pecan') logging_opts = [ cfg.StrOpt('logging', default='conf/logging.conf', help='location of the logging.conf file') ] CONF.register_opts(logging_opts, group='api')
def _register_app_opts(): api_opts = [ cfg.StrOpt('host', default='0.0.0.0', help='StackStorm Robotinator API server host'), cfg.IntOpt('port', default=9101, help='StackStorm Robotinator API server port'), cfg.ListOpt('allow_origin', default=['http://localhost:3000'], help='List of origins allowed') ] CONF.register_opts(api_opts, group='api') pecan_opts = [ cfg.StrOpt('root', default='st2api.controllers.root.RootController', help='Action root controller'), cfg.StrOpt('static_root', default='%(confdir)s/public'), cfg.StrOpt('template_path', default='%(confdir)s/st2api/templates'), cfg.ListOpt('modules', default=['st2api']), cfg.BoolOpt('debug', default=True), cfg.BoolOpt('auth_enable', default=True), cfg.DictOpt('errors', default={'__force_dict__': True}) ] CONF.register_opts(pecan_opts, group='api_pecan') logging_opts = [ cfg.StrOpt('logging', default='conf/logging.conf', help='location of the logging.conf file') ] CONF.register_opts(logging_opts, group='api')
def register_dynamic_pool_options(): # Pool Options Registration Pass One # Find the Current Pool ID pool_id = CONF['service:pool_manager'].pool_id # Build the [pool:<id>] config section pool_group = cfg.OptGroup('pool:%s' % pool_id) pool_opts = [ cfg.ListOpt('targets', default=[]), cfg.ListOpt('nameservers', default=[]), cfg.ListOpt('also_notifies', default=[]), ] CONF.register_group(pool_group) CONF.register_opts(pool_opts, group=pool_group) # Pool Options Registration Pass Two # Find the Current Pools Target ID's pool_target_ids = CONF['pool:%s' % pool_id].targets # Build the [pool_target:<id>] config sections pool_target_opts = [ cfg.StrOpt('type'), cfg.ListOpt('masters', default=[]), cfg.DictOpt('options', default={}), ] for pool_target_id in pool_target_ids: pool_target_group = cfg.OptGroup('pool_target:%s' % pool_target_id) CONF.register_group(pool_target_group) CONF.register_opts(pool_target_opts, group=pool_target_group) # Find the Current Pools Nameserver ID's pool_nameserver_ids = CONF['pool:%s' % pool_id].nameservers # Build the [pool_nameserver:<id>] config sections pool_nameserver_opts = [ cfg.StrOpt('host'), cfg.IntOpt('port'), ] for pool_nameserver_id in pool_nameserver_ids: pool_nameserver_group = cfg.OptGroup('pool_nameserver:%s' % pool_nameserver_id) CONF.register_group(pool_nameserver_group) CONF.register_opts(pool_nameserver_opts, group=pool_nameserver_group)
def _register_api_opts(): api_opts = [ cfg.ListOpt('allow_origin', default=['http://*****:*****@localhost:5672//', help='URL of the messaging server.') ] _register_opts(messaging_opts, group='messaging') ssh_runner_opts = [ cfg.StrOpt('remote_dir', default='/tmp', help='Location of the script on the remote filesystem.'), cfg.BoolOpt( 'allow_partial_failure', default=False, help= 'How partial success of actions run on multiple nodes should be treated.' ) ] _register_opts(ssh_runner_opts, group='ssh_runner')
def _register_app_opts(): # Note "host" and "port" options are registerd as part of st2common since they are also used # outside st2api api_opts = [ cfg.ListOpt('allow_origin', default=['http://localhost:3000'], help='List of origins allowed'), cfg.BoolOpt( 'serve_webui_files', default=True, help='Enable to serve static WebUI files using the API service'), cfg.IntOpt( 'heartbeat', default=25, help='Send empty message every N seconds to keep connection open') ] CONF.register_opts(api_opts, group='api') static_root = os.path.join(cfg.CONF.system.base_path, 'static') template_path = os.path.join(BASE_DIR, 'templates/') pecan_opts = [ cfg.StrOpt('root', default='st2api.controllers.root.RootController', help='Action root controller'), cfg.StrOpt('static_root', default=static_root), cfg.StrOpt('template_path', default=template_path), cfg.ListOpt('modules', default=['st2api']), cfg.BoolOpt('debug', default=False), cfg.BoolOpt('auth_enable', default=True), cfg.DictOpt('errors', default={'__force_dict__': True}) ] CONF.register_opts(pecan_opts, group='api_pecan') logging_opts = [ cfg.StrOpt('logging', default='conf/logging.conf', help='location of the logging.conf file') ] CONF.register_opts(logging_opts, group='api')
help=_('Service compression throughput. Default: 100.')), cfg.IntOpt('service_cache', default=20, help=_('Size of service cache. Default: 20.')), cfg.StrOpt('l2_l3_workflow_name', default='openstack_l2_l3', help=_('Name of l2_l3 workflow. Default: ' 'openstack_l2_l3.')), cfg.StrOpt('l4_workflow_name', default='openstack_l4', help=_('Name of l4 workflow. Default: openstack_l4.')), cfg.DictOpt('l2_l3_ctor_params', default={ "service": "_REPLACE_", "ha_network_name": "HA-Network", "ha_ip_pool_name": "default", "allocate_ha_vrrp": True, "allocate_ha_ips": True, "twoleg_enabled": "_REPLACE_" }, help=_('Parameter for l2_l3 workflow constructor.')), cfg.DictOpt('l2_l3_setup_params', default={ "data_port": 1, "data_ip_address": "192.168.200.99", "data_ip_mask": "255.255.255.0", "gateway": "192.168.200.1", "ha_port": 2 }, help=_('Parameter for l2_l3 workflow setup.')), cfg.ListOpt('actions_to_skip', default=['setup_l2_l3'],
help='Load balancing strategy for ' 'connecting to cluster nodes'), cfg.StrOpt('consistency_level', default='ONE', help='Consistency level of your cassandra query'), cfg.StrOpt('migrations', default=os.path.join(os.path.dirname(__file__), 'migrations'), help='Path to directory containing CQL migration scripts'), cfg.IntOpt('max_schema_agreement_wait', default=10, help='The maximum duration (in seconds) that the driver will' ' wait for schema agreement across the cluster.'), cfg.StrOpt('keyspace', default='canary', help='Keyspace for all queries made in session'), cfg.DictOpt( 'replication_strategy', default={ 'class': 'SimpleStrategy', 'replication_factor': '1' }, help='Replication strategy for Cassandra cluster'), ] CASSANDRA_GROUP = cfg.OptGroup( name='cassandra', title='cassandra options' ) conf.register_opts(_CASSANDRA_OPTIONS, group=CASSANDRA_GROUP) CQL_GET_JOB_DETAILS = ''' SELECT jobs, job_count
cfg.StrOpt('remote_nova_client', default='trove.common.remote.nova_client'), cfg.StrOpt('remote_cinder_client', default='trove.common.remote.cinder_client'), cfg.StrOpt('remote_heat_client', default='trove.common.remote.heat_client'), cfg.StrOpt('remote_swift_client', default='trove.common.remote.swift_client'), cfg.StrOpt('exists_notification_transformer', help='Transformer for exists notifications'), cfg.IntOpt('exists_notification_ticks', default=360, help='Number of report_intevals to wait between pushing events ' '(see report_interval)'), cfg.DictOpt('notification_service_id', default={}, help='Unique ID to tag notification events'), cfg.StrOpt('nova_proxy_admin_user', default='', help="Admin username used to connect to Nova", secret=True), cfg.StrOpt('nova_proxy_admin_pass', default='', help="Admin password used to connect to Nova", secret=True), cfg.StrOpt('nova_proxy_admin_tenant_name', default='', help="Admin tenant used to connect to Nova", secret=True), cfg.StrOpt('network_label_regex', default='^private$'), cfg.StrOpt('cloudinit_location',
class GeneratorTestCase(base.BaseTestCase): opts = { 'foo': cfg.StrOpt('foo', help='foo option'), 'foo_i18n_help': cfg.StrOpt( 'foo_i18n_help', help=i18n_fixture.Translation().lazy('this is a lazy message')), '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.'), '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_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'), '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, 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'), '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'), } 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', [('group1', [opts['foo']])])], expected='''[DEFAULT] [group1] # # From test # # foo option (string value) #foo = <None> ''')), ('empty_group', dict(opts=[('test', [('group1', [])])], expected='''[DEFAULT] ''')), ('multiple_groups', dict(opts=[('test', [('group1', [opts['foo']]), ('group2', [opts['bar']])])], expected='''[DEFAULT] [group1] # # From test # # foo option (string value) #foo = <None> [group2] # # From test # # bar option (string value) #bar = <None> ''')), ('group_in_multiple_namespaces', dict(opts=[('test', [('group1', [opts['foo']])]), ('other', [('group1', [opts['bar']])])], expected='''[DEFAULT] [group1] # # 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> ''')), ('i18n_help', dict(opts=[('test', [(None, [opts['foo_i18n_help']])])], expected='''[DEFAULT] # # From test # # this is a lazy message (string value) #foo_i18n_help = <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> ''')), ('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', [('foo', [opts['deprecated_opt']])])], expected='''[DEFAULT] [foo] # # From test # # deprecated (string value) # Deprecated group/name - [DEFAULT]/foobar #bar = <None> ''')), ('deprecated_group', dict(opts=[('test', [('foo', [opts['deprecated_group']])])], expected='''[DEFAULT] [foo] # # 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) #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 ''')), ('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 ''')), ] 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('oslo_config.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) 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)
""" This module contains definitions for a handful of helper functions which aid in instance translations. """ from oslo.config import cfg # Get the config instance and add options: CONF = cfg.CONF CONF.register_opts([ # Dict option for mapping Nova sizes to Azure sizes: cfg.DictOpt( 'nova_vm_flavor_size_map', default={ 'm1.tiny': "Basic_A0", 'm1.small': "Basic_A1", 'm1.medium': "Basic_A2", 'm1.large': "Basic_A3", 'm1.xlarge': "Basic_A4", }, help='A map between OpenStack Nova flavors and Azure VM sizes'), # Mapping between Nova image names and Azure images: cfg.DictOpt( 'nova_vm_image_map', default={ 'ubuntu.12.04.LTS.x86_64': "Canonical;UbuntuServer;12.04.5-LTS", }, help='A map between OpenStack Nova and Azure VM images'), ])
], 'MAIL') CONF.register_opts( [cfg.StrOpt('allow_ip'), cfg.StrOpt('secret_key'), cfg.StrOpt('env')], 'etc') CONF.register_opts([ cfg.IntOpt('dnsupdater_port'), ], 'api') CONF.register_opts([ cfg.StrOpt('acl_groups'), cfg.IntOpt('cname_ttl'), cfg.StrOpt('view_zone'), cfg.DictOpt('normal_view'), cfg.DictOpt('normal_cname'), ], 'view') CONF.register_opts([ cfg.StrOpt('base-url', default='/', help='The url prefix of this site.'), cfg.StrOpt('run-mode', default="werkzeug", choices=('gunicorn', 'werkzeug'), help="Run server use the specify mode."), cfg.StrOpt('bind', default='0.0.0.0', help='The IP address to bind'), cfg.IntOpt('port', default=8080, help='The port to listen'), cfg.BoolOpt('debug', default=False), ], 'web') CONF.register_opts([
cfg.StrOpt('cascaded_node_ip', default='127.0.0.1'), cfg.StrOpt('availability_zone', default='RegionOne'), cfg.StrOpt('cascading_os_region_name', default='RegionOne') ] CONF.register_group(node_cfg_group) CONF.register_opts(node_cfg_opts, node_cfg_group) cascading_node_plugins_group = cfg.OptGroup( 'cascading_node_plugins', title='For define cascading plugin') cascading_node_plugins_opts = [ cfg.BoolOpt(PathTriCircle.PATCH_NOVA_SCHEDULING, default=True), cfg.BoolOpt('neutron_cascading_big2layer_patch', default=True), cfg.BoolOpt('neutron_cascading_l3_patch', default=False), cfg.DictOpt('endpoints_info', default=None) ] cascaded_node_plugins_group = cfg.OptGroup(name='cascaded_node_plugins', title='For define cascaded plugin') cascaded_node_plugins_opts = [ cfg.BoolOpt('neutron_cascaded_big2layer_patch', default=True), cfg.BoolOpt('neutron_cascaded_l3_patch', default=False), cfg.BoolOpt('neutron_timestamp_cascaded_patch', default=True), cfg.BoolOpt('cinder_timestamp_query_patch', default=True), cfg.StrOpt('aggregate_name', default=None) ] proxy_node_plugins_group = cfg.OptGroup( name='proxy_node_plugins',
cfg.StrOpt('cgw_certificate', default='', help='full name of compute gateway public key'), cfg.StrOpt('storage_tmp_dir', default='wfbucketse', help='a cloud storage temp directory'), cfg.StrOpt('availability_zone', default='ap-southeast-1a', help='the availability_zone for connection to EC2 ') ] vgw_opts = [ cfg.DictOpt('vgw_url', default={ 'fs_vgw_url': 'http://162.3.114.107:8090/', 'vcloud_vgw_url': 'http://162.3.114.108:8090/', 'aws_vgw_url': 'http://172.27.12.245:8090/' }, help="These values will be used for upload/download image " "from vgw host."), cfg.StrOpt('store_file_dir', default='/home/upload', help='Directory used for temporary storage ' 'during migrate volume'), cfg.StrOpt('rpc_service_port', default='9999', help='port of rpc service') ] LOG = logging.getLogger(__name__) CONF = cfg.CONF CONF.register_opts(ec2api_opts) CONF.register_opts(vgw_opts, 'vgw')
###################################################################################### print "Registering mutiple parameters now" mymultipleconfig = [ cfg.StrOpt('bind_host', default='0.0.0.0', help='IP address to listen on.'), cfg.Opt('bind_port', default='9292', help='Port number to listen on.') ] cfg.CONF.register_opts( mymultipleconfig) # registering the multiple configurations print "Checking out the configuration" for k, v in cfg.CONF.iteritems(): print k, v print "Listing complete" cfg.CONF.unregister_opts(mymultipleconfig) # un-registering the configuration print "Registering DICTIONARY parameters now" mydict = {'ip': 'v4', 'class': 'A'} mynewconfig = [ cfg.DictOpt('myconfig', default=mydict, help='this is my help'), ] # initializing the configuration string cfg.CONF.register_opts(mynewconfig) # registering the configuration for k, v in cfg.CONF.iteritems(): print k, v print "Listing complete"
help='Username which is used for access to Hadoop services.'), cfg.StrOpt('HADOOP_EXAMPLES_JAR_PATH', default='/usr/share/hadoop/hadoop-examples-1.2.1.jar', help='Path to hadoop examples jar file.'), cfg.StrOpt('HADOOP_LOG_DIRECTORY', default='/mnt/log/hadoop/hadoop/userlogs', help='Directory where logs of completed jobs are located.'), cfg.StrOpt('HADOOP_LOG_DIRECTORY_ON_VOLUME', default='/volumes/disk1/log/hadoop/hadoop/userlogs', help='Directory where logs of completed jobs on volume mounted ' 'to node are located.'), cfg.DictOpt('HADOOP_PROCESSES_WITH_PORTS', default={ 'jobtracker': 50030, 'namenode': 50070, 'tasktracker': 50060, 'datanode': 50075, 'secondarynamenode': 50090, 'oozie': 11000 }, help='Hadoop process map with ports for Vanilla plugin.'), cfg.DictOpt('PROCESS_NAMES', default={ 'nn': 'namenode', 'tt': 'tasktracker', 'dn': 'datanode' }, help='Names for namenode, tasktracker and datanode ' 'processes.'), cfg.BoolOpt('SKIP_ALL_TESTS_FOR_PLUGIN', default=True, help='If this flag is True, then all tests for Vanilla plugin '
cfg.IntOpt('trove_security_group_rule_port', default=3306), cfg.StrOpt('trove_security_group_rule_cidr', default='0.0.0.0/0'), cfg.IntOpt('trove_api_workers', default=None), cfg.IntOpt('usage_sleep_time', default=1, help='Time to sleep during the check active guest'), cfg.IntOpt('usage_timeout', default=300, help='Timeout to wait for an guest to become active'), cfg.StrOpt('region', default='LOCAL_DEV', help='The region this service is located.'), cfg.StrOpt('backup_runner', default='trove.guestagent.backup.backup_types.InnoBackupEx'), cfg.DictOpt('backup_runner_options', default={}, help='Additional options to be passed to the backup runner'), cfg.StrOpt('backup_strategy', default='InnoBackupEx', help='Default strategy to perform backups'), cfg.StrOpt('backup_namespace', default='trove.guestagent.strategies.backup.mysql_impl', help='Namespace to load backup strategies from'), cfg.StrOpt('restore_namespace', default='trove.guestagent.strategies.restore.mysql_impl', help='Namespace to load restore strategies from'), cfg.BoolOpt('verify_swift_checksum_on_restore', default=True, help='Enable verification of swift checksum before starting ' ' restore; makes sure the checksum of original backup matches ' ' checksum of the swift backup file.'),
help='compute gateway user name'), cfg.StrOpt('cgw_certificate', help='full name of compute gateway public key'), cfg.StrOpt('rabbit_host_ip_public', help=''), cfg.StrOpt('rabbit_password_public', help=''), cfg.StrOpt('vpn_route_gateway', help=''), cfg.DictOpt('flavor_map', default={'m1.tiny': 't2.micro', 'm1.small': 't2.micro', 'm1.medium': 't2.micro3', 'm1.large': 't2.micro', 'm1.xlarge': 't2.micro'}, help='map nova flavor name to aws ec2 instance specification id') ] LOG = logging.getLogger(__name__) CONF = cfg.CONF CONF.register_opts(hybrid_cloud_opts) CONF.register_opts(ec2_opts, 'provider_opts') CHUNK_SIZE = 1024*4 # EC2 = get_driver(CONF.ec2.driver_type)
), cfg.StrOpt( 'environment_prefix', default='', help=_('The object name prefix for this environment'), ), cfg.BoolOpt( 'environment_specific_plugin', default=False, help=_('Use environment specific plugin topic') ), cfg.IntOpt( 'environment_group_number', default=1, help=_('Agent group number for it environment') ), cfg.DictOpt( 'capacity_policy', default={}, help=_('Metrics to measure capacity and their limits.') ) ] class LogicalServiceCache(object): """Manage a cache of known services.""" class Service(object): """Inner classes used to hold values for weakref lookups.""" def __init__(self, port_id, pool_id, tenant_id, agent_host): self.port_id = port_id self.pool_id = pool_id self.tenant_id = tenant_id self.agent_host = agent_host
cfg.IntOpt('confirm_volume_delete_retry_interval', default=10, help=('Sleep value is in seconds.')), cfg.IntOpt('confirm_volume_delete_sleep_counter', default=5, help=('Will confirm a successful volume ' 'deletion by making this many attempts.')), ] cloudbyte_add_qosgroup_opts = [ cfg.DictOpt('add_qosgroup', default={ 'iops': '10', 'latency': '15', 'graceallowed': 'false', 'networkspeed': '0', 'memlimit': '0', 'tpcontrol': 'false', 'throughput': '0', 'iopscontrol': 'true' }, help=('These values will be used by addQos api.')), ] cloudbyte_create_volume_opts = [ cfg.DictOpt('create_volume', default={ 'blocklength': '512B', 'compression': 'off', 'deduplication': 'off', 'sync': 'always', 'recordsize': '128k',
help=""" If this variable is True then tests for vanilla will be skipped """), cfg.BoolOpt('skip_edp_test', default=True), cfg.StrOpt('plugin_name', default='Vanilla Apache Hadoop', help="plugin title, default: Vanilla Apache Hadoop"), cfg.StrOpt('plugin_overview_name', default='vanilla', help="plugin name in overview"), cfg.StrOpt('hadoop_version', default='1.2.1', help="hadoop version for plugin"), cfg.DictOpt('processes', default={"NN": 0, "DN": 1, "SNN": 2, "OZ": 3, "TT": 4, "JT": 5}, help='numbers of processes for vanilla in saharadashboard'), cfg.StrOpt('base_image', default='ubuntu_sahara_latest', help="image name for start vanilla cluster") ] hdp_group = cfg.OptGroup(name='hdp', title="hdp configs") HdpGroup = [ cfg.BoolOpt('skip_plugin_tests', default=False, help=""" If this variable is True then tests for hdp will be skipped """),
'host.'), cfg.StrOpt('vcloud_conversion_dir', default='/vcloud/convert_tmp', help='the directory where images are converted in '), cfg.StrOpt('vcloud_volumes_dir', default='/vcloud/volumes', help='the directory of volume files'), cfg.StrOpt('vcloud_vm_naming_rule', default='openstack_vm_id', help='the rule to name vcloud VMs, valid options:' 'openstack_vm_id, openstack_vm_name, cascaded_openstack_rule'), cfg.DictOpt('vcloud_flavor_map', default={ 'm1.tiny': '1', 'm1.small': '2', 'm1.medium': '3', 'm1.large': '4', 'm1.xlarge': '5' }, help='map nova flavor name to vcloud vm specification id'), cfg.StrOpt('metadata_iso_catalog', default='metadata-isos', help='The metadata iso cotalog.'), cfg.StrOpt( 'provider_base_network_name', help='The provider network name which base provider network use.'), cfg.StrOpt( 'provider_tunnel_network_name', help='The provider network name which tunnel provider network use.'), cfg.StrOpt('image_user', default='', help=''), cfg.StrOpt('image_password', default='', help=''),
def setUp(self): super(PoolManagerServiceNoopTest, self).setUp() self.config(threshold_percentage=100, enable_recovery_timer=False, enable_sync_timer=False, cache_driver='noop', group='service:pool_manager') # TODO(kiall): Rework all this pool config etc into a fixture.. # Configure the Pool ID self.config(pool_id='794ccc2c-d751-44fe-b57f-8894c9f5c842', group='service:pool_manager') # Configure the Pool section_name = 'pool:794ccc2c-d751-44fe-b57f-8894c9f5c842' section_opts = [ cfg.ListOpt('targets', default=[ 'f278782a-07dc-4502-9177-b5d85c5f7c7e', 'a38703f2-b71e-4e5b-ab22-30caaed61dfd', ]), cfg.ListOpt('nameservers', default=[ 'c5d64303-4cba-425a-9f3c-5d708584dde4', 'c67cdc95-9a9e-4d2a-98ed-dc78cbd85234', ]), cfg.ListOpt('also_notifies', default=[]), ] cfg.CONF.register_group(cfg.OptGroup(name=section_name)) cfg.CONF.register_opts(section_opts, group=section_name) # Configure the Pool Targets section_name = 'pool_target:f278782a-07dc-4502-9177-b5d85c5f7c7e' section_opts = [ cfg.StrOpt('type', default='fake'), cfg.ListOpt('masters', default=['127.0.0.1:5354']), cfg.DictOpt('options', default={}) ] cfg.CONF.register_group(cfg.OptGroup(name=section_name)) cfg.CONF.register_opts(section_opts, group=section_name) section_name = 'pool_target:a38703f2-b71e-4e5b-ab22-30caaed61dfd' section_opts = [ cfg.StrOpt('type', default='fake'), cfg.ListOpt('masters', default=['127.0.0.1:5354']), cfg.DictOpt('options', default={}) ] cfg.CONF.register_group(cfg.OptGroup(name=section_name)) cfg.CONF.register_opts(section_opts, group=section_name) # Configure the Pool Nameservers section_name = 'pool_nameserver:c5d64303-4cba-425a-9f3c-5d708584dde4' section_opts = [ cfg.StrOpt('host', default='127.0.0.1'), cfg.StrOpt('port', default=5355), ] cfg.CONF.register_group(cfg.OptGroup(name=section_name)) cfg.CONF.register_opts(section_opts, group=section_name) section_name = 'pool_nameserver:c67cdc95-9a9e-4d2a-98ed-dc78cbd85234' section_opts = [ cfg.StrOpt('host', default='127.0.0.1'), cfg.StrOpt('port', default=5356), ] cfg.CONF.register_group(cfg.OptGroup(name=section_name)) cfg.CONF.register_opts(section_opts, group=section_name) # Start the Service self.service = self.start_service('pool_manager') self.cache = self.service.cache
help='Directory where Hadoop jar files are located.'), cfg.StrOpt('HADOOP_EXAMPLES_JAR_PATH', default='/usr/share/hadoop/hadoop-examples-1.2.1.jar', help='Path to hadoop examples jar file.'), cfg.StrOpt('HADOOP_LOG_DIRECTORY', default='/mnt/log/hadoop/hadoop/userlogs', help='Directory where logs of completed jobs are located.'), cfg.StrOpt('HADOOP_LOG_DIRECTORY_ON_VOLUME', default='/volumes/disk1/log/hadoop/hadoop/userlogs', help='Directory where logs of completed jobs on volume mounted ' 'to node are located.'), cfg.DictOpt('HADOOP_PROCESSES_WITH_PORTS', default={ 'jobtracker': 50030, 'namenode': 50070, 'tasktracker': 50060, 'datanode': 50075, 'secondarynamenode': 50090, 'oozie': 11000 }, help='Hadoop process map with ports for Vanilla plugin.'), cfg.DictOpt('PROCESS_NAMES', default={ 'nn': 'namenode', 'tt': 'tasktracker', 'dn': 'datanode' }, help='Names for namenode, tasktracker and datanode ' 'processes.'), cfg.BoolOpt('SKIP_ALL_TESTS_FOR_PLUGIN', default=False, help='If this flag is True, then all tests for Vanilla plugin '
# under the License. """ This module contains definitions for a handful of helper functions which aid in instance translations. """ from oslo.config import cfg # Get the config instance and add options: CONF = cfg.CONF CONF.register_opts({ cfg.DictOpt( "ec2_vm_type_to_size_map", default={ "m1.tiny": "Basic_A0", "m1.small": "Basic_A1", "m1.medium": "Basic_A2", "m1.large": "Basic_A3", "m1.xlarge": "basic_A4", }, help="A mapping between EC2 VM types and Azure machine sizes."), cfg.DictOpt( "ec2_vm_image_map", default={ "U10-x86_64-cfntools": "Canonical;UbuntuServer;12.04.5-LTS", "F17-x86_64-cfntools": "Canonical;UbuntuServer;12.04.5-LTS" }, help="A map between EC2 image names and Azure ones.", ) })
from neutron.extensions import portbindings from neutron.extensions import securitygroup from neutron import neutron_plugin_base_v2 from neutron.openstack.common import importutils from neutron.openstack.common import jsonutils as json from neutron.openstack.common import log as logging from simplejson import JSONDecodeError LOG = logging.getLogger(__name__) vnc_opts = [ cfg.StrOpt('api_server_ip', default='127.0.0.1', help='IP address to connect to VNC controller'), cfg.StrOpt('api_server_port', default='8082', help='Port to connect to VNC controller'), cfg.DictOpt('contrail_extensions', default={}, help='Enable Contrail extensions(policy, ipam)'), ] # ContrailError message have translated already. # so there is no need to use i18n here. class ContrailNotFoundError(exc.NotFound): message = '%(msg)s' class ContrailConflictError(exc.Conflict): message = '%(msg)s' class ContrailBadRequestError(exc.BadRequest): message = '%(msg)s'
CONF = cfg.CONF global_opts = [ cfg.StrOpt('file_hosts', default='/etc/hosts'), cfg.StrOpt('file_hostname', default='/etc/hostname'), cfg.StrOpt('self_config_file', default=os.path.sep.join([ os.path.split(os.path.realpath(__file__))[0], FileName.PATCHES_TOOL_CONFIG_FILE ])), ] CONF.register_opts(global_opts) default_group = cfg.OptGroup(name='DEFAULT', title='default config') default_opts = [ cfg.DictOpt('proxy_match_host', default=None), cfg.DictOpt('proxy_match_region', default=None), cfg.StrOpt('current_node', default='proxy001'), cfg.DictOpt('cascaded_add_route', default=None), cfg.DictOpt('cascaded_add_table_external_api', default=None), cfg.StrOpt('cascading_region', default='cascading.hybrid.huawei.com'), cfg.StrOpt('openstack_bak_path', default='/home/openstack_bak') ] CONF.register_group(default_group) CONF.register_opts(default_opts, default_group) env_group = cfg.OptGroup(name='ENV', title='environment for openstack') env_opts = [ cfg.StrOpt( 'OS_AUTH_URL',
default=True, help="Require user hostnames to be IPv4 addresses."), cfg.BoolOpt('trove_security_groups_support', default=True), cfg.StrOpt('trove_security_group_name_prefix', default='SecGroup'), cfg.StrOpt('trove_security_group_rule_cidr', default='0.0.0.0/0'), cfg.IntOpt('trove_api_workers', default=None), cfg.IntOpt('usage_sleep_time', default=5, help='Time to sleep during the check active guest.'), cfg.StrOpt('region', default='LOCAL_DEV', help='The region this service is located.'), cfg.StrOpt('backup_runner', default='trove.guestagent.backup.backup_types.InnoBackupEx'), cfg.DictOpt('backup_runner_options', default={}, help='Additional options to be passed to the backup runner.'), cfg.StrOpt('backup_strategy', default='InnoBackupEx', help='Default strategy to perform backups.'), cfg.StrOpt('backup_namespace', default='trove.guestagent.strategies.backup.mysql_impl', help='Namespace to load backup strategies from.'), cfg.StrOpt('restore_namespace', default='trove.guestagent.strategies.restore.mysql_impl', help='Namespace to load restore strategies from.'), cfg.DictOpt('backup_incremental_strategy', default={'InnoBackupEx': 'InnoBackupExIncremental'}, help='Incremental Backup Runner based on the default' ' strategy. For strategies that do not implement an' ' incremental, the runner will use the default full backup.'),
default=500, help='The Max size of one BGP message file, the unit is MB'), ] CONF.register_opts(msg_process_opts, group='message') bgp_config_opts = [ cfg.IntOpt('peer_start_interval', default=10, help='The interval to start each BGP peer'), cfg.ListOpt( 'afi_safi', default=['ipv4'], help='The Global config for address family and sub address family'), cfg.DictOpt('running_config', default={}, help='The running configuration for BGP'), cfg.StrOpt('config_file', help='BGP peers configuration file') ] CONF.register_opts(bgp_config_opts, group='bgp') bgp_peer_conf_cli_opts = [ cfg.IntOpt('remote_as', help='The remote BGP peer AS number'), cfg.IntOpt('local_as', help='The Local BGP AS number'), cfg.StrOpt('remote_addr', help='The remote address of the peer'), cfg.StrOpt('local_addr', help='The local address of the BGP'), cfg.StrOpt('md5', help='The MD5 string use to auth') ] CONF.register_cli_opts(bgp_peer_conf_cli_opts, group='bgp')