summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Santa Barbara <justin@fathomdb.com>2011-02-22 17:58:01 -0800
committerJustin Santa Barbara <justin@fathomdb.com>2011-02-22 17:58:01 -0800
commite37e7b91a9fb5664ad50c1ff38e95f1a2d655c06 (patch)
tree3b078ca449be7b64703510ec2d8ae4a403b1a699
parent79f6c437b486262bab3faacb59197a5cae30b2bd (diff)
Support service-like wait behaviour for API service
-rwxr-xr-xbin/nova-api3
-rw-r--r--nova/apiservice.py8
2 files changed, 8 insertions, 3 deletions
diff --git a/bin/nova-api b/bin/nova-api
index 99417e6c6..ccb7701ae 100755
--- a/bin/nova-api
+++ b/bin/nova-api
@@ -49,4 +49,5 @@ if __name__ == '__main__':
if not conf:
LOG.error(_("No paste configuration found for: %s"), 'nova-api.conf')
else:
- apiservice.serve(conf)
+ service = apiservice.serve(conf)
+ service.wait()
diff --git a/nova/apiservice.py b/nova/apiservice.py
index 1914b9e59..14239f196 100644
--- a/nova/apiservice.py
+++ b/nova/apiservice.py
@@ -60,7 +60,7 @@ def _run_app(paste_config_file):
server = wsgi.Server()
for app in apps:
server.start(*app)
- server.wait()
+ return server
class ApiService(object):
@@ -68,9 +68,13 @@ class ApiService(object):
def __init__(self, conf):
self.conf = conf
+ self.wsgi_app = None
def start(self):
- _run_app(self.conf)
+ self.wsgi_app = _run_app(self.conf)
+
+ def wait(self):
+ self.wsgi_app.wait()
@staticmethod
def create():