Beispiel #1
0
def initialize_application():
    objects.register_all()
    CONF(sys.argv[1:], project='karbor', version=version.version_string())
    logging.setup(CONF, "karbor")

    rpc.init(CONF)
    return wsgi.Loader(CONF).load_app(name='osapi_karbor')
Beispiel #2
0
    def __init__(self, name, loader=None):
        """Initialize, but do not start the WSGI server.

        :param name: The name of the WSGI server given to the loader.
        :param loader: Loads the WSGI application using the given name.
        :returns: None

        """
        self.name = name
        self.loader = loader or wsgi.Loader(CONF)
        self.app = self.loader.load_app(name)
        self.host = getattr(CONF, 'listen', "0.0.0.0")
        self.port = getattr(CONF, 'port', 0)
        self.workers = (getattr(CONF, 'workers', None)
                        or processutils.get_worker_count())
        if self.workers and self.workers < 1:
            msg = ("Config option workers has an invalid value %(workers)d "
                   ", the value must be greater than 0." % {
                       'workers': self.workers
                   })
            raise exception.ConfigInvalid(error_msg=msg)

        self.server = wsgi.Server(CONF,
                                  name,
                                  self.app,
                                  host=self.host,
                                  port=self.port)
Beispiel #3
0
def initialize_application():
    log.register_options(CONF)
    CONF(sys.argv[1:], project="manila", version=version.version_string())
    config.verify_share_protocols()
    log.setup(CONF, "manila")
    rpc.init(CONF)
    return wsgi.Loader(CONF).load_app(name='osapi_share')
Beispiel #4
0
    def __init__(self, name, loader=None):
        """Initialize, but do not start the WSGI server.

        :param name: The name of the WSGI server given to the loader.
        :param loader: Loads the WSGI application using the given name.
        :returns: None

        """
        self.name = name
        self.manager = self._get_manager()
        self.loader = loader or wsgi.Loader(CONF)
        self.app = self.loader.load_app(name)
        self.host = getattr(CONF, '%s_listen' % name, "0.0.0.0")
        self.port = getattr(CONF, '%s_listen_port' % name, 0)
        self.workers = (getattr(CONF, '%s_workers' % name, None)
                        or processutils.get_worker_count())
        if self.workers and self.workers < 1:
            worker_name = '%s_workers' % name
            msg = (_("%(worker_name)s value of %(workers)d is invalid, "
                     "must be greater than 0.") % {
                         'worker_name': worker_name,
                         'workers': self.workers
                     })
            raise exception.InvalidInput(msg)
        setup_profiler(name, self.host)

        self.server = wsgi.Server(CONF,
                                  name,
                                  self.app,
                                  host=self.host,
                                  port=self.port)
Beispiel #5
0
    def __init__(self, name, loader=None):
        """Initialize, but do not start the WSGI server.

        :param name: The name of the WSGI server given to the loader.
        :param loader: Loads the WSGI application using the given name.
        :returns: None

        """
        self.name = name
        self.manager = self._get_manager()
        self.loader = loader or wsgi.Loader(CONF)
        if not rpc.initialized():
            rpc.init(CONF)
        self.app = self.loader.load_app(name)
        self.host = getattr(CONF, '%s_listen' % name, "0.0.0.0")
        self.port = getattr(CONF, '%s_listen_port' % name, 0)
        self.workers = getattr(CONF, '%s_workers' % name, None)
        self.use_ssl = getattr(CONF, '%s_use_ssl' % name, False)
        if self.workers is not None and self.workers < 1:
            LOG.warning(
                "Value of config option %(name)s_workers must be integer "
                "greater than 1.  Input value ignored.", {'name': name})
            # Reset workers to default
            self.workers = None
        self.server = wsgi.Server(CONF,
                                  name,
                                  self.app,
                                  host=self.host,
                                  port=self.port,
                                  use_ssl=self.use_ssl)
Beispiel #6
0
def load_paste_app(app_name=None):
    """Loads a WSGI app from a paste config file."""
    if app_name is None:
        app_name = cfg.CONF.prog

    loader = wsgi.Loader(cfg.CONF)
    app = loader.load_app(app_name)
    return app
Beispiel #7
0
def initialize_application():
    objects.register_all()
    CONF(sys.argv[1:], project='waterfall', version=version.version_string())
    logging.setup(CONF, "waterfall")
    config.set_middleware_defaults()

    rpc.init(CONF)
    return wsgi.Loader(CONF).load_app(name='osapi_workflow')
Beispiel #8
0
def load_paste_app(app_name):
    """Builds and returns a WSGI app from a paste config file.

    :param app_name: Name of the application to load
    """
    loader = wsgi.Loader(cfg.CONF)
    app = loader.load_app(app_name)
    return app
Beispiel #9
0
def load_paste_app(app_name):
    """Builds and returns a WSGI app from a paste config file.

    :param app_name: Name of the application to load
    """
    loader = wsgi.Loader(
        cfg.CONF)  # 从配置文件neutron.conf中加载page deploy配置文件的位置,得到loader
    app = loader.load_app(app_name)  # 通过deploy.loadapp加载app
    return app
def create_test_app():
    paste_config_loc = os.path.join(os.path.dirname(tests.__file__), 'etc',
                                    'api-paste.ini')
    paste_config_loc = os.path.abspath(paste_config_loc)
    cfg.CONF.set_override('api_paste_config', paste_config_loc)
    loader = wsgi.Loader(cfg.CONF)
    app = loader.load_app('neutron')
    app = InjectContext(app)
    return webtest.TestApp(app)
Beispiel #11
0
def main():
    t = threading.Thread(target=forward_server.main)
    t.setDaemon(True)
    t.start()

    loader = wsgi.Loader(cfg.CONF)
    wsgi_app = loader.load_app('forward-server')

    server = pywsgi.WSGIServer(('0.0.0.0',8080),wsgi_app)
    server.serve_forever()
Beispiel #12
0
def initialize_application():
    objects.register_all()
    CONF(sys.argv[1:], project='cinder', version=version.version_string())
    logging.setup(CONF, "cinder")
    config.set_middleware_defaults()

    rpc.init(CONF)
    service.setup_profiler(constants.API_BINARY, CONF.host)

    return wsgi.Loader(CONF).load_app(name='osapi_volume')
Beispiel #13
0
def load_paste_app(app_name):
    """Builds and returns a WSGI app from a paste config file.

    :param app_name: Name of the application to load
    """
    loader = wsgi.Loader(cfg.CONF)

    # Log the values of registered opts
    if cfg.CONF.debug:
        cfg.CONF.log_opt_values(LOG, logging.DEBUG)
    app = loader.load_app(app_name)
    return app
Beispiel #14
0
    def __init__(self, name):
        self._host = CONF.api_migration_listen
        self._port = CONF.api_migration_listen_port
        self._workers = (CONF.api_migration_workers or
                         processutils.get_worker_count())

        self._loader = wsgi.Loader(CONF)
        self._app = self._loader.load_app(name)

        self._server = wsgi.Server(CONF,
                                   name,
                                   self._app,
                                   host=self._host,
                                   port=self._port)
Beispiel #15
0
    def __init__(self, name):
        self._host = CONF.api.api_listen
        self._port = CONF.api.api_listen_port

        if platform.system() == "Windows":
            self._workers = 1
        else:
            self._workers = ((CONF.api.api_workers
                              or processutils.get_worker_count()))

        self._loader = wsgi.Loader(CONF)
        self._app = self._loader.load_app(name)

        self._server = wsgi.Server(CONF,
                                   name,
                                   self._app,
                                   host=self._host,
                                   port=self._port)
Beispiel #16
0
    def __init__(self, name, worker_count=None):
        self._host = CONF.api_migration_listen
        self._port = CONF.api_migration_listen_port

        # NOTE: oslo_service fork()'s, which won't work on Windows...
        if platform.system() == "Windows":
            self._workers = 1
        elif worker_count is not None:
            self._workers = int(worker_count)
        else:
            self._workers = (CONF.api_migration_workers
                             or processutils.get_worker_count())

        self._loader = wsgi.Loader(CONF)
        self._app = self._loader.load_app(name)

        self._server = wsgi.Server(CONF,
                                   name,
                                   self._app,
                                   host=self._host,
                                   port=self._port)
Beispiel #17
0
def make_app():
    app_loader = oslo_wsgi.Loader(CONF)
    return app_loader.load_app("sahara")
Beispiel #18
0
def svc():
    loader = wsgi.Loader(cfg.CONF)
    wsgi_app = loader.load_app('rank-parser')

    server = pywsgi.WSGIServer(('127.0.0.1', 8181), wsgi_app)
    server.serve_forever()