Makes all of the binary services launch using the same strategy.
* Removes helper methods from utils for loading flags and logging * Changes service.serve to use Launcher * Changes service.wait to actually wait for all the services to exit * Changes nova-api to explicitly load flags and logging and use service.serve * Fixes the annoying IOError when /etc/nova/nova.conf doesn't exist
This commit is contained in:
@@ -24,7 +24,6 @@ from eventlet import greenthread
|
|||||||
from eventlet.green import urllib2
|
from eventlet.green import urllib2
|
||||||
|
|
||||||
import exceptions
|
import exceptions
|
||||||
import gettext
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@@ -38,11 +37,11 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|||||||
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
gettext.install('nova', unicode=1)
|
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
from nova import rpc
|
from nova import rpc
|
||||||
|
from nova import service
|
||||||
from nova import utils
|
from nova import utils
|
||||||
from nova import wsgi
|
from nova import wsgi
|
||||||
|
|
||||||
@@ -141,5 +140,5 @@ if __name__ == '__main__':
|
|||||||
acp = AjaxConsoleProxy()
|
acp = AjaxConsoleProxy()
|
||||||
acp.register_listeners()
|
acp.register_listeners()
|
||||||
server = wsgi.Server("AJAX Console Proxy", acp, port=acp_port)
|
server = wsgi.Server("AJAX Console Proxy", acp, port=acp_port)
|
||||||
server.start()
|
service.serve(server)
|
||||||
server.wait()
|
service.wait()
|
||||||
|
|||||||
42
bin/nova-api
42
bin/nova-api
@@ -19,12 +19,14 @@
|
|||||||
|
|
||||||
"""Starter script for Nova API.
|
"""Starter script for Nova API.
|
||||||
|
|
||||||
Starts both the EC2 and OpenStack APIs in separate processes.
|
Starts both the EC2 and OpenStack APIs in separate greenthreads.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import eventlet
|
||||||
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import signal
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
@@ -33,32 +35,18 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(
|
|||||||
if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
|
if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
|
||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
import nova.service
|
|
||||||
import nova.utils
|
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
|
from nova import log as logging
|
||||||
|
from nova import service
|
||||||
FLAGS = flags.FLAGS
|
from nova import utils
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Launch EC2 and OSAPI services."""
|
|
||||||
nova.utils.Bootstrapper.bootstrap_binary(sys.argv)
|
|
||||||
|
|
||||||
launcher = nova.service.Launcher()
|
|
||||||
|
|
||||||
for api in FLAGS.enabled_apis:
|
|
||||||
service = nova.service.WSGIService(api)
|
|
||||||
launcher.launch_service(service)
|
|
||||||
|
|
||||||
signal.signal(signal.SIGTERM, lambda *_: launcher.stop())
|
|
||||||
|
|
||||||
try:
|
|
||||||
launcher.wait()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
launcher.stop()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main())
|
utils.default_flagfile()
|
||||||
|
flags.FLAGS(sys.argv)
|
||||||
|
logging.setup()
|
||||||
|
servers = []
|
||||||
|
for api in flags.FLAGS.enabled_apis:
|
||||||
|
servers.append(service.WSGIService(api))
|
||||||
|
service.serve(*servers)
|
||||||
|
service.wait()
|
||||||
|
|||||||
46
bin/nova-api-ec2
Executable file
46
bin/nova-api-ec2
Executable file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
|
|
||||||
|
# Copyright 2010 United States Government as represented by the
|
||||||
|
# Administrator of the National Aeronautics and Space Administration.
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""Starter script for Nova EC2 API."""
|
||||||
|
|
||||||
|
import eventlet
|
||||||
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(
|
||||||
|
sys.argv[0]), os.pardir, os.pardir))
|
||||||
|
if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
|
||||||
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
|
|
||||||
|
from nova import flags
|
||||||
|
from nova import log as logging
|
||||||
|
from nova import service
|
||||||
|
from nova import utils
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
utils.default_flagfile()
|
||||||
|
flags.FLAGS(sys.argv)
|
||||||
|
logging.setup()
|
||||||
|
server = service.WSGIService('ec2')
|
||||||
|
service.serve(server)
|
||||||
|
service.wait()
|
||||||
46
bin/nova-api-os
Executable file
46
bin/nova-api-os
Executable file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
|
|
||||||
|
# Copyright 2010 United States Government as represented by the
|
||||||
|
# Administrator of the National Aeronautics and Space Administration.
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""Starter script for Nova OS API."""
|
||||||
|
|
||||||
|
import eventlet
|
||||||
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(
|
||||||
|
sys.argv[0]), os.pardir, os.pardir))
|
||||||
|
if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
|
||||||
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
|
|
||||||
|
from nova import flags
|
||||||
|
from nova import log as logging
|
||||||
|
from nova import service
|
||||||
|
from nova import utils
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
utils.default_flagfile()
|
||||||
|
flags.FLAGS(sys.argv)
|
||||||
|
logging.setup()
|
||||||
|
server = service.WSGIService('osapi')
|
||||||
|
service.serve(server)
|
||||||
|
service.wait()
|
||||||
@@ -22,7 +22,6 @@
|
|||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
import gettext
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -34,7 +33,6 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|||||||
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')):
|
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')):
|
||||||
sys.path.insert(0, POSSIBLE_TOPDIR)
|
sys.path.insert(0, POSSIBLE_TOPDIR)
|
||||||
|
|
||||||
gettext.install('nova', unicode=1)
|
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
@@ -45,5 +43,6 @@ if __name__ == '__main__':
|
|||||||
utils.default_flagfile()
|
utils.default_flagfile()
|
||||||
flags.FLAGS(sys.argv)
|
flags.FLAGS(sys.argv)
|
||||||
logging.setup()
|
logging.setup()
|
||||||
service.serve()
|
server = service.Service.create(binary='nova-compute')
|
||||||
|
service.serve(server)
|
||||||
service.wait()
|
service.wait()
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
import gettext
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -33,7 +32,6 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|||||||
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
gettext.install('nova', unicode=1)
|
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
@@ -44,5 +42,6 @@ if __name__ == '__main__':
|
|||||||
utils.default_flagfile()
|
utils.default_flagfile()
|
||||||
flags.FLAGS(sys.argv)
|
flags.FLAGS(sys.argv)
|
||||||
logging.setup()
|
logging.setup()
|
||||||
service.serve()
|
server = service.Service.create(binary='nova-console')
|
||||||
|
service.serve(server)
|
||||||
service.wait()
|
service.wait()
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
"""Starter script for Nova Direct API."""
|
"""Starter script for Nova Direct API."""
|
||||||
|
|
||||||
import gettext
|
import eventlet
|
||||||
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -32,12 +34,12 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|||||||
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
gettext.install('nova', unicode=1)
|
|
||||||
|
|
||||||
from nova import compute
|
from nova import compute
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
from nova import network
|
from nova import network
|
||||||
|
from nova import service
|
||||||
from nova import utils
|
from nova import utils
|
||||||
from nova import volume
|
from nova import volume
|
||||||
from nova import wsgi
|
from nova import wsgi
|
||||||
@@ -97,5 +99,6 @@ if __name__ == '__main__':
|
|||||||
with_auth,
|
with_auth,
|
||||||
host=FLAGS.direct_host,
|
host=FLAGS.direct_host,
|
||||||
port=FLAGS.direct_port)
|
port=FLAGS.direct_port)
|
||||||
server.start()
|
|
||||||
server.wait()
|
service.serve(server)
|
||||||
|
service.wait()
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
import gettext
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -34,7 +33,6 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|||||||
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
gettext.install('nova', unicode=1)
|
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
@@ -45,5 +43,6 @@ if __name__ == '__main__':
|
|||||||
utils.default_flagfile()
|
utils.default_flagfile()
|
||||||
flags.FLAGS(sys.argv)
|
flags.FLAGS(sys.argv)
|
||||||
logging.setup()
|
logging.setup()
|
||||||
service.serve()
|
server = service.Service.create(binary='nova-network')
|
||||||
|
service.serve(server)
|
||||||
service.wait()
|
service.wait()
|
||||||
|
|||||||
@@ -17,11 +17,11 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
"""
|
"""Daemon for nova objectstore. Supports S3 API."""
|
||||||
Daemon for nova objectstore. Supports S3 API.
|
|
||||||
"""
|
import eventlet
|
||||||
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
import gettext
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -33,10 +33,10 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|||||||
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
gettext.install('nova', unicode=1)
|
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
|
from nova import service
|
||||||
from nova import utils
|
from nova import utils
|
||||||
from nova import wsgi
|
from nova import wsgi
|
||||||
from nova.objectstore import s3server
|
from nova.objectstore import s3server
|
||||||
@@ -54,5 +54,5 @@ if __name__ == '__main__':
|
|||||||
router,
|
router,
|
||||||
port=FLAGS.s3_port,
|
port=FLAGS.s3_port,
|
||||||
host=FLAGS.s3_host)
|
host=FLAGS.s3_host)
|
||||||
server.start()
|
service.serve(server)
|
||||||
server.wait()
|
service.wait()
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
import gettext
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -34,7 +33,6 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|||||||
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
gettext.install('nova', unicode=1)
|
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
@@ -45,5 +43,6 @@ if __name__ == '__main__':
|
|||||||
utils.default_flagfile()
|
utils.default_flagfile()
|
||||||
flags.FLAGS(sys.argv)
|
flags.FLAGS(sys.argv)
|
||||||
logging.setup()
|
logging.setup()
|
||||||
service.serve()
|
server = service.Service.create(binary='nova-scheduler')
|
||||||
|
service.serve(server)
|
||||||
service.wait()
|
service.wait()
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
"""VNC Console Proxy Server."""
|
"""VNC Console Proxy Server."""
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
import gettext
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -29,7 +30,6 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|||||||
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
gettext.install('nova', unicode=1)
|
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
@@ -41,7 +41,7 @@ from nova.vnc import auth
|
|||||||
from nova.vnc import proxy
|
from nova.vnc import proxy
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger('nova.vnc-proxy')
|
LOG = logging.getLogger('nova.vncproxy')
|
||||||
|
|
||||||
|
|
||||||
FLAGS = flags.FLAGS
|
FLAGS = flags.FLAGS
|
||||||
@@ -81,7 +81,7 @@ if __name__ == "__main__":
|
|||||||
FLAGS(sys.argv)
|
FLAGS(sys.argv)
|
||||||
logging.setup()
|
logging.setup()
|
||||||
|
|
||||||
LOG.audit(_("Starting nova-vnc-proxy node (version %s)"),
|
LOG.audit(_("Starting nova-vncproxy node (version %s)"),
|
||||||
version.version_string_with_vcs())
|
version.version_string_with_vcs())
|
||||||
|
|
||||||
if not (os.path.exists(FLAGS.vncproxy_wwwroot) and
|
if not (os.path.exists(FLAGS.vncproxy_wwwroot) and
|
||||||
@@ -107,13 +107,10 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
with_auth = auth.VNCNovaAuthMiddleware(with_logging)
|
with_auth = auth.VNCNovaAuthMiddleware(with_logging)
|
||||||
|
|
||||||
service.serve()
|
|
||||||
|
|
||||||
server = wsgi.Server("VNC Proxy",
|
server = wsgi.Server("VNC Proxy",
|
||||||
with_auth,
|
with_auth,
|
||||||
host=FLAGS.vncproxy_host,
|
host=FLAGS.vncproxy_host,
|
||||||
port=FLAGS.vncproxy_port)
|
port=FLAGS.vncproxy_port)
|
||||||
server.start()
|
|
||||||
server.start_tcp(handle_flash_socket_policy, 843, host=FLAGS.vncproxy_host)
|
server.start_tcp(handle_flash_socket_policy, 843, host=FLAGS.vncproxy_host)
|
||||||
|
service.serve(server)
|
||||||
server.wait()
|
service.wait()
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
import gettext
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -34,7 +33,6 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|||||||
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
gettext.install('nova', unicode=1)
|
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
@@ -45,5 +43,6 @@ if __name__ == '__main__':
|
|||||||
utils.default_flagfile()
|
utils.default_flagfile()
|
||||||
flags.FLAGS(sys.argv)
|
flags.FLAGS(sys.argv)
|
||||||
logging.setup()
|
logging.setup()
|
||||||
service.serve()
|
server = service.Service.create(binary='nova-volume')
|
||||||
|
service.serve(server)
|
||||||
service.wait()
|
service.wait()
|
||||||
|
|||||||
Reference in New Issue
Block a user