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

Python config.setup_logging函数代码示例

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

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



在下文中一共展示了setup_logging函数的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.
    """

    opts = [
        cfg.StrOpt('root_helper', default='sudo',
                   help=_("Root helper application.")),
        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.CommonConfigOpts()
    conf.register_opts(opts)
    conf.register_opts(dhcp.OPTS)
    config.setup_logging(conf)
    return conf
开发者ID:bestsharp,项目名称:quantum,代码行数:25,代码来源:netns_cleanup_util.py


示例2: main

def main():
    """Main method for cleaning up OVS bridges.

    The utility cleans up the integration bridges used by Quantum.
    """

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

    configuration_bridges = set([conf.ovs_integration_bridge,
                                 conf.external_network_bridge])
    ovs_bridges = set(ovs_lib.get_bridges(conf.AGENT.root_helper))
    available_configuration_bridges = configuration_bridges & ovs_bridges

    if conf.ovs_all_ports:
        bridges = ovs_bridges
    else:
        bridges = available_configuration_bridges

    # Collect existing ports created by Quantum on configuration bridges.
    # After deleting ports from OVS bridges, we cannot determine which
    # ports were created by Quantum, so port information is collected now.
    ports = collect_quantum_ports(available_configuration_bridges,
                                  conf.AGENT.root_helper)

    for bridge in bridges:
        LOG.info(_("Cleaning %s"), bridge)
        ovs = ovs_lib.OVSBridge(bridge, conf.AGENT.root_helper)
        ovs.delete_ports(all_ports=conf.ovs_all_ports)

    # Remove remaining ports created by Quantum (usually veth pair)
    delete_quantum_ports(ports, conf.AGENT.root_helper)

    LOG.info(_("OVS cleanup completed successfully"))
开发者ID:wdec,项目名称:quantum,代码行数:35,代码来源:ovs_cleanup_util.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: main

def main():
    eventlet.monkey_patch()
    cfg.CONF(project='quantum')

    logging_config.setup_logging(cfg.CONF)

    integ_br = cfg.CONF.OVS.integration_bridge
    polling_interval = cfg.CONF.AGENT.polling_interval
    root_helper = cfg.CONF.AGENT.root_helper

    tunnel_ip = _get_tunnel_ip()
    LOG.debug(_('tunnel_ip %s'), tunnel_ip)
    ovsdb_port = cfg.CONF.OVS.ovsdb_port
    LOG.debug(_('ovsdb_port %s'), ovsdb_port)
    ovsdb_ip = _get_ovsdb_ip()
    LOG.debug(_('ovsdb_ip %s'), ovsdb_ip)
    try:
        agent = OVSQuantumOFPRyuAgent(integ_br, tunnel_ip, ovsdb_ip,
                                      ovsdb_port, polling_interval,
                                      root_helper)
    except httplib.HTTPException as e:
        LOG.error(_("Initialization failed: %s"), e)
        sys.exit(1)

    LOG.info(_("Ryu initialization on the node is done. "
               "Agent initialized successfully, now running..."))
    agent.daemon_loop()
    sys.exit(0)
开发者ID:Apsu,项目名称:quantum,代码行数:28,代码来源:ryu_quantum_agent.py


示例5: 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.'))
    ]

    agent_opts = [
        cfg.StrOpt('root_helper', default='sudo'),
    ]

    conf = cfg.CommonConfigOpts()
    conf.register_cli_opts(opts)
    conf.register_opts(l3_agent.L3NATAgent.OPTS)
    conf.register_opts(interface.OPTS)
    conf.register_opts(agent_opts, 'AGENT')
    config.setup_logging(conf)
    return conf
开发者ID:buzdwj,项目名称:quantum,代码行数:26,代码来源:ovs_cleanup_util.py


示例6: main

def main():
    cfg.CONF(args=sys.argv, project="quantum")

    # (TODO) gary - swap with common logging
    logging_config.setup_logging(cfg.CONF)

    br_name_prefix = BRIDGE_NAME_PREFIX
    physical_interface = cfg.CONF.LINUX_BRIDGE.physical_interface
    polling_interval = cfg.CONF.AGENT.polling_interval
    reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
    root_helper = cfg.CONF.AGENT.root_helper
    rpc = cfg.CONF.AGENT.rpc
    if not cfg.CONF.AGENT.target_v2_api:
        rpc = False

    if rpc:
        plugin = LinuxBridgeQuantumAgentRPC(br_name_prefix, physical_interface, polling_interval, root_helper)
    else:
        db_connection_url = cfg.CONF.DATABASE.sql_connection
        target_v2_api = cfg.CONF.AGENT.target_v2_api
        plugin = LinuxBridgeQuantumAgentDB(
            br_name_prefix,
            physical_interface,
            polling_interval,
            reconnect_interval,
            root_helper,
            target_v2_api,
            db_connection_url,
        )
    LOG.info("Agent initialized successfully, now running... ")
    plugin.daemon_loop()
    sys.exit(0)
开发者ID:vbannai,项目名称:quantum,代码行数:32,代码来源:linuxbridge_quantum_agent.py


示例7: create

    def create(cls, conf=None, options=None, args=None):
        app_name = "quantum"
        if not conf:
            conf_file, conf = config.load_paste_config(app_name, options, args)
            if not conf:
                message = (_('No paste configuration found for: %s'), app_name)
                raise exception.Error(message)

        # Setup logging early, supplying both the CLI options and the
        # configuration mapping from the config file
        # We only update the conf dict for the verbose and debug
        # flags. Everything else must be set up in the conf file...
        # Log the options used when starting if we're in debug mode...

        config.setup_logging(options, conf)
        debug = (options.get('debug') or
                 config.get_option(conf, 'debug', type='bool', default=False))
        verbose = (options.get('verbose') or
                   config.get_option(conf, 'verbose', type='bool',
                                     default=False))
        conf['debug'] = debug
        conf['verbose'] = verbose
        LOG.debug("*" * 80)
        LOG.debug("Configuration options gathered from config file:")
        LOG.debug(conf_file)
        LOG.debug("================================================")
        items = dict([(k, v) for k, v in conf.items()
                      if k not in ('__file__', 'here')])
        for key, value in sorted(items.items()):
            LOG.debug("%(key)-30s %(value)s" % locals())
        LOG.debug("*" * 80)
        service = cls(app_name, conf_file, conf)
        return service
开发者ID:gsalgado,项目名称:quantum,代码行数:33,代码来源:service.py


示例8: main

def main():
    cfg.CONF(args=sys.argv, project='quantum')

    # (TODO) gary - swap with common logging
    logging_config.setup_logging(cfg.CONF)

    # Determine which agent type to use.
    enable_tunneling = cfg.CONF.OVS.enable_tunneling
    integ_br = cfg.CONF.OVS.integration_bridge
    db_connection_url = cfg.CONF.DATABASE.sql_connection
    polling_interval = cfg.CONF.AGENT.polling_interval
    reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
    root_helper = cfg.CONF.AGENT.root_helper
    rpc = cfg.CONF.AGENT.rpc

    if enable_tunneling:
        # Get parameters for OVSQuantumTunnelAgent
        tun_br = cfg.CONF.OVS.tunnel_bridge
        # Mandatory parameter.
        local_ip = cfg.CONF.OVS.local_ip
        plugin = OVSQuantumTunnelAgent(integ_br, tun_br, local_ip, root_helper,
                                       polling_interval, reconnect_interval,
                                       rpc)
    else:
        # Get parameters for OVSQuantumAgent.
        plugin = OVSQuantumAgent(integ_br, root_helper, polling_interval,
                                 reconnect_interval, rpc)

    # Start everything.
    plugin.daemon_loop(db_connection_url)

    sys.exit(0)
开发者ID:missall,项目名称:quantum,代码行数:32,代码来源:ovs_quantum_agent.py


示例9: main

def main():
    cfg.CONF(args=sys.argv, project='quantum')

    # (TODO) gary - swap with common logging
    logging_config.setup_logging(cfg.CONF)

    # Determine which agent type to use.
    enable_tunneling = cfg.CONF.OVS.enable_tunneling
    integ_br = cfg.CONF.OVS.integration_bridge
    db_connection_url = cfg.CONF.DATABASE.sql_connection
    polling_interval = cfg.CONF.AGENT.polling_interval
    reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
    root_helper = cfg.CONF.AGENT.root_helper

    # Determine API Version to use
    target_v2_api = cfg.CONF.AGENT.target_v2_api

    # Get parameters for OVSQuantumAgent.
    plugin = MetaOVSQuantumAgent(integ_br, root_helper, polling_interval,
                                 reconnect_interval, target_v2_api)

    # Start everything.
    plugin.daemon_loop(db_connection_url)

    sys.exit(0)
开发者ID:t-lin,项目名称:quantum,代码行数:25,代码来源:ovs_quantum_agent.py


示例10: main

def main():
    eventlet.monkey_patch()
    cfg.CONF(project='quantum')
    logging_config.setup_logging(cfg.CONF)

    try:
        interface_mappings = q_utils.parse_mappings(
            cfg.CONF.ESWITCH.physical_interface_mappings)
    except ValueError as e:
        LOG.error(_("Parsing physical_interface_mappings failed: %s."
                    " Agent terminated!"), e)
        sys.exit(1)
    LOG.info(_("Interface mappings: %s"), interface_mappings)

    try:
        agent = MlnxEswitchQuantumAgent(interface_mappings)
    except Exception as e:
        LOG.error(_("Failed on Agent initialisation : %s."
                    " Agent terminated!"), e)
        sys.exit(1)

    # Start everything.
    LOG.info(_("Agent initialised successfully, now running... "))
    agent.daemon_loop()
    sys.exit(0)
开发者ID:Apsu,项目名称:quantum,代码行数:25,代码来源:eswitch_quantum_agent.py


示例11: main

def main():
    eventlet.monkey_patch()
    opts = [
        cfg.StrOpt('network_id'),
        cfg.StrOpt('router_id'),
        cfg.StrOpt('pid_file'),
        cfg.BoolOpt('daemonize', default=True),
        cfg.IntOpt('metadata_port',
                   default=9697,
                   help=_("TCP Port to listen for metadata server "
                          "requests.")),
    ]

    cfg.CONF.register_cli_opts(opts)
    # Don't get the default configuration file
    cfg.CONF(project='quantum', default_config_files=[])
    config.setup_logging(cfg.CONF)
    utils.log_opt_values(LOG)
    proxy = ProxyDaemon(cfg.CONF.pid_file,
                        cfg.CONF.metadata_port,
                        network_id=cfg.CONF.network_id,
                        router_id=cfg.CONF.router_id)

    if cfg.CONF.daemonize:
        proxy.start()
    else:
        proxy.run()
开发者ID:CiscoAS,项目名称:quantum,代码行数:27,代码来源:namespace_proxy.py


示例12: main

def main():
    cfg.CONF(args=sys.argv, project='quantum')

    # (TODO) gary - swap with common logging
    logging_config.setup_logging(cfg.CONF)

    integ_br = cfg.CONF.OVS.integration_bridge
    root_helper = cfg.CONF.AGENT.root_helper
    options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
    db = SqlSoup(options["sql_connection"])

    LOG.info(_("Connecting to database \"%(database)s\" on %(host)s"),
             {"database": db.engine.url.database,
              "host": db.engine.url.host})
    ofp_rest_api_addr = check_ofp_rest_api_addr(db)

    tunnel_ip = _get_tunnel_ip()
    LOG.debug(_('tunnel_ip %s'), tunnel_ip)
    ovsdb_port = cfg.CONF.OVS.ovsdb_port
    LOG.debug(_('ovsdb_port %s'), ovsdb_port)
    ovsdb_ip = _get_ovsdb_ip()
    LOG.debug(_('ovsdb_ip %s'), ovsdb_ip)
    try:
        OVSQuantumOFPRyuAgent(integ_br, ofp_rest_api_addr,
                              tunnel_ip, ovsdb_ip, ovsdb_port, root_helper)
    except httplib.HTTPException, e:
        LOG.error(_("Initialization failed: %s"), e)
        sys.exit(1)
开发者ID:alexpilotti,项目名称:quantum,代码行数:28,代码来源:ryu_quantum_agent.py


示例13: main

def main():
    eventlet.monkey_patch()
    opts = [
        cfg.StrOpt('network_id'),
        cfg.StrOpt('router_id'),
        cfg.StrOpt('pid_file'),
        cfg.BoolOpt('daemonize', default=True),
        cfg.IntOpt('metadata_port',
                   default=9697,
                   help="TCP Port to listen for metadata server requests."),
    ]

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

    proxy = ProxyDaemon(cfg.CONF.pid_file,
                        cfg.CONF.metadata_port,
                        network_id=cfg.CONF.network_id,
                        router_id=cfg.CONF.router_id)

    if cfg.CONF.daemonize:
        proxy.start()
    else:
        proxy.run()
开发者ID:ntoll,项目名称:quantum,代码行数:25,代码来源:namespace_proxy.py


示例14: main

def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(UnixDomainMetadataProxy.OPTS)
    cfg.CONF.register_opts(MetadataProxyHandler.OPTS)
    cfg.CONF(project='quantum')
    config.setup_logging(cfg.CONF)

    proxy = UnixDomainMetadataProxy(cfg.CONF)
    proxy.run()
开发者ID:abhiraut,项目名称:quantum,代码行数:9,代码来源:agent.py


示例15: main

def main():
    eventlet.monkey_patch()
    cfg.CONF(args=sys.argv[1:], project='quantum')
    logging_config.setup_logging(cfg.CONF)

    plugin = HyperVQuantumAgent()

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    plugin.daemon_loop()
    sys.exit(0)
开发者ID:alexpilotti,项目名称:quantum,代码行数:11,代码来源:hyperv_quantum_agent.py


示例16: create

    def create(cls):
        app_name = "quantum"

        # Setup logging early, supplying both the CLI options and the
        # configuration mapping from the config file
        # We only update the conf dict for the verbose and debug
        # flags. Everything else must be set up in the conf file...
        # Log the options used when starting if we're in debug mode...

        config.setup_logging(cfg.CONF)
        # Dump the initial option values
        cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
        service = cls(app_name)
        return service
开发者ID:Apsu,项目名称:quantum,代码行数:14,代码来源:service.py


示例17: main

def main():
    eventlet.monkey_patch()

    config.CONF(project='quantum')

    logging_config.setup_logging(config.CONF)

    # Determine which agent type to use.
    integ_br = config.OVS.integration_bridge
    root_helper = config.AGENT.root_helper
    polling_interval = config.AGENT.polling_interval

    agent = NECQuantumAgent(integ_br, root_helper, polling_interval)

    # Start everything.
    agent.daemon_loop()
开发者ID:DestinyOneSystems,项目名称:quantum,代码行数:16,代码来源:nec_quantum_agent.py


示例18: main

def main():
    config.CONF(args=sys.argv, project="quantum")

    logging_config.setup_logging(config.CONF)

    # Determine which agent type to use.
    integ_br = config.OVS.integration_bridge
    root_helper = config.AGENT.root_helper
    polling_interval = config.AGENT.polling_interval

    agent = NECQuantumAgent(integ_br, root_helper, polling_interval)

    # Start everything.
    agent.daemon_loop()

    sys.exit(0)
开发者ID:carriercomm,项目名称:quantum-7,代码行数:16,代码来源:nec_quantum_agent.py


示例19: main

def main():
    eventlet.monkey_patch()
    cfg.CONF(args=sys.argv, project='quantum')
    logging_config.setup_logging(cfg.CONF)

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

    plugin = OVSQuantumAgent(**agent_config)

    # Start everything.
    LOG.info("Agent initialized successfully, now running... ")
    plugin.daemon_loop()
    sys.exit(0)
开发者ID:brosenberg,项目名称:quantum-pub,代码行数:17,代码来源:ovs_quantum_agent.py


示例20: main

def main():
    eventlet.monkey_patch()
    cfg.CONF(args=sys.argv, project='quantum')

    # (TODO) gary - swap with common logging
    logging_config.setup_logging(cfg.CONF)

    integ_br = cfg.CONF.OVS.integration_bridge
    db_connection_url = cfg.CONF.DATABASE.sql_connection
    polling_interval = cfg.CONF.AGENT.polling_interval
    reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
    root_helper = cfg.CONF.AGENT.root_helper
    rpc = cfg.CONF.AGENT.rpc
    tun_br = cfg.CONF.OVS.tunnel_bridge
    local_ip = cfg.CONF.OVS.local_ip
    enable_tunneling = cfg.CONF.OVS.enable_tunneling

    if enable_tunneling and not local_ip:
        LOG.error("Invalid local_ip. (%s). "
                  "Agent terminated!" % repr(local_ip))
        sys.exit(1)

    bridge_mappings = {}
    for mapping in cfg.CONF.OVS.bridge_mappings:
        mapping = mapping.strip()
        if mapping != '':
            try:
                physical_network, bridge = mapping.split(':')
                bridge_mappings[physical_network] = bridge
                LOG.info("Physical network %s mapped to bridge %s",
                         physical_network, bridge)
            except ValueError as ex:
                LOG.error("Invalid bridge mapping: %s - %s. "
                          "Agent terminated!", mapping, ex)
                sys.exit(1)

    plugin = OVSQuantumAgent(integ_br, tun_br, local_ip, bridge_mappings,
                             root_helper, polling_interval,
                             reconnect_interval, rpc, enable_tunneling)

    # Start everything.
    LOG.info("Agent initialized successfully, now running... ")
    plugin.daemon_loop(db_connection_url)

    sys.exit(0)
开发者ID:Blackspan,项目名称:quantum,代码行数:45,代码来源:ovs_quantum_agent.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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