summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorSoren Hansen <soren.hansen@rackspace.com>2010-09-23 15:47:29 +0200
committerSoren Hansen <soren.hansen@rackspace.com>2010-09-23 15:47:29 +0200
commitebf71b08efc6ab3c590f71715aa16b925f17c38e (patch)
tree7852809699cd9b73d555ec0c4e59d34293738996 /bin
parent24f589d421be9a15ad941c34128b4fa0bdc28db4 (diff)
Wrap WSGI container in server.serve to make it properly handle command line arguments as well as daemonise properly. Moved api and wsgi imports in the main() function to delay their inclusion until after python-daemon has closed all the file descriptors. Without this, eventlet's epoll fd gets opened before daemonize is called and thus its fd gets closed leading to very, very, very confusing errors.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-api-new13
1 files changed, 9 insertions, 4 deletions
diff --git a/bin/nova-api-new b/bin/nova-api-new
index 6f25ad8c7..a5027700b 100755
--- a/bin/nova-api-new
+++ b/bin/nova-api-new
@@ -32,13 +32,18 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
sys.path.insert(0, possible_topdir)
-from nova import api
from nova import flags
-from nova import wsgi
+from nova import utils
+from nova import server
FLAGS = flags.FLAGS
flags.DEFINE_integer('api_port', 8773, 'API port')
-if __name__ == '__main__':
- FLAGS(sys.argv)
+def main(_args):
+ from nova import api
+ from nova import wsgi
wsgi.run_server(api.API(), FLAGS.api_port)
+
+if __name__ == '__main__':
+ utils.default_flagfile()
+ server.serve('nova-api', main)