diff --git a/venus/cmd/api.py b/venus/cmd/api.py index dcda7e9..c9763a4 100644 --- a/venus/cmd/api.py +++ b/venus/cmd/api.py @@ -45,8 +45,8 @@ def main(): gmr.TextGuruMeditation.setup_autorun(version) - launcher = service.get_launcher() server = service.WSGIService('osapi_venus') + launcher = service.get_launcher() launcher.launch_service(server, workers=server.workers) launcher.wait() diff --git a/venus/conf/api.py b/venus/conf/api.py index cc2cf5a..ba8fc38 100644 --- a/venus/conf/api.py +++ b/venus/conf/api.py @@ -12,6 +12,29 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_config import cfg + + +service_opts = [ + cfg.IntOpt('periodic_interval', + default=60, + help='Interval, in seconds, between running periodic tasks'), + cfg.IntOpt('periodic_fuzzy_delay', + default=60, + help='Range, in seconds, to randomly delay when starting the' + ' periodic task scheduler to reduce stampeding.' + ' (Disable by setting to 0)'), + cfg.StrOpt('osapi_venus_listen', + default="0.0.0.0", + help='IP address on which OpenStack Venus API listens'), + cfg.IntOpt('osapi_venus_listen_port', + default=8560, + min=1, max=65535, + help='Port on which OpenStack Venus API listens'), + cfg.IntOpt('osapi_venus_workers', + help='Number of workers for OpenStack Venus API service. ' + 'The default is equal to the number of CPUs available.'), ] + def register_opts(conf): - pass + conf.register_opts(service_opts) diff --git a/venus/service.py b/venus/service.py index 7d0bdc9..bf5bd2c 100644 --- a/venus/service.py +++ b/venus/service.py @@ -20,7 +20,6 @@ import os import random from oslo_concurrency import processutils -from oslo_config import cfg from oslo_log import log as logging from oslo_service import loopingcall from oslo_service import service @@ -29,6 +28,7 @@ import osprofiler.notifier from osprofiler import profiler import osprofiler.web +from venus.conf import CONF from venus import context from venus import exception from venus.i18n import _, _LI, _LW @@ -36,32 +36,9 @@ from venus import version from venus.wsgi import common as wsgi_common from venus.wsgi import eventlet_server as wsgi + LOG = logging.getLogger(__name__) -service_opts = [ - cfg.IntOpt('periodic_interval', - default=60, - help='Interval, in seconds, between running periodic tasks'), - cfg.IntOpt('periodic_fuzzy_delay', - default=60, - help='Range, in seconds, to randomly delay when starting the' - ' periodic task scheduler to reduce stampeding.' - ' (Disable by setting to 0)'), - cfg.StrOpt('osapi_venus_listen', - default="0.0.0.0", - help='IP address on which OpenStack Venus API listens'), - cfg.IntOpt('osapi_venus_listen_port', - default=8560, - min=1, max=65535, - help='Port on which OpenStack Venus API listens'), - cfg.IntOpt('osapi_venus_workers', - help='Number of workers for OpenStack Venus API service. ' - 'The default is equal to the number of CPUs available.'), ] - - -CONF = cfg.CONF -CONF.register_opts(service_opts) - def setup_profiler(binary, host): if CONF.profiler.profiler_enabled: