nova분석(2)--nova-all

6481 단어 nova
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()

좋은 웹페이지 즐겨찾기