zoukankan      html  css  js  c++  java
  • nova分析(2)—— nova-all

    nova-all是一个用来启动所有nova服务的辅助脚本,注意只是启动所有服务,不包括停止和重启等功能。

    nova-all的入口在 nova.cmd.all:main ,脚本也比较简单,这儿就贴下代码了

    def main():
        # 命令行参数解析,实际上命令行参数并没有使用
        config.parse_args(sys.argv)
        logging.setup("nova")
        LOG = logging.getLogger('nova.all')
        utils.monkey_patch()
        objects.register_all()
        launcher = service.process_launcher()
    
        # 启动API以提供Rest服务,也就是nova-api(以WSGIService方式启动)
        for api in CONF.enabled_apis:
            try:
                should_use_ssl = api in CONF.enabled_ssl_apis
                server = service.WSGIService(api, use_ssl=should_use_ssl)
                launcher.launch_service(server, workers=server.workers or 1)
            except (Exception, SystemExit):
                LOG.exception(_('Failed to load %s') % '%s-api' % api)
    
        # 启动s3server(基于本地文件实现S3式的存储服务)
        # 启动xvp_proxy(VNC代理,支持基于java的vnc客户端)
        # 这两个服务都是以wsgi.Server方式启动
        for mod in [s3server, xvp_proxy]:
            try:
                launcher.launch_service(mod.get_wsgi_server())
            except (Exception, SystemExit):
                LOG.exception(_('Failed to load %s') % mod.__name__)
    
        # 其他的服务以Service方式启动
        for binary in ['nova-compute', 'nova-network', 'nova-scheduler',
                       'nova-cert', 'nova-conductor']:
    
            # FIXME(sirp): Most service configs are defined in nova/service.py, but
            # conductor has set a new precedent of storing these configs
            # nova/<service>/api.py.
            #
            # We should update the existing services to use this new approach so we
            # don't have to treat conductor differently here.
            if binary == 'nova-conductor':
                topic = CONF.conductor.topic
                manager = CONF.conductor.manager
            else:
                topic = None
                manager = None
    
            try:
                launcher.launch_service(service.Service.create(binary=binary,
                                                               topic=topic,
                                                              manager=manager))
            except (Exception, SystemExit):
                LOG.exception(_('Failed to load %s'), binary)
        launcher.wait()
  • 相关阅读:
    我理解的软件编码规范
    分享:读完这100篇论文,你就能成大数据高手!
    Docker简明教程
    几种源码管理工具的使用
    《构建之法.现代软件工程》教材读后问题
    三层神经网络自编码算法推导和MATLAB实现 (转载)
    aa
    奇异值分解(SVD)原理详解及推导(转载)
    奇异值分解(SVD) --- 几何意义 (转载)
    奇异值分解(SVD)原理详解及推导 (转载)
  • 原文地址:https://www.cnblogs.com/feisky/p/3873630.html
Copyright © 2011-2022 走看看