Exemplo n.º 1
0
def main():
    # Parse config file and command line options, then start logging
    ironic_service.prepare_service(sys.argv)

    # Enable object backporting via the conductor
    base.IronicObject.indirection_api = base.IronicObjectIndirectionAPI()

    # Build and start the WSGI app
    host = CONF.api.host_ip
    port = CONF.api.port
    wsgi = simple_server.make_server(host,
                                     port,
                                     app.VersionSelectorApplication(),
                                     server_class=ThreadedSimpleServer)

    LOG = log.getLogger(__name__)
    LOG.info(_LI("Serving on http://%(host)s:%(port)s"), {
        'host': host,
        'port': port
    })
    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, logging.DEBUG)

    try:
        wsgi.serve_forever()
    except KeyboardInterrupt:
        pass
Exemplo n.º 2
0
def initialize_wsgi_app(argv=sys.argv):
    i18n.install('ironic')

    service.prepare_service(argv)

    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, log.DEBUG)

    return app.VersionSelectorApplication()
Exemplo n.º 3
0
def initialize_wsgi_app(show_deprecated=False):
    i18n.install('ironic')

    service.prepare_service(sys.argv)

    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, log.DEBUG)

    if show_deprecated:
        LOG.warning("Using ironic/api/app.wsgi is deprecated and it will "
                    "be removed in Rocky release. Please use automatically "
                    "generated ironic-api-wsgi instead.")

    return app.VersionSelectorApplication()
Exemplo n.º 4
0
def main():
    # Pase config file and command line options, then start logging
    ironic_service.prepare_service(sys.argv)

    # Build and start the WSGI app
    host = CONF.ironic_api_bind_ip
    port = CONF.ironic_api_port
    wsgi = simple_server.make_server(host, port,
                                     app.VersionSelectorApplication())

    print "Serving on http://%s:%s" % (host, port)

    try:
        wsgi.serve_forever()
    except KeyboardInterrupt:
        pass
Exemplo n.º 5
0
def main():
    # Pase config file and command line options, then start logging
    ironic_service.prepare_service(sys.argv)

    # Build and start the WSGI app
    host = CONF.ironic_api_bind_ip
    port = CONF.ironic_api_port
    wsgi = simple_server.make_server(host, port,
                                     app.VersionSelectorApplication())

    LOG = log.getLogger(__name__)
    LOG.info("Serving on http://%s:%s" % (host, port))
    LOG.info("Configuration:")
    CONF.log_opt_values(LOG, logging.INFO)

    try:
        wsgi.serve_forever()
    except KeyboardInterrupt:
        pass
Exemplo n.º 6
0
def main():
    # Pase config file and command line options, then start logging
    ironic_service.prepare_service(sys.argv)

    # Build and start the WSGI app
    host = CONF.api.host_ip
    port = CONF.api.port
    wsgi = simple_server.make_server(
            host, port,
            app.VersionSelectorApplication(),
            server_class=ThreadedSimpleServer)

    LOG = log.getLogger(__name__)
    LOG.info(_("Serving on http://%(host)s:%(port)s") %
             {'host': host, 'port': port})
    LOG.info(_("Configuration:"))
    CONF.log_opt_values(LOG, logging.INFO)

    try:
        wsgi.serve_forever()
    except KeyboardInterrupt:
        pass
Exemplo n.º 7
0
    def __init__(self, name, use_ssl=False):
        """Initialize, but do not start the WSGI server.

        :param name: The name of the WSGI server given to the loader.
        :param use_ssl: Wraps the socket in an SSL context if True.
        :returns: None
        """
        self.name = name
        self.app = app.VersionSelectorApplication()
        self.workers = (CONF.api.api_workers
                        or processutils.get_worker_count())
        if self.workers and self.workers < 1:
            raise exception.ConfigInvalid(
                _("api_workers value of %d is invalid, "
                  "must be greater than 0.") % self.workers)

        self.server = wsgi.Server(CONF,
                                  name,
                                  self.app,
                                  host=CONF.api.host_ip,
                                  port=CONF.api.port,
                                  use_ssl=use_ssl)
Exemplo n.º 8
0
    def __init__(self, name, use_ssl=False):
        """Initialize, but do not start the WSGI server.

        :param name: The name of the WSGI server given to the loader.
        :param use_ssl: Wraps the socket in an SSL context if True.
        :returns: None
        """
        self.name = name
        self.app = app.VersionSelectorApplication()
        self.workers = (
            CONF.api.api_workers
            # NOTE(dtantsur): each worker takes a substantial amount of memory,
            # so we don't want to end up with dozens of them.
            or min(processutils.get_worker_count(), _MAX_DEFAULT_WORKERS)
        )
        if self.workers and self.workers < 1:
            raise exception.ConfigInvalid(
                _("api_workers value of %d is invalid, "
                  "must be greater than 0.") % self.workers)

        self.server = wsgi.Server(CONF, name, self.app,
                                  host=CONF.api.host_ip,
                                  port=CONF.api.port,
                                  use_ssl=use_ssl)