Beispiel #1
0
def main():
    try:
        logging.register_options(cfg.CONF)
        cfg.CONF(project='senlin',
                 prog='senlin-api',
                 version=version.version_info.version_string())
        config.set_config_defaults()
        logging.setup(cfg.CONF, 'senlin-api')
        objects.register_all()
        messaging.setup()

        app = wsgi.load_paste_app()

        host = cfg.CONF.senlin_api.bind_host
        port = cfg.CONF.senlin_api.bind_port
        LOG.info('Starting Senlin API on %(host)s:%(port)s', {
            'host': host,
            'port': port
        })
        profiler.setup('senlin-api', host)
        server = wsgi.Server('senlin-api', cfg.CONF.senlin_api)
        server.start(app, default_port=port)
        systemd.notify_once()
        server.wait()
    except RuntimeError as ex:
        sys.exit("ERROR: %s" % six.text_type(ex))
Beispiel #2
0
def main():
    config.parse_args(sys.argv, 'senlin-api')
    logging.setup(CONF, 'senlin-api')
    gmr.TextGuruMeditation.setup_autorun(version)
    objects.register_all()
    messaging.setup()

    app = wsgi.load_paste_app()

    host = CONF.senlin_api.bind_host
    port = CONF.senlin_api.bind_port
    LOG.info('Starting Senlin API on %(host)s:%(port)s', {
        'host': host,
        'port': port
    })
    profiler.setup('senlin-api', host)
    server = wsgi.Server('senlin-api', CONF.senlin_api)
    server.start(app, default_port=port)
    systemd.notify_once()
    server.wait()
Beispiel #3
0
 def test_correct_configure_socket(self):
     mock_socket = mock.Mock()
     self.useFixture(
         fixtures.MonkeyPatch('senlin.api.common.wsgi.ssl.wrap_socket',
                              mock_socket))
     self.useFixture(
         fixtures.MonkeyPatch('senlin.api.common.wsgi.eventlet.listen',
                              lambda *x, **y: mock_socket))
     server = wsgi.Server(name='senlin-api', conf=cfg.CONF.senlin_api)
     server.default_port = 1234
     server.configure_socket()
     self.assertIn(
         mock.call.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1),
         mock_socket.mock_calls)
     self.assertIn(
         mock.call.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
         mock_socket.mock_calls)
     if hasattr(socket, 'TCP_KEEPIDLE'):
         self.assertIn(
             mock.call().setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE,
                                    wsgi.cfg.CONF.senlin_api.tcp_keepidle),
             mock_socket.mock_calls)