diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-08-17 16:25:53 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-08-17 16:25:53 -0700 |
| commit | 6cdee8590528a95e9e3c7f2fc156cc9ebb8b39b2 (patch) | |
| tree | bdf2f7deb1d18a82062bab1c23a6fcd755ebadbc /bin/nova-api | |
| parent | aca07a42fabb7f506cf132b995b4ad0139987b02 (diff) | |
| download | nova-6cdee8590528a95e9e3c7f2fc156cc9ebb8b39b2.tar.gz nova-6cdee8590528a95e9e3c7f2fc156cc9ebb8b39b2.tar.xz nova-6cdee8590528a95e9e3c7f2fc156cc9ebb8b39b2.zip | |
Make all services use the same launching strategy
Diffstat (limited to 'bin/nova-api')
| -rwxr-xr-x | bin/nova-api | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/bin/nova-api b/bin/nova-api index fe8e83366..d2086dc92 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -19,12 +19,15 @@ """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 gettext import os -import signal import sys @@ -33,32 +36,19 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath( if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")): sys.path.insert(0, possible_topdir) -import nova.service -import nova.utils +gettext.install('nova', unicode=1) from nova import flags - - -FLAGS = flags.FLAGS - - -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() - +from nova import log as logging +from nova import service +from nova import utils if __name__ == '__main__': - sys.exit(main()) + utils.default_flagfile() + flags.FLAGS(sys.argv) + logging.setup() + services = [] + for api in flags.FLAGS.enabled_apis: + services.append(service.WSGIService(api)) + service.serve(*services) + service.wait() |
