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

Python config.get_root_helper函数代码示例

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

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



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

示例1: __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:
         LOG.error(_("You must specify an interface driver"))
     self.driver = importutils.import_object(conf.interface_driver, conf)
开发者ID:bbrahmbhatt,项目名称:quantum,代码行数:7,代码来源:dhcp_agent.py


示例2: __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:DestinyOneSystems,项目名称:quantum,代码行数:29,代码来源:agent_manager.py


示例3: 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 Quantum 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.
    """
    eventlet.monkey_patch()

    conf = setup_conf()
    conf()
    config.setup_logging(conf)

    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:wallnerryan,项目名称:quantum_migrate,代码行数:34,代码来源:netns_cleanup_util.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 = {}

        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:
            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:Frostman,项目名称:quantum,代码行数:25,代码来源:l3_agent.py


示例5: 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_agent.NS_PREFIX, "")

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

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


示例6: __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)
     ctx = context.get_admin_context_without_session()
     self.plugin_rpc = DhcpPluginApi(topics.PLUGIN, ctx)
     self.device_manager = DeviceManager(self.conf, self.plugin_rpc)
     self.lease_relay = DhcpLeaseRelay(self.update_lease)
开发者ID:Frostman,项目名称:quantum,代码行数:11,代码来源:dhcp_agent.py


示例7: __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:hanjinze,项目名称:quantum,代码行数:11,代码来源:dhcp_agent.py


示例8: 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:wallnerryan,项目名称:quantum_migrate,代码行数:12,代码来源:netns_cleanup_util.py


示例9: eligible_for_deletion

def eligible_for_deletion(conf, namespace, force=False):
    """Determine whether a namespace is eligible for deletion.

    Eligibility is determined by having only the lo device or if force
    is passed as a parameter.
    """

    # filter out namespaces without UUID as the name
    if not re.match(NS_MANGLING_PATTERN, namespace):
        return False

    root_helper = agent_config.get_root_helper(conf)
    ip = ip_lib.IPWrapper(root_helper, namespace)
    return force or ip.namespace_is_empty()
开发者ID:wallnerryan,项目名称:quantum_migrate,代码行数:14,代码来源:netns_cleanup_util.py


示例10: destroy_namespace

def destroy_namespace(conf, namespace, force=False):
    """Destroy a given namespace.

    If force is True, then dhcp (if it exists) will be disabled and all
    devices will be forcibly removed.
    """

    try:
        root_helper = agent_config.get_root_helper(conf)
        ip = ip_lib.IPWrapper(root_helper, namespace)

        if force:
            kill_dhcp(conf, namespace)
            # NOTE: The dhcp driver will remove the namespace if is it empty,
            # so a second check is required here.
            if ip.netns.exists(namespace):
                for device in ip.get_devices(exclude_loopback=True):
                    unplug_device(conf, device)

        ip.garbage_collect_namespace()
    except Exception, e:
        LOG.exception(_('Error unable to destroy namespace: %s'), namespace)
开发者ID:wallnerryan,项目名称:quantum_migrate,代码行数:22,代码来源:netns_cleanup_util.py


示例11: __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:
            LOG.error(_('An interface driver must be specified'))
            sys.exit(1)
        try:
            self.driver = importutils.import_object(self.conf.interface_driver,
                                                    self.conf)
        except:
            LOG.exception(_("Error importing interface driver '%s'"),
                          self.conf.interface_driver)
            sys.exit(1)
        self.plugin_rpc = L3PluginApi(topics.PLUGIN, host)
        self.fullsync = True
        self.sync_sem = semaphore.Semaphore(1)
        if self.conf.use_namespaces:
            self._destroy_all_router_namespaces()
        super(L3NATAgent, self).__init__(host=self.conf.host)
开发者ID:bbrahmbhatt,项目名称:quantum,代码行数:24,代码来源:l3_agent.py


示例12: __init__

 def __init__(self, conf):
     self.conf = conf
     self.root_helper = config.get_root_helper(conf)
开发者ID:fuzht,项目名称:quantum,代码行数:3,代码来源:interface.py


示例13: __init__

 def __init__(self, conf, client, driver):
     self.conf = conf
     self.root_helper = config.get_root_helper(conf)
     self.client = client
     self.driver = driver
开发者ID:bbrahmbhatt,项目名称:quantum,代码行数:5,代码来源:debug_agent.py


示例14: 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


示例15: test_root_helper

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python config.register_root_helper函数代码示例发布时间:2022-05-26
下一篇:
Python converter.pydate_to_qldate函数代码示例发布时间: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