xenserver: monitor-external-ids should run with --monitor
authorEthan Jackson <ethan@nicira.com>
Wed, 22 Sep 2010 19:40:39 +0000 (12:40 -0700)
committerEthan Jackson <ethan@nicira.com>
Thu, 23 Sep 2010 03:06:40 +0000 (20:06 -0700)
The init script starts monitor-external-ids with --monitor when
configured to do so.  Also made changes to guarantee that --monitor
actually restarts ovs-external-ids.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
python/ovs/daemon.py
xenserver/etc_init.d_openvswitch
xenserver/usr_share_openvswitch_scripts_ovs-external-ids

index eaaaa519b92223180d5559ba1c8b911cdf9e1581..6dff3a02fcbd8e430a2c45f2ce7e21b58538e84c 100644 (file)
@@ -52,6 +52,8 @@ _monitor = False
 # File descriptor used by daemonize_start() and daemonize_complete().
 _daemonize_fd = None
 
+RESTART_EXIT_CODE = 5
+
 def make_pidfile_name(name):
     """Returns the file name that would be used for a pidfile if 'name' were
     provided to set_pidfile()."""
@@ -266,6 +268,11 @@ def _fork_notify_startup(fd):
         os.close(fd)
 
 def _should_restart(status):
+    global RESTART_EXIT_CODE
+
+    if os.WIFEXITED(status) and os.WEXITSTATUS(status) == RESTART_EXIT_CODE:
+        return True
+
     if os.WIFSIGNALED(status):
         for signame in ("SIGABRT", "SIGALRM", "SIGBUS", "SIGFPE", "SIGILL",
                         "SIGPIPE", "SIGSEGV", "SIGXCPU", "SIGXFSZ"):
index e4641097dd7596a82da68c04bfb2728a30dec544..5f18196cf8342008eced5b8d002fc308704a07bd 100755 (executable)
@@ -353,7 +353,7 @@ function start {
     # Start daemon to monitor external ids
     PYTHONPATH=/usr/share/openvswitch/python \
                /usr/share/openvswitch/scripts/ovs-external-ids \
-               --pidfile --detach "$VSWITCHD_OVSDB_SERVER"
+               --pidfile --detach $monitor_opt "$VSWITCHD_OVSDB_SERVER"
 
     touch /var/lock/subsys/openvswitch
 }
index c69fe3775afa028cc99ffa4f6ae844665a99a6b3..fc27aaae1a4df5a80cf1ce711034f3c05f6dc897 100755 (executable)
@@ -279,4 +279,4 @@ if __name__ == '__main__':
         raise
     except:
         s_log.exception("traceback")
-        sys.exit(1)
+        sys.exit(ovs.daemon.RESTART_EXIT_CODE)