summaryrefslogtreecommitdiffstats
path: root/bin/nova-api
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-08-19 00:04:02 +0000
committerTarmac <>2011-08-19 00:04:02 +0000
commit3d1de2a18ef1c1a5c5d311a1e97a417faea0ab64 (patch)
tree450f4effe7cebe0047f01f64de402fa94c267ec0 /bin/nova-api
parentc9831b28a57355ed86d3dfea1abf8b45600cf092 (diff)
parent32e57db9fdc5c48b3546640e838f5eb260080442 (diff)
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
Diffstat (limited to 'bin/nova-api')
-rwxr-xr-xbin/nova-api42
1 files changed, 15 insertions, 27 deletions
diff --git a/bin/nova-api b/bin/nova-api
index fe8e83366..38e2624d8 100755
--- a/bin/nova-api
+++ b/bin/nova-api
@@ -19,12 +19,14 @@
"""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 signal
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")):
sys.path.insert(0, possible_topdir)
-import nova.service
-import nova.utils
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()
+ servers = []
+ for api in flags.FLAGS.enabled_apis:
+ servers.append(service.WSGIService(api))
+ service.serve(*servers)
+ service.wait()