X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=python%2Fovs%2Fdaemon.py;h=a5b459c6d13baf2e1370cee1ea54ca116d759ac9;hb=59b380da47991502517e3a70b148deda7a2ecfca;hp=a8373cfd0168c42e7ea6c9e0eb8559eb8089afc6;hpb=0f4dec74a7851b603a42291a16b0e7802d12e7f9;p=sliver-openvswitch.git 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"):