transform api config to confdir

Change-Id: I7913b62b62fb1c82027d14c320f017405f8d6d45
This commit is contained in:
jiasirui 2020-12-23 11:26:01 +08:00
parent 2feca2141f
commit 4464a74874
3 changed files with 27 additions and 27 deletions

View File

@ -45,8 +45,8 @@ def main():
gmr.TextGuruMeditation.setup_autorun(version) gmr.TextGuruMeditation.setup_autorun(version)
launcher = service.get_launcher()
server = service.WSGIService('osapi_venus') server = service.WSGIService('osapi_venus')
launcher = service.get_launcher()
launcher.launch_service(server, workers=server.workers) launcher.launch_service(server, workers=server.workers)
launcher.wait() launcher.wait()

View File

@ -12,6 +12,29 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # 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): def register_opts(conf):
pass conf.register_opts(service_opts)

View File

@ -20,7 +20,6 @@ import os
import random import random
from oslo_concurrency import processutils from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_service import loopingcall from oslo_service import loopingcall
from oslo_service import service from oslo_service import service
@ -29,6 +28,7 @@ import osprofiler.notifier
from osprofiler import profiler from osprofiler import profiler
import osprofiler.web import osprofiler.web
from venus.conf import CONF
from venus import context from venus import context
from venus import exception from venus import exception
from venus.i18n import _, _LI, _LW 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 common as wsgi_common
from venus.wsgi import eventlet_server as wsgi from venus.wsgi import eventlet_server as wsgi
LOG = logging.getLogger(__name__) 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): def setup_profiler(binary, host):
if CONF.profiler.profiler_enabled: if CONF.profiler.profiler_enabled: