Reraise exception and log error message
When the sysinv_api_workers is configured incorrect, the sysinv api will not start due to the invalid default value. therefore will cause host swact. In this case, we can hardly figure out why that node is failure, This patch is to catch exception and log error message and then reraise exception if sysinv_api_workers is invalid value. Closes-bug: #1835142 Change-Id: Ie8dd185a6a24aec28c8834d5013cc003a1f7792f Signed-off-by: junboli <junbo85.li@gmail.com>
This commit is contained in:
parent
33df6b67ab
commit
c38efebf91
|
@ -21,9 +21,11 @@
|
||||||
|
|
||||||
"""The SysInv Service API."""
|
"""The SysInv Service API."""
|
||||||
|
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
from sysinv.common import exception
|
||||||
from sysinv.common import service as sysinv_service
|
from sysinv.common import service as sysinv_service
|
||||||
from sysinv.common import wsgi_service
|
from sysinv.common import wsgi_service
|
||||||
from sysinv import sanity_coverage
|
from sysinv import sanity_coverage
|
||||||
|
@ -37,11 +39,18 @@ def sysinv_api():
|
||||||
launcher = sysinv_service.process_launcher()
|
launcher = sysinv_service.process_launcher()
|
||||||
# server for API
|
# server for API
|
||||||
workers = CONF.sysinv_api_workers or 2
|
workers = CONF.sysinv_api_workers or 2
|
||||||
server = wsgi_service.WSGIService('sysinv_api',
|
|
||||||
CONF.sysinv_api_bind_ip,
|
server = None
|
||||||
CONF.sysinv_api_port,
|
try:
|
||||||
workers,
|
server = wsgi_service.WSGIService('sysinv_api',
|
||||||
False)
|
CONF.sysinv_api_bind_ip,
|
||||||
|
CONF.sysinv_api_port,
|
||||||
|
workers,
|
||||||
|
False)
|
||||||
|
except exception.ConfigInvalid as e:
|
||||||
|
LOG.error(six.text_type(e))
|
||||||
|
raise
|
||||||
|
|
||||||
launcher.launch_service(server, workers=server.workers)
|
launcher.launch_service(server, workers=server.workers)
|
||||||
return launcher
|
return launcher
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue