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

Python config.get_root_helper函数代码示例

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

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



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

示例1: main

def main():
    """Main method for cleaning up network namespaces.

    This method will make two passes checking for namespaces to delete. The
    process will identify candidates, sleep, and call garbage collect. The
    garbage collection will re-verify that the namespace meets the criteria for
    deletion (ie it is empty). The period of sleep and the 2nd pass allow
    time for the namespace state to settle, so that the check prior deletion
    will re-confirm the namespace is empty.

    The utility is designed to clean-up after the forced or unexpected
    termination of Neutron agents.

    The --force flag should only be used as part of the cleanup of a devstack
    installation as it will blindly purge namespaces and their devices. This
    option also kills any lingering DHCP instances.
    """
    conf = setup_conf()
    conf()
    config.setup_logging()

    root_helper = agent_config.get_root_helper(conf)
    # Identify namespaces that are candidates for deletion.
    candidates = [ns for ns in
                  ip_lib.IPWrapper.get_namespaces(root_helper)
                  if eligible_for_deletion(conf, ns, conf.force)]

    if candidates:
        eventlet.sleep(2)

        for namespace in candidates:
            destroy_namespace(conf, namespace, conf.force)
开发者ID:afori,项目名称:neutron,代码行数:32,代码来源:netns_cleanup.py


示例2: __init__

    def __init__(self, host=None):
        super(DhcpAgent, self).__init__(host=host)
        self.needs_resync = False
        self.conf = cfg.CONF
        self.cache = NetworkCache()
        self.root_helper = config.get_root_helper(self.conf)
        self.dhcp_driver_cls = importutils.import_class(self.conf.dhcp_driver)

        # Work out if DHCP serving for bridged or routed VM interfaces.
        try:
            interface_driver = importutils.import_object(
                self.conf.interface_driver, self.conf)
            self.bridged = interface_driver.bridged()
        except Exception as e:
            msg = (_("Error importing interface driver '%(driver)s': "
                   "%(inner)s") % {'driver': self.conf.interface_driver,
                                   'inner': e})
            LOG.error(msg)
            raise SystemExit(msg)

        ctx = context.get_admin_context_without_session()
        self.plugin_rpc = DhcpPluginApi(topics.PLUGIN,
                                        ctx,
                                        self.bridged and
                                        self.conf.use_namespaces)
        # create dhcp dir to store dhcp info
        dhcp_dir = os.path.dirname("/%s/dhcp/" % self.conf.state_path)
        if not os.path.isdir(dhcp_dir):
            os.makedirs(dhcp_dir, 0o755)
        self.dhcp_version = self.dhcp_driver_cls.check_version()
        self._populate_networks_cache()
开发者ID:projectcalico,项目名称:calico-neutron,代码行数:31,代码来源:dhcp_agent.py


示例3: __init__

    def __init__(self, conf):
        LOG.debug(_("Initializing firewall agent"))
        self.conf = conf
        fwaas_driver_class_path = cfg.CONF.fwaas.driver
        self.fwaas_enabled = cfg.CONF.fwaas.enabled

        # None means l3-agent has no information on the server
        # configuration due to the lack of RPC support.
        if self.neutron_service_plugins is not None:
            fwaas_plugin_configured = (constants.FIREWALL
                                       in self.neutron_service_plugins)
            if fwaas_plugin_configured and not self.fwaas_enabled:
                msg = _("FWaaS plugin is configured in the server side, but "
                        "FWaaS is disabled in L3-agent.")
                LOG.error(msg)
                raise SystemExit(1)
            self.fwaas_enabled = self.fwaas_enabled and fwaas_plugin_configured

        if self.fwaas_enabled:
            try:
                self.fwaas_driver = importutils.import_object(
                    fwaas_driver_class_path)
                LOG.debug(_("FWaaS Driver Loaded: '%s'"),
                          fwaas_driver_class_path)
            except ImportError:
                msg = _('Error importing FWaaS device driver: %s')
                raise ImportError(msg % fwaas_driver_class_path)
        self.services_sync = False
        self.root_helper = config.get_root_helper(conf)
        # setup RPC to msg fwaas plugin
        self.fwplugin_rpc = FWaaSL3PluginApi(topics.FIREWALL_PLUGIN,
                                             conf.host)
        super(FWaaSL3AgentRpcCallback, self).__init__(host=conf.host)
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:33,代码来源:firewall_l3_agent.py


示例4: __init__

    def __init__(self, host, conf=None):
        if conf:
            self.conf = conf
        else:
            self.conf = cfg.CONF
        self.root_helper = config.get_root_helper(self.conf)
        self.router_info = {}

        self._check_config_params()

        try:
            self.driver = importutils.import_object(
                self.conf.interface_driver,
                self.conf
            )
        except Exception:
            msg = _("Error importing interface driver "
                    "'%s'") % self.conf.interface_driver
            LOG.error(msg)
            raise SystemExit(1)

        self.context = context.get_admin_context_without_session()
        self.plugin_rpc = L3PluginApi(topics.L3PLUGIN, host)
        self.fullsync = True
        self.updated_routers = set()
        self.removed_routers = set()
        self.sync_progress = False

        self._clean_stale_namespaces = self.conf.use_namespaces

        self._queue = RouterProcessingQueue()
        super(L3NATAgent, self).__init__(conf=self.conf)

        self.target_ex_net_id = None
开发者ID:aignatov,项目名称:neutron,代码行数:34,代码来源:l3_agent.py


示例5: __init__

    def __init__(self, conf, plugin_rpc):
        self.conf = conf
        self.root_helper = config.get_root_helper(conf)
        self.state_path = conf.zorp.loadbalancer_state_path
        try:
            vif_driver = importutils.import_object(conf.interface_driver, conf)
        except ImportError:
            with excutils.save_and_reraise_exception():
                msg = (_('Error importing interface driver: %s')
                       % conf.zorp.interface_driver)
                LOG.error(msg)

        self.vif_driver = vif_driver
        self.plugin_rpc = plugin_rpc
        self.pool_to_port_id = {}

        # generators for zorp config
        # xml generator generates policy.xml for easy tracking of changes
        # policy.py generator policy.py and instances.conf for Zorp configuration
        self.xml_generator = XMLGenerator()
        # TODO: maybe loadbalancer_state_path should be used
        self.policy_py_generator = PolicyPyFromXMLGenerator(
            policy_xml='/tmp/policy.xml',
            policy_py='/tmp/policy.py',
            instances_conf='/tmp/instances.conf'
        )
开发者ID:VPetyaa,项目名称:neutron,代码行数:26,代码来源:driver.py


示例6: __init__

    def __init__(self, host, conf=None):
        if conf:
            self.conf = conf
        else:
            self.conf = cfg.CONF
        self.root_helper = config.get_root_helper(self.conf)
        self.router_info = {}

        if not self.conf.interface_driver:
            raise SystemExit(_('An interface driver must be specified'))
        try:
            self.driver = importutils.import_object(
                self.conf.interface_driver,
                self.conf
            )
        except Exception:
            msg = _("Error importing interface driver "
                    "'%s'") % self.conf.interface_driver
            raise SystemExit(msg)

        self.context = context.get_admin_context_without_session()
        self.plugin_rpc = L3PluginApi(topics.PLUGIN, host)
        self.fullsync = True
        self.sync_sem = semaphore.Semaphore(1)
        if self.conf.use_namespaces:
            self._destroy_router_namespaces(self.conf.router_id)
        super(L3NATAgent, self).__init__(host=self.conf.host)
开发者ID:CiscoSystems,项目名称:quantum,代码行数:27,代码来源:l3_agent.py


示例7: __init__

 def __init__(self, ):
     self.conf = cfg.CONF
     self.root_helper = cconfig.get_root_helper(self.conf)
     self.external_br = ovs_lib.OVSBridge(EXTERNAL_BRIDGE, self.root_helper)
     self.sync = True
     self.ovs_restarted = False
     self.ip_wrapper = ip_lib.IPWrapper(self.root_helper)
开发者ID:CingHu,项目名称:neutron-ustack,代码行数:7,代码来源:ovs_driver.py


示例8: __init__

 def __init__(self, host, conf=None):
     super(VPNAgent, self).__init__(host=host, conf=conf)
     self.root_helper = config.get_root_helper(cfg.CONF)
     cfg.CONF.register_opts(vpn_agent_opts, 'ngfw')
     self.setup_device_drivers(host)
     for device in self.devices:
         device.sync(self.context, [])
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:7,代码来源:ngfw_agent.py


示例9: __init__

    def __init__(self, host, conf=None):
        if conf:
            self.conf = conf
        else:
            self.conf = cfg.CONF
        self.root_helper = config.get_root_helper(self.conf)
        self.router_info = {}

        self._check_config_params()

        try:
            self.driver = importutils.import_object(
                self.conf.interface_driver,
                self.conf
            )
        except Exception:
            msg = _("Error importing interface driver "
                    "'%s'") % self.conf.interface_driver
            LOG.error(msg)
            raise SystemExit(msg)

        self.context = context.get_admin_context_without_session()
        self.plugin_rpc = L3PluginApi(topics.L3PLUGIN, host)
        self.fullsync = True
        self.updated_routers = set()
        self.removed_routers = set()
        self.sync_progress = False
        if self.conf.use_namespaces:
            self._destroy_router_namespaces(self.conf.router_id)

        self.rpc_loop = loopingcall.FixedIntervalLoopingCall(
            self._rpc_loop)
        self.rpc_loop.start(interval=RPC_LOOP_INTERVAL)
        super(L3NATAgent, self).__init__(conf=self.conf)
开发者ID:674009287,项目名称:neutron,代码行数:34,代码来源:l3_agent.py


示例10: __init__

    def __init__(self, conf):
        self.conf = conf
        try:
            vif_driver = importutils.import_object(conf.interface_driver, conf)
        except ImportError:
            # the driver is optional
            msg = _('Error importing interface driver: %s')
            raise SystemExit(msg % conf.interface_driver)
            vif_driver = None

        try:
            self.driver = importutils.import_object(
                conf.device_driver,
                config.get_root_helper(self.conf),
                conf.loadbalancer_state_path,
                vif_driver,
                self._vip_plug_callback
            )
        except ImportError:
            msg = _('Error importing loadbalancer device driver: %s')
            raise SystemExit(msg % conf.device_driver)
        ctx = context.get_admin_context_without_session()
        self.plugin_rpc = agent_api.LbaasAgentApi(
            plugin_driver.TOPIC_PROCESS_ON_HOST,
            ctx,
            conf.host
        )
        self.needs_resync = False
        self.cache = LogicalDeviceCache()
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Neutron,代码行数:29,代码来源:agent_manager.py


示例11: __init__

    def __init__(self, conf):
        self.conf = conf
        try:
            vif_driver = importutils.import_object(conf.interface_driver, conf)
        except ImportError:
            msg = _('Error importing interface driver: %s')
            raise SystemExit(msg % conf.interface_driver)

        try:
            self.driver = importutils.import_object(
                conf.device_driver,
                config.get_root_helper(self.conf),
                conf.loadbalancer_state_path,
                vif_driver,
                self._vip_plug_callback
            )
        except ImportError:
            msg = _('Error importing loadbalancer device driver: %s')
            raise SystemExit(msg % conf.device_driver)

        self.agent_state = {
            'binary': 'neutron-loadbalancer-agent',
            'host': conf.host,
            'topic': plugin_driver.TOPIC_LOADBALANCER_AGENT,
            'configurations': {'device_driver': conf.device_driver,
                               'interface_driver': conf.interface_driver},
            'agent_type': constants.AGENT_TYPE_LOADBALANCER,
            'start_flag': True}
        self.admin_state_up = True

        self.context = context.get_admin_context_without_session()
        self._setup_rpc()
        self.needs_resync = False
        self.cache = LogicalDeviceCache()
开发者ID:davecahill,项目名称:neutron,代码行数:34,代码来源:agent_manager.py


示例12: __init__

 def __init__(self, host, conf=None):
     self.conf = conf or cfg.CONF
     self.context = context.get_admin_context_without_session()
     self.host = host
     self.qos_info = {'qos': {}, 'queue': {}, 'filter': {}}
     self.root_helper = config.get_root_helper(self.conf)
     super(QosAgent, self).__init__(host=host)
开发者ID:chenyanfun,项目名称:neutron-qos,代码行数:7,代码来源:qos_agent.py


示例13: __init__

 def __init__(self, host, conf=None):
     super(QosAgent, self).__init__(host=host)
     self.conf = conf or cfg.CONF
     self.context = context.get_admin_context_without_session()
     self.host = host
     self.root_helper = config.get_root_helper(self.conf)
     self.plugin_rpc = QosPluginRpc(qos_topics.QOS_PLUGIN, self.host)
     self.known_namespaces = netns.get_related_ns()
开发者ID:eayunstack,项目名称:neutron-qos,代码行数:8,代码来源:qos_agent.py


示例14: __init__

 def __init__(self, conf, router):
     self.conf = conf
     self.id = router["id"]
     self.router = router
     self.root_helper = config.get_root_helper(self.conf)
     self.iptables_manager = iptables_manager.IptablesManager(
         root_helper=self.conf.root_helper, namespace=self.ns_name(), binary_name=WRAP_NAME
     )
     self.metering_labels = {}
开发者ID:uramanan,项目名称:neutron,代码行数:9,代码来源:iptables_driver.py


示例15: __init__

 def __init__(self, conf, router):
     self.conf = conf
     self.id = router['id']
     self.router = router
     self.root_helper = config.get_root_helper(self.conf)
     self.ns_name = NS_PREFIX + self.id if conf.use_namespaces else None
     self.iptables_manager = iptables_manager.IptablesManager(
         root_helper=self.root_helper,
         namespace=self.ns_name,
         binary_name=WRAP_NAME)
     self.metering_labels = {}
开发者ID:RenatoArmani,项目名称:neutron,代码行数:11,代码来源:iptables_driver.py


示例16: __init__

 def __init__(self, conf, plugin):
     self.conf = conf
     self.root_helper = config.get_root_helper(conf)
     self.plugin = plugin
     if not conf.interface_driver:
         raise SystemExit(_("You must specify an interface driver"))
     try:
         self.driver = importutils.import_object(conf.interface_driver, conf)
     except Exception:
         msg = _("Error importing interface driver " "'%s'") % conf.interface_driver
         raise SystemExit(msg)
开发者ID:read1984,项目名称:neutron,代码行数:11,代码来源:dhcp_agent.py


示例17: __init__

 def __init__(self, cmd, *args, **kwargs):
     for arg in ('stdin', 'stdout', 'stderr'):
         kwargs.setdefault(arg, subprocess.PIPE)
     self.namespace = kwargs.pop('namespace', None)
     self.cmd = cmd
     if self.namespace is not None:
         cmd = ['ip', 'netns', 'exec', self.namespace] + cmd
     root_helper = config.get_root_helper(utils.cfg.CONF)
     cmd = shlex.split(root_helper) + cmd
     self.child_pid = None
     super(RootHelperProcess, self).__init__(cmd, *args, **kwargs)
     self._wait_for_child_process()
开发者ID:21atlas,项目名称:neutron,代码行数:12,代码来源:net_helpers.py


示例18: __init__

 def __init__(self, conf):
     LOG.debug(_("Initializing firewall agent"))
     fwaas_driver_class_path = cfg.CONF.fw_app.fw_app_driver
     self.fwaas_enabled = cfg.CONF.fw_app.fw_enabled
     self.fwaas_driver_class = fwaas_driver_class_path
     self.fwaas_driver = {}
     self.services_sync = False
     self.root_helper = config.get_root_helper(conf)
     # setup RPC to msg fwaas plugin
     self.fwplugin_rpc = FWaaSNetconfPluginApi(topics.FIREWALL_PLUGIN,
                                          conf.host)
     super(FWaaSNetconfAgentRpcCallback, self).__init__(host = conf.host)
开发者ID:TCS-TelcoCloud,项目名称:FWaaS_plugin,代码行数:12,代码来源:firewall_netconf_agent.py


示例19: unplug_device

def unplug_device(conf, device):
    try:
        device.link.delete()
    except RuntimeError:
        root_helper = agent_config.get_root_helper(conf)
        # Maybe the device is OVS port, so try to delete
        bridge_name = ovs_lib.get_bridge_for_iface(root_helper, device.name)
        if bridge_name:
            bridge = ovs_lib.OVSBridge(bridge_name, root_helper)
            bridge.delete_port(device.name)
        else:
            LOG.debug(_('Unable to find bridge for device: %s'), device.name)
开发者ID:KumarAcharya,项目名称:neutron,代码行数:12,代码来源:netns_cleanup_util.py


示例20: kill_dhcp

def kill_dhcp(conf, namespace):
    """Disable DHCP for a network if DHCP is still active."""
    root_helper = agent_config.get_root_helper(conf)
    network_id = namespace.replace(dhcp.NS_PREFIX, '')

    dhcp_driver = importutils.import_object(
        conf.dhcp_driver,
        conf,
        FakeNetwork(network_id),
        root_helper)

    if dhcp_driver.active:
        dhcp_driver.disable()
开发者ID:CampHarmony,项目名称:neutron,代码行数:13,代码来源:netns_cleanup_util.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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