Remove duplicated API server
The server in neutron.cmd.eventlet.api was almost exactly the same as neutron.cmd.eventlet.server.main_wsgi_pecan(). This patch just gets rid of the former and updates a bash script to reference the latter. Change-Id: Ib1ae1d4de9f61bf9eea7e3ceb7fd971195e452e3
This commit is contained in:
parent
4e4a6cff5d
commit
7ab8ee2118
@ -1,68 +0,0 @@
|
|||||||
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
||||||
# Copyright 2014 Yahoo Inc
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
# Much of this module is based on the work of the Ironic team
|
|
||||||
# see http://git.openstack.org/cgit/openstack/ironic/tree/ironic/cmd/api.py
|
|
||||||
|
|
||||||
import logging as std_logging
|
|
||||||
import sys
|
|
||||||
from wsgiref import simple_server
|
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as logging
|
|
||||||
from six.moves import socketserver
|
|
||||||
|
|
||||||
from neutron.common import config
|
|
||||||
from neutron.pecan_wsgi import app
|
|
||||||
from neutron.i18n import _LI, _LW
|
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ThreadedSimpleServer(socketserver.ThreadingMixIn,
|
|
||||||
simple_server.WSGIServer):
|
|
||||||
"""A Mixin class to make the API service greenthread-able."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
config.init(sys.argv[1:])
|
|
||||||
config.setup_logging()
|
|
||||||
application = app.setup_app()
|
|
||||||
|
|
||||||
host = CONF.bind_host
|
|
||||||
port = CONF.bind_port
|
|
||||||
|
|
||||||
wsgi = simple_server.make_server(
|
|
||||||
host,
|
|
||||||
port,
|
|
||||||
application,
|
|
||||||
server_class=ThreadedSimpleServer
|
|
||||||
)
|
|
||||||
|
|
||||||
LOG.warning(
|
|
||||||
_LW("Stand-alone Server Serving on http://%(host)s:%(port)s"),
|
|
||||||
{'host': host, 'port': port}
|
|
||||||
)
|
|
||||||
LOG.info(_LI("Configuration:"))
|
|
||||||
CONF.log_opt_values(LOG, std_logging.INFO)
|
|
||||||
|
|
||||||
try:
|
|
||||||
wsgi.serve_forever()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
pass
|
|
@ -27,7 +27,7 @@ fi
|
|||||||
|
|
||||||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../
|
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../
|
||||||
source "$DIR/.tox/py27/bin/activate"
|
source "$DIR/.tox/py27/bin/activate"
|
||||||
COMMAND="python -c 'from neutron.cmd.eventlet import api; api.main()'"
|
COMMAND="python -c 'from neutron.cmd.eventlet import server; server.main_wsgi_pecan()'"
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
kill $PID
|
kill $PID
|
||||||
|
Loading…
Reference in New Issue
Block a user