Typically Open vSwitch communicates with running processes using
unixctl.  This patch converts ovs-xapi-sync to the strategy for
consistency.

Signed-off-by: Ethan Jackson <et...@nicira.com>
---
 xenserver/etc_init.d_openvswitch                   |    4 ++--
 .../usr_share_openvswitch_scripts_ovs-xapi-sync    |   19 +++++++++----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch
index 29f2cf6..56aed68 100755
--- a/xenserver/etc_init.d_openvswitch
+++ b/xenserver/etc_init.d_openvswitch
@@ -122,8 +122,8 @@ case $1 in
         # The main OVS daemons keep up-to-date, but ovs-xapi-sync needs help.
         pidfile=/var/run/openvswitch/ovs-xapi-sync.pid
         if test -e "$pidfile"; then
-            pid=`cat "$pidfile"`
-            action "Configuring Open vSwitch external IDs" kill -HUP $pid
+            action "Configuring Open vSwitch external IDs" \
+                ovs-appctl -t ovs-xapi-sync force-run
         fi
         ;;
     status)
diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync 
b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
index 77d7589..0069ea0 100755
--- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
+++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
@@ -24,7 +24,6 @@
 
 import argparse
 import os
-import signal
 import sys
 import time
 
@@ -49,6 +48,12 @@ def unixctl_exit(conn, unused_argv, unused_aux):
     conn.reply(None)
 
 
+def unixctl_force_run(conn, unused_argv, unused_aux):
+    global force_run
+    force_run = True
+    conn.reply(None)
+
+
 # Set up a session to interact with XAPI.
 #
 # On system start-up, OVS comes up before XAPI, so we can't log into the
@@ -226,12 +231,6 @@ def prune_schema(schema):
     schema.tables = new_tables
 
 
-def handler(signum, _):
-    global force_run
-    if (signum == signal.SIGHUP):
-        force_run = True
-
-
 def main():
     global force_run
 
@@ -257,6 +256,8 @@ def main():
     ovs.daemon.daemonize()
 
     ovs.unixctl.command_register("exit", "", 0, 0, unixctl_exit, None)
+    ovs.unixctl.command_register("force-run", "", 0, 0, unixctl_force_run,
+                                 None)
     error, unixctl_server = ovs.unixctl.UnixctlServer.create(None)
     if error:
         ovs.util.ovs_fatal(error, "could not create unixctl server", vlog)
@@ -267,8 +268,6 @@ def main():
     while not os.path.exists(cookie_file):
         time.sleep(1)
 
-    signal.signal(signal.SIGHUP, handler)
-
     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
@@ -287,7 +286,7 @@ def main():
             continue
 
         if force_run:
-            vlog.info("Forced to re-run as the result of a SIGHUP")
+            vlog.info("Forced to re-run as the result of unixctl.")
             bridges = {}
             iface_ids = {}
             vm_ids = {}
-- 
1.7.9.2

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to