rpc.init(CONF)
launcher = service.process_launcher()
server = service.WSGIService('osapi_volume')
- launcher.launch_service(server, workers=server.workers or 1)
+ launcher.launch_service(server, workers=server.workers)
launcher.wait()
from cinder.openstack.common import importutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import loopingcall
+from cinder.openstack.common import processutils
from cinder.openstack.common import service
from cinder import rpc
from cinder import version
default=8776,
help='Port on which OpenStack Volume API listens'),
cfg.IntOpt('osapi_volume_workers',
- default=1,
- help='Number of workers for OpenStack Volume API service'), ]
+ help='Number of workers for OpenStack Volume API service. '
+ 'The default is equal to the number of CPUs available.'), ]
CONF = cfg.CONF
CONF.register_opts(service_opts)
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.workers = getattr(CONF, '%s_workers' % name,
+ processutils.get_worker_count())
if self.workers < 1:
LOG.warn(_("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.workers = processutils.get_worker_count()
self.server = wsgi.Server(name,
self.app,
host=self.host,
# Port on which OpenStack Volume API listens (integer value)
#osapi_volume_listen_port=8776
-# Number of workers for OpenStack Volume API service (integer
+# Number of workers for OpenStack Volume API service. The
+# default is equal to the number of CPUs available. (integer
# value)
-#osapi_volume_workers=1
+#osapi_volume_workers=<None>
#