With this patch, users can query a running ovs-xapi-sync's version or ask it to exit using ovs-appctl.
Signed-off-by: Ethan Jackson <et...@nicira.com> --- .../usr_share_openvswitch_scripts_ovs-xapi-sync | 25 +++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync index 18ebc4c..77d7589 100755 --- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync +++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync @@ -35,10 +35,18 @@ from ovs.db import error from ovs.db import types import ovs.daemon import ovs.db.idl +import ovs.unixctl vlog = ovs.vlog.Vlog("ovs-xapi-sync") session = None force_run = False +exiting = False + + +def unixctl_exit(conn, unused_argv, unused_aux): + global exiting + exiting = True + conn.reply(None) # Set up a session to interact with XAPI. @@ -248,6 +256,11 @@ def main(): ovs.daemon.daemonize() + ovs.unixctl.command_register("exit", "", 0, 0, unixctl_exit, None) + error, unixctl_server = ovs.unixctl.UnixctlServer.create(None) + if error: + ovs.util.ovs_fatal(error, "could not create unixctl server", vlog) + # This daemon is usually started before XAPI, but to complete our # tasks, we need it. Wait here until it's up. cookie_file = args.root_prefix + "/var/run/xapi_init_complete.cookie" @@ -259,11 +272,18 @@ def main(): bridges = {} # Map from bridge name to nicira-bridge-id iface_ids = {} # Map from xs-vif-uuid to iface-id vm_ids = {} # Map from xs-vm-uuid to vm-id - while True: + while not exiting: + unixctl_server.run() if not force_run and not idl.run(): poller = ovs.poller.Poller() + + unixctl_server.wait(poller) idl.wait(poller) poller.block() + + if exiting: + poller.immediate_wake() + continue if force_run: @@ -365,6 +385,9 @@ def main(): txn.commit_block() + unixctl_server.close() + idl.close() + if __name__ == '__main__': try: -- 1.7.9.2 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev