Merge lp:~soren/nova/nova-api-new-daemonise into lp:~gundlach/nova/controllers-in-api

Proposed by Soren Hansen
Status: Merged
Approved by: Michael Gundlach
Approved revision: 309
Merge reported by: Michael Gundlach
Merged at revision: not available
Proposed branch: lp:~soren/nova/nova-api-new-daemonise
Merge into: lp:~gundlach/nova/controllers-in-api
Diff against target: 26 lines (+9/-4)
1 file modified
bin/nova-api-new (+9/-4)
To merge this branch: bzr merge lp:~soren/nova/nova-api-new-daemonise
Reviewer Review Type Date Requested Status
Michael Gundlach Approve
Review via email: mp+36444@code.launchpad.net

Description of the change

Wrap WSGI container in server.serve to make it properly handle command line arguments as well as daemonise properly.

Delay api and wsgi imports (to delay eventlet import, really) to avoid having eventlet's epoll file descriptor closed by daemonize().

To post a comment you must log in.
Revision history for this message
Michael Gundlach (gundlach) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/nova-api-new'
2--- bin/nova-api-new 2010-09-23 13:13:27 +0000
3+++ bin/nova-api-new 2010-09-23 13:58:41 +0000
4@@ -32,13 +32,18 @@
5 if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
6 sys.path.insert(0, possible_topdir)
7
8-from nova import api
9 from nova import flags
10-from nova import wsgi
11+from nova import utils
12+from nova import server
13
14 FLAGS = flags.FLAGS
15 flags.DEFINE_integer('api_port', 8773, 'API port')
16
17+def main(_args):
18+ from nova import api
19+ from nova import wsgi
20+ wsgi.run_server(api.API(), FLAGS.api_port)
21+
22 if __name__ == '__main__':
23- FLAGS(sys.argv)
24- wsgi.run_server(api.API(), FLAGS.api_port)
25+ utils.default_flagfile()
26+ server.serve('nova-api', main)

Subscribers

People subscribed via source and target branches

to all changes: