Esempio n. 1
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()
        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(name,
                                  self.app,
                                  host=self.host,
                                  port=self.port)
Esempio n. 2
0
    def __init__(self, name, loader=None, use_ssl=False, max_url_len=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()
        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)s is invalid, "
                     "must be greater than 0") %
                   {'worker_name': worker_name,
                    'workers': str(self.workers)})
            raise exception.InvalidInput(msg)
        self.use_ssl = use_ssl
        self.server = wsgi.Server(name,
                                  self.app,
                                  host=self.host,
                                  port=self.port,
                                  use_ssl=self.use_ssl,
                                  max_url_len=max_url_len)
        # Pull back actual port used
        self.port = self.server.port
        self.backdoor_port = None
Esempio n. 3
0
    def __init__(self, name, loader=None, use_ssl=False, max_url_len=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()
        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)s is invalid, "
                     "must be greater than 0") % {
                         'worker_name': worker_name,
                         'workers': str(self.workers)
                     })
            raise exception.InvalidInput(msg)
        self.use_ssl = use_ssl
        self.server = wsgi.Server(name,
                                  self.app,
                                  host=self.host,
                                  port=self.port,
                                  use_ssl=self.use_ssl,
                                  max_url_len=max_url_len)
        # Pull back actual port used
        self.port = self.server.port
        self.backdoor_port = None
Esempio n. 4
0
def main():
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-conductor',
                                    topic=CONF.conductor.topic,
                                    manager=CONF.conductor.manager)
    workers = CONF.conductor.workers or processutils.get_worker_count()
    service.serve(server, workers=workers)
    service.wait()
Esempio n. 5
0
def main():
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-conductor',
                                    topic=CONF.conductor.topic,
                                    manager=CONF.conductor.manager)
    workers = CONF.conductor.workers or processutils.get_worker_count()
    service.serve(server, workers=workers)
    service.wait()
Esempio n. 6
0
 def test_workers_set_zero_user_setting(self, wsgi_server):
     self.override_config('osapi_volume_workers', 0)
     test_service = service.WSGIService("osapi_volume")
     # If a value less than 1 is used, defaults to number of procs available
     self.assertEqual(test_service.workers, processutils.get_worker_count())
Esempio n. 7
0
 def test_get_worker_count(self, mock_cpu_count):
     self.assertEqual(8, processutils.get_worker_count())
Esempio n. 8
0
 def test_get_worker_count_cpu_count_not_implemented(self,
                                                     mock_cpu_count):
     self.assertEqual(1, processutils.get_worker_count())
Esempio n. 9
0
 def test_workers_set_default(self):
     test_service = service.WSGIService("osapi_compute")
     self.assertEqual(test_service.workers, processutils.get_worker_count())
Esempio n. 10
0
 def test_workers_set_zero_user_setting(self):
     CONF.set_override('osapi_compute_workers', 0)
     test_service = service.WSGIService("osapi_compute")
     # If a value less than 1 is used, defaults to number of procs available
     self.assertEqual(test_service.workers, processutils.get_worker_count())
Esempio n. 11
0
                      'the time in seconds that the connection must be idle '
                      'before TCP starts sending keepalive probes.')),
    cfg.StrOpt('ca_file',
               help=_('CA certificate file to use to verify '
                      'connecting clients.')),
    cfg.StrOpt('cert_file',
               help=_('Certificate file to use when starting API '
                      'server securely.')),
    cfg.StrOpt('key_file',
               help=_('Private key file to use when starting API '
                      'server securely.')),
]

eventlet_opts = [
    cfg.IntOpt('workers',
               default=processutils.get_worker_count(),
               help=_('The number of child process workers that will be '
                      'created to service requests. The default will be '
                      'equal to the number of CPUs available.')),
    cfg.IntOpt('max_header_line',
               default=16384,
               help=_('Maximum line size of message headers to be accepted. '
                      'max_header_line may need to be increased when using '
                      'large tokens (typically those generated by the '
                      'Keystone v3 API with big service catalogs')),
]

profiler_opts = [
    cfg.BoolOpt("enabled",
                default=False,
                help=_('If False fully disable profiling feature.')),
Esempio n. 12
0
 def test_workers_set_zero_user_setting(self, wsgi_server):
     self.override_config('osapi_volume_workers', 0)
     test_service = service.WSGIService("osapi_volume")
     # If a value less than 1 is used, defaults to number of procs available
     self.assertEqual(test_service.workers, processutils.get_worker_count())
Esempio n. 13
0
 def test_workers_set_zero_user_setting(self):
     CONF.set_override('osapi_compute_workers', 0)
     test_service = service.WSGIService("osapi_compute")
     # If a value less than 1 is used, defaults to number of procs available
     self.assertEqual(test_service.workers, processutils.get_worker_count())
Esempio n. 14
0
 def test_workers_set_default(self):
     test_service = service.WSGIService("osapi_compute")
     self.assertEqual(test_service.workers, processutils.get_worker_count())
Esempio n. 15
0
 def test_workers_set_default(self, wsgi_server):
     test_service = service.WSGIService("osapi_volume")
     self.assertEqual(test_service.workers, processutils.get_worker_count())
Esempio n. 16
0
 def test_workers_set_default(self, wsgi_server):
     test_service = service.WSGIService("osapi_volume")
     self.assertEqual(test_service.workers, processutils.get_worker_count())
Esempio n. 17
0
 def test_get_worker_count_cpu_count_not_implemented(self,
                                                     mock_cpu_count):
     self.assertEqual(1, processutils.get_worker_count())
Esempio n. 18
0
 def test_get_worker_count(self, mock_cpu_count):
     self.assertEqual(8, processutils.get_worker_count())
Esempio n. 19
0
               help=_('The backlog value that will be used when creating the '
                      'TCP listener socket.')),
    cfg.IntOpt('tcp_keepidle', default=600,
               help=_('The value for the socket option TCP_KEEPIDLE.  This is '
                      'the time in seconds that the connection must be idle '
                      'before TCP starts sending keepalive probes.')),
    cfg.StrOpt('ca_file', help=_('CA certificate file to use to verify '
                                 'connecting clients.')),
    cfg.StrOpt('cert_file', help=_('Certificate file to use when starting API '
                                   'server securely.')),
    cfg.StrOpt('key_file', help=_('Private key file to use when starting API '
                                  'server securely.')),
]

eventlet_opts = [
    cfg.IntOpt('workers', default=processutils.get_worker_count(),
               help=_('The number of child process workers that will be '
                      'created to service requests. The default will be '
                      'equal to the number of CPUs available.')),
    cfg.IntOpt('max_header_line', default=16384,
               help=_('Maximum line size of message headers to be accepted. '
                      'max_header_line may need to be increased when using '
                      'large tokens (typically those generated by the '
                      'Keystone v3 API with big service catalogs')),
]

profiler_opts = [
    cfg.BoolOpt("enabled", default=False,
                help=_('If False fully disable profiling feature.')),
    cfg.BoolOpt("trace_sqlalchemy", default=False,
                help=_("If False doesn't trace SQL requests."))