当前位置: 首页>>代码示例>>Python>>正文


Python config.register_root_helper函数代码示例

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


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


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