summaryrefslogtreecommitdiffstats
path: root/bin/nova-api
diff options
context:
space:
mode:
authorBrian Lamar <brian.lamar@rackspace.com>2011-06-20 19:32:18 -0400
committerBrian Lamar <brian.lamar@rackspace.com>2011-06-20 19:32:18 -0400
commite849aa7112dcf24357d46f39195cfefce828a91a (patch)
tree24f748fa92c69142f17d47936c93312019fe6b16 /bin/nova-api
parent9d6f9b7a5de846cf5ba0d6c38440729c54be8e28 (diff)
downloadnova-e849aa7112dcf24357d46f39195cfefce828a91a.tar.gz
nova-e849aa7112dcf24357d46f39195cfefce828a91a.tar.xz
nova-e849aa7112dcf24357d46f39195cfefce828a91a.zip
Removed logging logic from __init__, added concept of Launcher...no tests for it yet.
Diffstat (limited to 'bin/nova-api')
-rwxr-xr-xbin/nova-api40
1 files changed, 11 insertions, 29 deletions
diff --git a/bin/nova-api b/bin/nova-api
index 2345b3f2c..563d7c090 100755
--- a/bin/nova-api
+++ b/bin/nova-api
@@ -24,44 +24,26 @@ Starts both the EC2 and OpenStack APIs in separate processes.
"""
import sys
-import multiprocessing
-import nova.flags
import nova.log
import nova.service
import nova.version
-import nova.utils
-
-
-def launch(service_name):
- """Launch WSGI service with name matching 'paste' config file section."""
- service = nova.service.WSGIService(service_name)
- service.start()
- try:
- service.wait()
- except KeyboardInterrupt:
- service.stop()
def main():
- """Begin process of launching both EC2 and OSAPI services."""
- version = nova.version.version_string_with_vcs()
- logger = nova.log.getLogger("nova.api")
- logger.audit(_("Starting nova-api node (version %s)") % version)
-
- nova.flags.FLAGS(sys.argv)
- nova.utils.default_flagfile()
-
- pool = multiprocessing.Pool(2)
- pool.map_async(launch, ["ec2", "osapi"])
- pool.close()
-
+ """Launch EC2 and OSAPI services."""
+ ec2 = nova.service.WSGIService("ec2")
+ osapi = nova.service.WSGIService("osapi")
+
+ launcher = nova.service.Launcher(sys.argv)
+ launcher.launch_service(ec2)
+ launcher.launch_service(osapi)
+
try:
- pool.join()
+ launcher.wait()
except KeyboardInterrupt:
- logger.audit(_("Exiting..."))
- pool.terminate()
-
+ launcher.stop()
+
if __name__ == '__main__':
sys.exit(main())