diff options
| author | Brian Lamar <brian.lamar@rackspace.com> | 2011-06-20 19:32:18 -0400 |
|---|---|---|
| committer | Brian Lamar <brian.lamar@rackspace.com> | 2011-06-20 19:32:18 -0400 |
| commit | e849aa7112dcf24357d46f39195cfefce828a91a (patch) | |
| tree | 24f748fa92c69142f17d47936c93312019fe6b16 /bin/nova-api | |
| parent | 9d6f9b7a5de846cf5ba0d6c38440729c54be8e28 (diff) | |
| download | nova-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-x | bin/nova-api | 40 |
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()) |
