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

Python config.register_root_helper函数代码示例

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

本文整理汇总了Python中neutron.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

    def setUp(self):
        super(TestMeteringOperations, self).setUp()
        cfg.CONF.register_opts(metering_agent.MeteringAgent.Opts)
        config.register_root_helper(cfg.CONF)

        self.noop_driver = "neutron.services.metering.drivers.noop." "noop_driver.NoopMeteringDriver"
        cfg.CONF.set_override("driver", self.noop_driver)
        cfg.CONF.set_override("measure_interval", 0)
        cfg.CONF.set_override("report_interval", 0)

        notifier_api._drivers = None
        cfg.CONF.set_override("notification_driver", [test_notifier.__name__])

        metering_rpc = "neutron.services.metering.agents.metering_agent." "MeteringPluginRpc._get_sync_data_metering"
        self.metering_rpc_patch = mock.patch(metering_rpc, return_value=[])
        self.metering_rpc_patch.start()

        self.driver_patch = mock.patch(self.noop_driver, autospec=True)
        self.driver_patch.start()

        loopingcall_patch = mock.patch("neutron.openstack.common.loopingcall.FixedIntervalLoopingCall")
        loopingcall_patch.start()

        self.agent = metering_agent.MeteringAgent("my agent", cfg.CONF)
        self.driver = self.agent.metering_driver

        self.addCleanup(mock.patch.stopall)
开发者ID:netscaler,项目名称:neutron,代码行数:27,代码来源:test_metering_agent.py


示例2: 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(dhcp.OPTS)
    cfg.CONF.register_opts(interface.OPTS)
开发者ID:abhirajbutala,项目名称:neutron,代码行数:7,代码来源:dhcp_agent.py


示例3: _load_device_plugins

    def _load_device_plugins(self):
        # Load OVS plug-in, if configured, and use its database parameters
        if len(self.ovs_plugin) != 0:
            # if ovs plug-in is configured, use ovs plug-in's database parameters
            self.ovs_plugin_obj = importutils.import_object(self.ovs_plugin)
            self.omni_db_obj = importutils.import_object(omni_const.OMNI_DB_CLASS)
            self.omni_db_obj.initialize(None, None, None, omni_const.OVS_TABLES)

        else:
            # if ovs plug-in is not configured, use omni plug-in's database parameters
            self.omni_db_obj = importutils.import_object(omni_const.OMNI_DB_CLASS)
            self.omni_db_obj.initialize(None, None, None, omni_const.OMNI_TABLES)
            self._parse_network_vlan_ranges()
            self.omni_db_obj.sync_vlan_allocations(self.network_vlan_ranges)

            config.register_agent_state_opts_helper(cfg.CONF)
            config.register_root_helper(cfg.CONF)
            #cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS) # for havana

        # Load Omni device plug-in
        if len(self.omni_plugin) != 0:
            self.omni_plugin_obj = importutils.import_object(self.omni_plugin)
            self.omni_plugin_obj.initialize(self.omni_db_obj)
        else:
            LOG.info("Omni Device plug-in is not specified in the config!!!")
            return

        LOG.info("Device plug-ins loaded!")
开发者ID:Alcatel-LucentEnterpriseData,项目名称:ALUe-OONP_H_R01,代码行数:28,代码来源:omniswitch_network_plugin.py


示例4: main

def main():
    cfg.CONF.register_opts(ip_lib.OPTS)
    config.register_root_helper(cfg.CONF)
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    q_utils.log_opt_values(LOG)
    bridge_classes = {
            'br_int': df_ovs_bridge.DFOVSAgentBridge,
            'br_phys': br_phys.OVSPhysicalBridge,
            'br_tun': br_tun.OVSTunnelBridge
                }
    try:
        agent_config = ona.create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.error(_LE('%s Agent terminated!'), e)
        sys.exit(1)

    is_xen_compute_host = 'rootwrap-xen-dom0' in cfg.CONF.AGENT.root_helper
    if is_xen_compute_host:
        # Force ip_lib to always use the root helper to ensure that ip
        # commands target xen dom0 rather than domU.
        cfg.CONF.set_default('ip_lib_force_root', True)

    agent = L2OVSControllerAgent(bridge_classes, **agent_config)

    signal.signal(signal.SIGTERM, agent._handle_sigterm)

    # Start everything.
    LOG.info(_LI("Agent initialized successfully, now running... "))
    agent.daemon_loop()
开发者ID:xujinrong,项目名称:dragonflow,代码行数:30,代码来源:ovs_dragonflow_neutron_agent.py


示例5: _init_vif

    def _init_vif(self, plugin):
        if plugin == 1:
            try:
                import neutron.agent.linux.interface as interface
                from neutron.agent.linux.interface import OVSInterfaceDriver
                conf = config.setup_conf()
                conf.register_opts(interface.OPTS)
                config.register_root_helper(conf)
                return OVSInterfaceDriver(conf)
            except:
                pass
        else:
            ROOT_HELPER_OPTS = [
                cfg.StrOpt('root_helper', default='sudo',
                           help=_('Root helper application.')),
                cfg.BoolOpt('ovs_use_veth', default=True,
                            help = _("ovs_use_veth")),
                cfg.StrOpt('ovs_integration_bridge',
                           default='br-int',
                           help=_('Name of Open vSwitch bridge to use'))
                            ]
            try:        
                from neutron_plugin_contrail.plugins.opencontrail.agent.contrail_vif_driver import ContrailInterfaceDriver
                contrail_conf = cfg.ConfigOpts()
                contrail_conf.register_opts(ROOT_HELPER_OPTS)
                contrail_conf.register_opts(ROOT_HELPER_OPTS, 'AGENT')
                return ContrailInterfaceDriver(contrail_conf)
            except:
                pass

        return None
开发者ID:numansiddique,项目名称:snat_test,代码行数:31,代码来源:snat_test.py


示例6: 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='neutron.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:Brocade-OpenSource,项目名称:OpenStack-DNRM-Neutron,代码行数:25,代码来源:netns_cleanup_util.py


示例7: main

def main():
    cfg.CONF.register_opts(ip_lib.OPTS)
    cfg.CONF.register_opts(dhcp_config.DHCP_OPTS)
    config.register_root_helper(cfg.CONF)
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    q_utils.log_opt_values(LOG)

    try:
        agent_config = create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.error(_('%s Agent terminated!'), e)
        sys.exit(1)

    is_xen_compute_host = 'rootwrap-xen-dom0' in cfg.CONF.AGENT.root_helper
    if is_xen_compute_host:
        # Force ip_lib to always use the root helper to ensure that ip
        # commands target xen dom0 rather than domU.
        cfg.CONF.set_default('ip_lib_force_root', True)
    try:
        agent = GBPOvsAgent(root_helper=cfg.CONF.AGENT.root_helper,
                            **agent_config)
    except RuntimeError as e:
        LOG.error(_("%s Agent terminated!"), e)
        sys.exit(1)
    signal.signal(signal.SIGTERM, agent._handle_sigterm)

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    agent.daemon_loop()
开发者ID:AKamyshnikova,项目名称:python-opflex-agent,代码行数:30,代码来源:gbp_ovs_agent.py


示例8: setUp

    def setUp(self):
        super(TestMeteringOperations, self).setUp()
        cfg.CONF.register_opts(metering_agent.MeteringAgent.Opts)
        config.register_root_helper(cfg.CONF)

        self.noop_driver = ('neutron.services.metering.drivers.noop.'
                            'noop_driver.NoopMeteringDriver')
        cfg.CONF.set_override('driver', self.noop_driver)
        cfg.CONF.set_override('measure_interval', 0)
        cfg.CONF.set_override('report_interval', 0)

        self.setup_notification_driver()

        metering_rpc = ('neutron.services.metering.agents.metering_agent.'
                        'MeteringPluginRpc._get_sync_data_metering')
        self.metering_rpc_patch = mock.patch(metering_rpc, return_value=[])
        self.metering_rpc_patch.start()

        self.driver_patch = mock.patch(self.noop_driver, autospec=True)
        self.driver_patch.start()

        loopingcall_patch = mock.patch(
            'neutron.openstack.common.loopingcall.FixedIntervalLoopingCall')
        loopingcall_patch.start()

        self.agent = metering_agent.MeteringAgent('my agent', cfg.CONF)
        self.driver = self.agent.metering_driver
开发者ID:AsherBond,项目名称:quantum,代码行数:27,代码来源:test_metering_agent.py


示例9: main

def main():

    
    cfg.CONF.register_opts(ip_lib.OPTS)
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    
           
    cfg.CONF.register_opts(ServiceChainAgent.OPTS,'servicechain')
    cfg.CONF.register_opts(ServiceChainAgent.agent_opts, "AGENT") 
    config.register_root_helper(cfg.CONF)   
    config.register_agent_state_opts_helper(cfg.CONF)

        
    
    
    cfg.CONF(project='neutron')

    try:
        agent_config = create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.error(_('%s ServiceChain-Agent terminated!'), e)
        sys.exit(1)

    plugin = ServiceChainAgent(**agent_config)
    signal.signal(signal.SIGTERM, plugin._handle_sigterm)

    # Start everything.
    LOG.info(_("ServiceChain-Agent initialized successfully, now running... "))
    plugin.daemon_loop()
    sys.exit(0)
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:31,代码来源:servicechain_agent.py


示例10: setUp

    def setUp(self):
        super(TestL3AgentEventHandler, self).setUp()
        cfg.CONF.register_opts(l3_agent.L3NATAgent.OPTS)
        cfg.CONF.set_override("interface_driver", "neutron.agent.linux.interface.NullDriver")
        cfg.CONF.set_override("use_namespaces", True)
        agent_config.register_root_helper(cfg.CONF)

        device_exists_p = mock.patch("neutron.agent.linux.ip_lib.device_exists")
        device_exists_p.start()

        utils_exec_p = mock.patch("neutron.agent.linux.utils.execute")
        utils_exec_p.start()

        drv_cls_p = mock.patch("neutron.agent.linux.interface.NullDriver")
        driver_cls = drv_cls_p.start()
        mock_driver = mock.MagicMock()
        mock_driver.DEV_NAME_LEN = interface.LinuxInterfaceDriver.DEV_NAME_LEN
        driver_cls.return_value = mock_driver

        l3_plugin_p = mock.patch("neutron.agent.l3_agent.L3PluginApi")
        l3_plugin_cls = l3_plugin_p.start()
        l3_plugin_cls.return_value = mock.Mock()

        self.external_process_p = mock.patch("neutron.agent.linux.external_process.ProcessManager")
        self.external_process_p.start()
        looping_call_p = mock.patch("neutron.openstack.common.loopingcall.FixedIntervalLoopingCall")
        looping_call_p.start()
        self.agent = l3_agent.L3NATAgent(HOSTNAME)
        self.addCleanup(mock.patch.stopall)
开发者ID:uramanan,项目名称:neutron,代码行数:29,代码来源:test_l3_agent.py


示例11: register_config

def register_config():
    cfg.CONF.register_opts(restproxy_opts, "RESTPROXY")
    cfg.CONF.register_opts(router_opts, "ROUTER")
    cfg.CONF.register_opts(nova_opts, "NOVA")
    cfg.CONF.register_opts(agent_opts, "RESTPROXYAGENT")
    # include for report_interval
    cfg.CONF.register_opts(agconfig.AGENT_STATE_OPTS, "AGENT")
    agconfig.register_root_helper(cfg.CONF)
开发者ID:wolverineav,项目名称:networking-bigswitch,代码行数:8,代码来源:config.py


示例12: _register_opts

def _register_opts(conf):
    conf.register_opts(L3DataEngine.OPTS)
    config.register_interface_driver_opts_helper(conf)
    config.register_use_namespaces_opts_helper(conf)
    config.register_agent_state_opts_helper(conf)
    config.register_root_helper(conf)
    conf.register_opts(interface.OPTS)
    conf.register_opts(external_process.OPTS)
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:8,代码来源:l3_data_engine.py


示例13: register_options

def register_options():
    cfg.CONF.register_opts(DhcpAgent.OPTS)
    config.register_interface_driver_opts_helper(cfg.CONF)
    config.register_use_namespaces_opts_helper(cfg.CONF)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)
    cfg.CONF.register_opts(dhcp.OPTS)
    cfg.CONF.register_opts(interface.OPTS)
开发者ID:CingHu,项目名称:neutron-ustack,代码行数:8,代码来源:dhcp_agent.py


示例14: setUp

    def setUp(self):
        super(TestFwaasL3AgentRpcCallback, self).setUp()
        self.addCleanup(mock.patch.stopall)

        self.conf = cfg.ConfigOpts()
        self.conf.register_opts(base_config.core_opts)
        agent_config.register_root_helper(self.conf)
        self.conf.root_helper = 'sudo'
        self.api = FWaasAgent(self.conf)
开发者ID:CampHarmony,项目名称:neutron,代码行数:9,代码来源:test_firewall_l3_agent.py


示例15: register_options

def register_options():
    config.register_interface_driver_opts_helper(cfg.CONF)
    config.register_use_namespaces_opts_helper(cfg.CONF)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)
    cfg.CONF.register_opts(dhcp_config.DHCP_AGENT_OPTS)
    cfg.CONF.register_opts(dhcp_config.DHCP_OPTS)
    cfg.CONF.register_opts(dhcp_config.DNSMASQ_OPTS)
    cfg.CONF.register_opts(interface.OPTS)
开发者ID:afori,项目名称:neutron,代码行数:9,代码来源:dhcp_agent.py


示例16: setUp

    def setUp(self):
        super(BaseSudoTestCase, self).setUp()
        self.sudo_enabled = base.bool_from_env('OS_SUDO_TESTING')
        self.fail_on_missing_deps = (
            base.bool_from_env('OS_FAIL_ON_MISSING_DEPS'))

        self.root_helper = os.environ.get('OS_ROOTWRAP_CMD', SUDO_CMD)
        config.register_root_helper(cfg.CONF)
        cfg.CONF.set_override('root_helper', self.root_helper, group='AGENT')
开发者ID:afori,项目名称:neutron,代码行数:9,代码来源:base.py


示例17: register_opts

def register_opts(conf):
    conf.register_opts(l3_config.OPTS)
    conf.register_opts(metadata_driver.MetadataDriver.OPTS)
    conf.register_opts(ha.OPTS)
    config.register_interface_driver_opts_helper(conf)
    config.register_use_namespaces_opts_helper(conf)
    config.register_agent_state_opts_helper(conf)
    config.register_root_helper(conf)
    conf.register_opts(interface.OPTS)
    conf.register_opts(external_process.OPTS)
开发者ID:afori,项目名称:neutron,代码行数:10,代码来源:l3_agent.py


示例18: setUp

    def setUp(self):
        super(TestMeteringDriver, self).setUp()
        cfg.CONF.register_opts(metering_agent.MeteringAgent.Opts)
        config.register_root_helper(cfg.CONF)

        self.noop_driver = "neutron.services.metering.drivers.noop." "noop_driver.NoopMeteringDriver"
        cfg.CONF.set_override("driver", self.noop_driver)

        self.agent = metering_agent.MeteringAgent("my agent", cfg.CONF)
        self.driver = mock.Mock()
        self.agent.metering_driver = self.driver
开发者ID:chrisacbr,项目名称:openstack-neutron,代码行数:11,代码来源:test_metering_agent.py


示例19: setUp

    def setUp(self):
        super(BaseSudoTestCase, self).setUp()
        if not base.bool_from_env('OS_SUDO_TESTING'):
            self.skipTest('Testing with sudo is not enabled')

        config.register_root_helper(cfg.CONF)
        self.config(group='AGENT',
                    root_helper=os.environ.get('OS_ROOTWRAP_CMD', SUDO_CMD))
        self.config(group='AGENT',
                    root_helper_daemon=os.environ.get(
                        'OS_ROOTWRAP_DAEMON_CMD'))
开发者ID:21atlas,项目名称:neutron,代码行数:11,代码来源:base.py


示例20: _configure

 def _configure(self):
     config.setup_logging()
     config.register_root_helper(cfg.CONF)
     cfg.CONF.set_override('root_helper', self.root_helper, group='AGENT')
     config.register_interface_driver_opts_helper(cfg.CONF)
     cfg.CONF.set_override(
         'interface_driver',
         'neutron.agent.linux.interface.OVSInterfaceDriver')
     cfg.CONF.register_opts(interface.OPTS)
     self.driver = importutils.import_object(cfg.CONF.interface_driver,
                                             cfg.CONF)
开发者ID:Jieming,项目名称:neutron,代码行数:11,代码来源:test_ip_lib.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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