allow RyuApp start() method returns Greenlet thread

This enables an application to continue. Without this, ryu-manager
finishes right after running applications.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
FUJITA Tomonori 2013-11-25 09:37:24 +09:00
parent e39fec0238
commit 8ace63f0c9
3 changed files with 8 additions and 4 deletions

View File

@ -303,8 +303,12 @@ class AppManager(object):
self._update_bricks()
self.report_bricks()
threads = []
for app in self.applications.values():
app.start()
t = app.start()
if t is not None:
threads.append(t)
return threads
@staticmethod
def _close(app):

View File

@ -69,9 +69,8 @@ def main():
app_mgr = AppManager.get_instance()
app_mgr.load_apps(app_lists)
contexts = app_mgr.create_contexts()
app_mgr.instantiate_apps(**contexts)
services = []
services.extend(app_mgr.instantiate_apps(**contexts))
# TODO: do the following in app_manager's instantiate_apps()
ofpapp = controller.start_service(app_mgr)

View File

@ -61,8 +61,9 @@ class VRRPManager(app_manager.RyuApp):
self.shutdown = hub.Queue()
def start(self):
self.threads.append(hub.spawn(self._shutdown_loop))
t = hub.spawn(self._shutdown_loop)
super(VRRPManager, self).start()
return t
@handler.set_ev_cls(vrrp_event.EventVRRPConfigRequest)
def config_request_handler(self, ev):