Add server class for ipv6 binding for sm_api
This fixes the issue of unrecoverable sm-api process failure leading to constant controller degrade in ipv6 system. Story: 2002838 Task: 22757 Change-Id: If5381e583174cce63cb2734a46e094f401d5172b Signed-off-by: Jack Ding <jack.ding@windriver.com>
This commit is contained in:
parent
a1f2589486
commit
d31c03457b
|
@ -53,6 +53,15 @@ def get_handler_cls():
|
||||||
return MyHandler
|
return MyHandler
|
||||||
|
|
||||||
|
|
||||||
|
def get_ipv6_server_cls():
|
||||||
|
cls = simple_server.WSGIServer
|
||||||
|
|
||||||
|
class MyServerClassIPv6(cls, object):
|
||||||
|
address_family = socket.AF_INET6
|
||||||
|
|
||||||
|
return MyServerClassIPv6
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Parse config file and command line options, then start logging
|
# Parse config file and command line options, then start logging
|
||||||
|
|
||||||
|
@ -65,14 +74,24 @@ def main():
|
||||||
# Build and start the WSGI app
|
# Build and start the WSGI app
|
||||||
host = socket.gethostname()
|
host = socket.gethostname()
|
||||||
port = 7777
|
port = 7777
|
||||||
|
|
||||||
|
addrinfo_list = socket.getaddrinfo(host, port)
|
||||||
|
addrinfo = addrinfo_list[0]
|
||||||
|
socket_family = addrinfo[0]
|
||||||
|
|
||||||
|
server_cls = simple_server.WSGIServer
|
||||||
|
if socket.AF_INET6 == socket_family:
|
||||||
|
server_cls = get_ipv6_server_cls()
|
||||||
|
|
||||||
wsgi = simple_server.make_server(host, port,
|
wsgi = simple_server.make_server(host, port,
|
||||||
app.VersionSelectorApplication(),
|
app.VersionSelectorApplication(),
|
||||||
|
server_class=server_cls,
|
||||||
handler_class=get_handler_cls())
|
handler_class=get_handler_cls())
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
LOG.info(_("Serving on http://%(host)s:%(port)s") %
|
LOG.info("Serving on http://%(host)s:%(port)s" %
|
||||||
{'host': host, 'port': port})
|
{'host': host, 'port': port})
|
||||||
LOG.info(_("Configuration:"))
|
LOG.info("Configuration:")
|
||||||
CONF.log_opt_values(LOG, logging.INFO)
|
CONF.log_opt_values(LOG, logging.INFO)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue