# NOTE(danms): Configure system-wide threading model to use eventlet glance.async_.set_threadpool_model('eventlet') # 设置同步线程池模型
# NOTE(abhishekk): Added initialize_prefetcher KW argument to Server # object so that prefetcher object should only be initialized in case # of API service and ignored in case of registry. Once registry is # removed this parameter should be removed as well. initialize_prefetcher = False if CONF.paste_deploy.flavor == 'keystone+cachemanagement': initialize_prefetcher = True server = wsgi.Server(initialize_glance_store=True, # wsgi 应用 initialize_prefetcher=initialize_prefetcher) server.start(config.load_paste_app('glance-api'), default_port=9292) # 启动 wsgi 应用 server.wait() # 等待启动完成 except Exception as e: fail(e)
# NOTE(danms): We are running inside uwsgi or mod_wsgi, so no eventlet; # use native threading instead. glance.async_.set_threadpool_model('native') atexit.register(drain_threadpools)
# NOTE(danms): Change the default threadpool size since we # are dealing with native threads and not greenthreads. # Right now, the only pool of default size is tasks_pool, # so if others are created this will need to change to be # more specific. common.DEFAULT_POOL_SIZE = CONF.wsgi.task_pool_threads
if CONF.enabled_backends: if store_utils.check_reserved_stores(CONF.enabled_backends): msg = _("'os_glance_' prefix should not be used in " "enabled_backends config option. It is reserved " "for internal use only.") raise RuntimeError(msg) glance_store.register_store_opts(CONF, reserved_stores=RESERVED_STORES) glance_store.create_multi_stores(CONF, reserved_stores=RESERVED_STORES) glance_store.verify_store() else: glance_store.register_opts(CONF) glance_store.create_stores(CONF) glance_store.verify_default_store()
# Use this pipeline for no auth or image caching - DEFAULT [pipeline:glance-api] pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context rootapp
# Use this pipeline for image caching and no auth [pipeline:glance-api-caching] pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache rootapp
# Use this pipeline for caching w/ management interface but no auth [pipeline:glance-api-cachemanagement] pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache cachemanage rootapp
# Use this pipeline for keystone auth [pipeline:glance-api-keystone] pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context rootapp
# Use this pipeline for keystone auth with image caching [pipeline:glance-api-keystone+caching] pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache rootapp
# Use this pipeline for keystone auth with caching and cache management [pipeline:glance-api-keystone+cachemanagement] pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache cachemanage rootapp
# Use this pipeline for authZ only. This means that the registry will treat a # user as authenticated without making requests to keystone to reauthenticate # the user. [pipeline:glance-api-trusted-auth] pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler context rootapp
# Use this pipeline for authZ only. This means that the registry will treat a # user as authenticated without making requests to keystone to reauthenticate # the user and uses cache management [pipeline:glance-api-trusted-auth+cachemanagement] pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler context cache cachemanage rootapp