• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python config.register_root_helper函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中quantum.agent.common.config.register_root_helper函数的典型用法代码示例。如果您正苦于以下问题:Python register_root_helper函数的具体用法?Python register_root_helper怎么用?Python register_root_helper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了register_root_helper函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setup_conf

def setup_conf():
    """Setup the cfg for the clean up utility.

    Use separate setup_conf for the utility because there are many options
    from the main config that do not apply during clean-up.
    """

    cli_opts = [
        cfg.BoolOpt('force',
                    default=False,
                    help=_('Delete the namespace by removing all devices.')),
    ]

    opts = [
        cfg.StrOpt('dhcp_driver',
                   default='quantum.agent.linux.dhcp.Dnsmasq',
                   help=_("The driver used to manage the DHCP server.")),
    ]

    conf = cfg.CONF
    conf.register_cli_opts(cli_opts)
    conf.register_opts(opts)
    agent_config.register_root_helper(conf)
    conf.register_opts(dhcp.OPTS)
    return conf
开发者ID:wallnerryan,项目名称:quantum_migrate,代码行数:25,代码来源:netns_cleanup_util.py


示例2: setUp

    def setUp(self):
        super(TestDhcpAgentEventHandler, self).setUp()
        cfg.CONF.register_opts(dhcp_agent.DeviceManager.OPTS)
        cfg.CONF.register_opts(dhcp_agent.DhcpLeaseRelay.OPTS)
        cfg.CONF.set_override('interface_driver',
                              'quantum.agent.linux.interface.NullDriver')
        config.register_root_helper(cfg.CONF)
        cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)

        self.plugin_p = mock.patch('quantum.agent.dhcp_agent.DhcpPluginApi')
        plugin_cls = self.plugin_p.start()
        self.plugin = mock.Mock()
        plugin_cls.return_value = self.plugin

        self.cache_p = mock.patch('quantum.agent.dhcp_agent.NetworkCache')
        cache_cls = self.cache_p.start()
        self.cache = mock.Mock()
        cache_cls.return_value = self.cache

        self.dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
        self.call_driver_p = mock.patch.object(self.dhcp, 'call_driver')

        self.call_driver = self.call_driver_p.start()
        self.external_process_p = mock.patch(
            'quantum.agent.linux.external_process.ProcessManager'
        )
        self.external_process = self.external_process_p.start()
开发者ID:ericwanghp,项目名称:quantum,代码行数:27,代码来源:test_dhcp_agent.py


示例3: setup_conf

def setup_conf():
    """Setup the cfg for the clean up utility.

    Use separate setup_conf for the utility because there are many options
    from the main config that do not apply during clean-up.
    """

    opts = [
        cfg.StrOpt('dhcp_driver',
                   default='quantum.agent.linux.dhcp.Dnsmasq',
                   help=_("The driver used to manage the DHCP server.")),
        cfg.StrOpt('state_path',
                   default='.',
                   help=_('Top-level directory for maintaining dhcp state')),
        cfg.BoolOpt('force',
                    default=False,
                    help=_('Delete the namespace by removing all devices.')),
    ]

    conf = cfg.ConfigOpts()
    conf.register_opts(opts)
    agent_config.register_root_helper(conf)
    conf.register_opts(dhcp.OPTS)
    config.setup_logging(conf)
    return conf
开发者ID:bbrahmbhatt,项目名称:quantum,代码行数:25,代码来源:netns_cleanup_util.py


示例4: setUp

    def setUp(self):
        cfg.CONF.register_opts(dhcp_agent.DeviceManager.OPTS)
        cfg.CONF.set_override('interface_driver',
                              'quantum.agent.linux.interface.NullDriver')
        config.register_root_helper(cfg.CONF)
        cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)
        self.notification_p = mock.patch(
            'quantum.agent.rpc.NotificationDispatcher')
        self.notification = self.notification_p.start()

        self.plugin_p = mock.patch('quantum.agent.dhcp_agent.DhcpPluginApi')
        plugin_cls = self.plugin_p.start()
        self.plugin = mock.Mock()
        plugin_cls.return_value = self.plugin

        self.cache_p = mock.patch('quantum.agent.dhcp_agent.NetworkCache')
        cache_cls = self.cache_p.start()
        self.cache = mock.Mock()
        cache_cls.return_value = self.cache

        self.dhcp = dhcp_agent.DhcpAgent(cfg.CONF)
        self.call_driver_p = mock.patch.object(self.dhcp, 'call_driver')

        self.call_driver = self.call_driver_p.start()
        self.external_process_p = mock.patch(
            'quantum.agent.linux.external_process.ProcessManager'
        )
        self.external_process = self.external_process_p.start()
开发者ID:koenning,项目名称:neutron,代码行数:28,代码来源:test_dhcp_agent.py


示例5: register_options

def register_options():
    cfg.CONF.register_opts(DhcpAgent.OPTS)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)
    cfg.CONF.register_opts(DeviceManager.OPTS)
    cfg.CONF.register_opts(DhcpLeaseRelay.OPTS)
    cfg.CONF.register_opts(dhcp.OPTS)
    cfg.CONF.register_opts(interface.OPTS)
开发者ID:CiscoAS,项目名称:quantum,代码行数:8,代码来源:dhcp_agent.py


示例6: main

def main():
    eventlet.monkey_patch()
    conf = cfg.CONF
    conf.register_opts(L3NATAgent.OPTS)
    config.register_root_helper(conf)
    conf.register_opts(interface.OPTS)
    conf.register_opts(external_process.OPTS)
    conf()
    config.setup_logging(conf)
    server = quantum_service.Service.create(binary='quantum-l3-agent',
                                            topic=topics.L3_AGENT)
    service.launch(server).wait()
开发者ID:bbrahmbhatt,项目名称:quantum,代码行数:12,代码来源:l3_agent.py


示例7: main

def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(DhcpAgent.OPTS)
    config.register_root_helper(cfg.CONF)
    cfg.CONF.register_opts(DeviceManager.OPTS)
    cfg.CONF.register_opts(DhcpLeaseRelay.OPTS)
    cfg.CONF.register_opts(dhcp.OPTS)
    cfg.CONF.register_opts(interface.OPTS)
    cfg.CONF(project="quantum")
    config.setup_logging(cfg.CONF)

    mgr = DhcpAgent(cfg.CONF)
    mgr.run()
开发者ID:bbrahmbhatt,项目名称:quantum,代码行数:13,代码来源:dhcp_agent.py


示例8: setUp

 def setUp(self):
     root_helper_opt = [
         cfg.StrOpt('root_helper', default='sudo'),
     ]
     self.conf = config.setup_conf()
     self.conf.register_opts(interface.OPTS)
     config.register_root_helper(self.conf)
     self.ip_dev_p = mock.patch.object(ip_lib, 'IPDevice')
     self.ip_dev = self.ip_dev_p.start()
     self.ip_p = mock.patch.object(ip_lib, 'IPWrapper')
     self.ip = self.ip_p.start()
     self.device_exists_p = mock.patch.object(ip_lib, 'device_exists')
     self.device_exists = self.device_exists_p.start()
开发者ID:bbrahmbhatt,项目名称:quantum,代码行数:13,代码来源:test_linux_interface.py


示例9: initialize_app

 def initialize_app(self, argv):
     super(QuantumDebugShell, self).initialize_app(argv)
     if not self.options.config_file:
         raise exc.CommandError(
             _("You must provide a config file for bridge -"
               " either --config-file or env[QUANTUM_TEST_CONFIG_FILE]"))
     client = self.client_manager.quantum
     cfg.CONF.register_opts(interface.OPTS)
     cfg.CONF.register_opts(QuantumDebugAgent.OPTS)
     config.register_root_helper(cfg.CONF)
     cfg.CONF(['--config-file', self.options.config_file])
     config.setup_logging(cfg.CONF)
     driver = importutils.import_object(cfg.CONF.interface_driver, cfg.CONF)
     self.debug_agent = QuantumDebugAgent(cfg.CONF, client, driver)
开发者ID:AmirolAhmad,项目名称:quantum,代码行数:14,代码来源:shell.py


示例10: main

def main():
    eventlet.monkey_patch()

    conf = cfg.CONF
    config.register_root_helper(conf)
    conf.register_opts(ServiceAgent.OPTS)
    conf()
    config.setup_logging(conf)

    manager = 'quantum.agent.services.service_agent.ServiceAgent'
    server = quantum_service.Service.create(binary='quantum-svc-agent',
                                            topic=topics.SVC_AGENT,
                                            manager=manager)
    service.launch(server).wait()
开发者ID:kumarcv,项目名称:openstack-nf,代码行数:14,代码来源:service_agent.py


示例11: setUp

 def setUp(self):
     super(TestBase, self).setUp()
     self.conf = config.setup_conf()
     self.conf.register_opts(interface.OPTS)
     config.register_root_helper(self.conf)
     self.ip_dev_p = mock.patch.object(ip_lib, "IPDevice")
     self.ip_dev = self.ip_dev_p.start()
     self.addCleanup(self.ip_dev_p.stop)
     self.ip_p = mock.patch.object(ip_lib, "IPWrapper")
     self.ip = self.ip_p.start()
     self.addCleanup(self.ip_p.stop)
     self.device_exists_p = mock.patch.object(ip_lib, "device_exists")
     self.device_exists = self.device_exists_p.start()
     self.addCleanup(self.device_exists_p.stop)
开发者ID:CiscoAS,项目名称:quantum,代码行数:14,代码来源:test_linux_interface.py


示例12: main

def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(DhcpAgent.OPTS)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)
    cfg.CONF.register_opts(DeviceManager.OPTS)
    cfg.CONF.register_opts(DhcpLeaseRelay.OPTS)
    cfg.CONF.register_opts(dhcp.OPTS)
    cfg.CONF.register_opts(interface.OPTS)
    cfg.CONF(project='quantum')
    config.setup_logging(cfg.CONF)
    server = quantum_service.Service.create(
        binary='quantum-dhcp-agent',
        topic=topics.DHCP_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval)
    service.launch(server).wait()
开发者ID:Frostman,项目名称:quantum,代码行数:16,代码来源:dhcp_agent.py


示例13: main

def main():
    eventlet.monkey_patch()
    conf = cfg.CONF
    conf.register_opts(L3NATAgent.OPTS)
    config.register_agent_state_opts_helper(conf)
    config.register_root_helper(conf)
    conf.register_opts(interface.OPTS)
    conf.register_opts(external_process.OPTS)
    conf(project='quantum')
    config.setup_logging(conf)
    server = quantum_service.Service.create(
        binary='quantum-l3-agent',
        topic=topics.L3_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='quantum.agent.l3_agent.L3NATAgentWithStateReport')
    service.launch(server).wait()
开发者ID:liqin75,项目名称:vse-vpnaas-plugin,代码行数:16,代码来源:l3_agent.py


示例14: main

def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    # import interface options just in case the driver uses namespaces
    cfg.CONF.register_opts(interface.OPTS)
    config.register_root_helper(cfg.CONF)

    cfg.CONF(project='quantum')
    config.setup_logging(cfg.CONF)

    mgr = manager.LbaasAgentManager(cfg.CONF)
    svc = LbaasAgentService(
        host=cfg.CONF.host,
        topic=topics.LOADBALANCER_AGENT,
        manager=mgr
    )
    service.launch(svc).wait()
开发者ID:AmirolAhmad,项目名称:quantum,代码行数:18,代码来源:__init__.py


示例15: setup_conf

def setup_conf():
    """Setup the cfg for the clean up utility.

    Use separate setup_conf for the utility because there are many options
    from the main config that do not apply during clean-up.
    """
    opts = [
        cfg.BoolOpt('ovs_all_ports',
                    default=False,
                    help=_('True to delete all ports on all the OpenvSwitch '
                           'bridges. False to delete ports created by '
                           'Quantum on integration and external network '
                           'bridges.'))
    ]

    conf = cfg.CONF
    conf.register_cli_opts(opts)
    conf.register_opts(l3_agent.L3NATAgent.OPTS)
    conf.register_opts(interface.OPTS)
    agent_config.register_root_helper(conf)
    return conf
开发者ID:wdec,项目名称:quantum,代码行数:21,代码来源:ovs_cleanup_util.py


示例16: setUp

    def setUp(self):
        super(TestBasicRouterOperations, self).setUp()
        self.conf = cfg.ConfigOpts()
        self.conf.register_opts(base_config.core_opts)
        self.conf.register_opts(l3_agent.L3NATAgent.OPTS)
        agent_config.register_root_helper(self.conf)
        self.conf.register_opts(interface.OPTS)
        self.conf.set_override('interface_driver',
                               'quantum.agent.linux.interface.NullDriver')
        self.conf.root_helper = 'sudo'

        self.device_exists_p = mock.patch(
            'quantum.agent.linux.ip_lib.device_exists')
        self.device_exists = self.device_exists_p.start()

        self.utils_exec_p = mock.patch(
            'quantum.agent.linux.utils.execute')
        self.utils_exec = self.utils_exec_p.start()

        self.external_process_p = mock.patch(
            'quantum.agent.linux.external_process.ProcessManager')
        self.external_process = self.external_process_p.start()

        self.dvr_cls_p = mock.patch('quantum.agent.linux.interface.NullDriver')
        driver_cls = self.dvr_cls_p.start()
        self.mock_driver = mock.MagicMock()
        self.mock_driver.DEV_NAME_LEN = (
            interface.LinuxInterfaceDriver.DEV_NAME_LEN)
        driver_cls.return_value = self.mock_driver

        self.ip_cls_p = mock.patch('quantum.agent.linux.ip_lib.IPWrapper')
        ip_cls = self.ip_cls_p.start()
        self.mock_ip = mock.MagicMock()
        ip_cls.return_value = self.mock_ip

        self.l3pluginApi_cls_p = mock.patch(
            'quantum.agent.l3_agent.L3PluginApi')
        l3pluginApi_cls = self.l3pluginApi_cls_p.start()
        self.plugin_api = mock.Mock()
        l3pluginApi_cls.return_value = self.plugin_api
开发者ID:Apsu,项目名称:quantum,代码行数:40,代码来源:test_l3_agent.py


示例17: test_dhcp_agent_manager

 def test_dhcp_agent_manager(self):
     state_rpc_str = 'quantum.agent.rpc.PluginReportStateAPI'
     lease_relay_str = 'quantum.agent.dhcp_agent.DhcpLeaseRelay'
     with mock.patch.object(DhcpAgentWithStateReport,
                            'sync_state',
                            autospec=True) as mock_sync_state:
         with mock.patch.object(DhcpAgentWithStateReport,
                                'periodic_resync',
                                autospec=True) as mock_periodic_resync:
             with mock.patch(state_rpc_str) as state_rpc:
                 with mock.patch(lease_relay_str) as mock_lease_relay:
                     with mock.patch.object(sys, 'argv') as sys_argv:
                         sys_argv.return_value = [
                             'dhcp', '--config-file',
                             etcdir('quantum.conf.test')]
                         cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)
                         config.register_agent_state_opts_helper(cfg.CONF)
                         config.register_root_helper(cfg.CONF)
                         cfg.CONF.register_opts(
                             dhcp_agent.DeviceManager.OPTS)
                         cfg.CONF.register_opts(
                             dhcp_agent.DhcpLeaseRelay.OPTS)
                         cfg.CONF.register_opts(dhcp.OPTS)
                         cfg.CONF.register_opts(interface.OPTS)
                         cfg.CONF(project='quantum')
                         agent_mgr = DhcpAgentWithStateReport('testhost')
                         eventlet.greenthread.sleep(1)
                         agent_mgr.after_start()
                         mock_sync_state.assert_called_once_with(agent_mgr)
                         mock_periodic_resync.assert_called_once_with(
                             agent_mgr)
                         state_rpc.assert_has_calls(
                             [mock.call(mock.ANY),
                              mock.call().report_state(mock.ANY, mock.ANY)])
                         mock_lease_relay.assert_has_calls(
                             [mock.call(mock.ANY),
                              mock.call().start()])
开发者ID:ericwanghp,项目名称:quantum,代码行数:37,代码来源:test_dhcp_agent.py


示例18: setUp

    def setUp(self):
        cfg.CONF.register_opts(interface.OPTS)
        cfg.CONF.register_opts(QuantumDebugAgent.OPTS)
        cfg.CONF(args=[], project='quantum')
        cfg.CONF.set_override('use_namespaces', True)
        config.register_root_helper(cfg.CONF)

        self.addCleanup(mock.patch.stopall)
        device_exists_p = mock.patch(
            'quantum.agent.linux.ip_lib.device_exists', return_value=False)
        device_exists_p.start()
        namespace_p = mock.patch(
            'quantum.agent.linux.ip_lib.IpNetnsCommand')
        namespace_p.start()
        ensure_namespace_p = mock.patch(
            'quantum.agent.linux.ip_lib.IPWrapper.ensure_namespace')
        ensure_namespace_p.start()
        dvr_cls_p = mock.patch('quantum.agent.linux.interface.NullDriver')
        driver_cls = dvr_cls_p.start()
        mock_driver = mock.MagicMock()
        mock_driver.DEV_NAME_LEN = (
            interface.LinuxInterfaceDriver.DEV_NAME_LEN)
        mock_driver.get_device_name.return_value = 'tap12345678-12'
        driver_cls.return_value = mock_driver
        self.driver = mock_driver

        client_cls_p = mock.patch('quantumclient.v2_0.client.Client')
        client_cls = client_cls_p.start()
        client_inst = mock.Mock()
        client_cls.return_value = client_inst

        fake_network = {'network': {'id': 'fake_net',
                                    'tenant_id': 'fake_tenant',
                                    'subnets': ['fake_subnet']}}
        fake_port = {'port':
                    {'id': 'fake_port',
                     'device_owner': 'fake_device',
                     'mac_address': 'aa:bb:cc:dd:ee:ffa',
                     'network_id': 'fake_net',
                     'fixed_ips':
                     [{'subnet_id': 'fake_subnet', 'ip_address': '10.0.0.3'}]
                     }}
        fake_ports = {'ports': [fake_port['port']]}
        self.fake_ports = fake_ports
        allocation_pools = [{'start': '10.0.0.2',
                             'end': '10.0.0.254'}]
        fake_subnet_v4 = {'subnet': {'name': 'fake_subnet_v4',
                          'id': 'fake_subnet',
                          'network_id': 'fake_net',
                          'gateway_ip': '10.0.0.1',
                          'dns_nameservers': ['10.0.0.2'],
                          'host_routes': [],
                          'cidr': '10.0.0.0/24',
                          'allocation_pools': allocation_pools,
                          'enable_dhcp': True,
                          'ip_version': 4}}

        client_inst.list_ports.return_value = fake_ports
        client_inst.create_port.return_value = fake_port
        client_inst.show_port.return_value = fake_port
        client_inst.show_network.return_value = fake_network
        client_inst.show_subnet.return_value = fake_subnet_v4
        self.client = client_inst
        mock_std = mock.Mock()
        self.app = MyApp(mock_std)
        self.app.debug_agent = QuantumDebugAgent(cfg.CONF,
                                                 client_inst,
                                                 mock_driver)
开发者ID:StackOps,项目名称:quantum,代码行数:68,代码来源:test_debug_commands.py


示例19: test_root_default

 def test_root_default(self):
     conf = config.setup_conf()
     config.register_root_helper(conf)
     self.assertEqual(config.get_root_helper(conf), 'sudo')
开发者ID:Frostman,项目名称:quantum,代码行数:4,代码来源:test_agent_config.py


示例20:

    cfg.StrOpt('integration_bridge', default='br-int',
               help=_("Integration bridge to use")),
    cfg.StrOpt('openflow_rest_api', default='127.0.0.1:8080',
               help=_("OpenFlow REST API location")),
    cfg.IntOpt('tunnel_key_min', default=1,
               help=_("Minimum tunnel ID to use")),
    cfg.IntOpt('tunnel_key_max', default=0xffffff,
               help=_("Maximum tunnel ID to use")),
    cfg.StrOpt('tunnel_ip', default=None,
               help=_("Tunnel IP to use")),
    cfg.StrOpt('tunnel_interface', default=None,
               help=_("Tunnel interface to use")),
    cfg.IntOpt('ovsdb_port', default=6634,
               help=_("OVSDB port to connect to")),
    cfg.StrOpt('ovsdb_ip', default=None,
               help=_("OVSDB IP to connect to")),
    cfg.StrOpt('ovsdb_interface', default=None,
               help=_("OVSDB interface to connect to")),
]

agent_opts = [
    cfg.IntOpt('polling_interval', default=2,
               help=_("The number of seconds the agent will wait between "
                      "polling for local device changes.")),
]


cfg.CONF.register_opts(ovs_opts, "ovs")
cfg.CONF.register_opts(agent_opts, "AGENT")
config.register_root_helper(cfg.CONF)
开发者ID:DrLeonard,项目名称:quantum,代码行数:30,代码来源:config.py



注:本文中的quantum.agent.common.config.register_root_helper函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python config.setup_conf函数代码示例发布时间:2022-05-26
下一篇:
Python config.get_root_helper函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap