From 59b380da47991502517e3a70b148deda7a2ecfca Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Wed, 22 Sep 2010 12:40:39 -0700 Subject: [PATCH] xenserver: monitor-external-ids should run with --monitor 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 --- python/ovs/daemon.py | 7 +++++++ xenserver/etc_init.d_openvswitch | 2 +- xenserver/usr_share_openvswitch_scripts_ovs-external-ids | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/python/ovs/daemon.py b/python/ovs/daemon.py index a8373cfd0..a5b459c6d 100644 --- a/python/ovs/daemon.py +++ b/python/ovs/daemon.py @@ -48,6 +48,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().""" @@ -258,6 +260,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"): diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch index d54a18f40..2cfaacdb0 100755 --- a/xenserver/etc_init.d_openvswitch +++ b/xenserver/etc_init.d_openvswitch @@ -347,7 +347,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 } diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-external-ids b/xenserver/usr_share_openvswitch_scripts_ovs-external-ids index 82bcf978e..ef95bcc27 100755 --- a/xenserver/usr_share_openvswitch_scripts_ovs-external-ids +++ b/xenserver/usr_share_openvswitch_scripts_ovs-external-ids @@ -254,4 +254,4 @@ if __name__ == '__main__': raise except: s_log.exception("traceback") - sys.exit(1) + sys.exit(ovs.daemon.RESTART_EXIT_CODE) -- 2.43.0