The virnetsocket.c API is hardcoded to pass --timeout=30 to any daemon it auto-starts. For inexplicable reasons the virtlockd daemon did not implement the --timeout option, so it would immediately exit on autostart with an error. Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> --- src/locking/lock_daemon.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index 969f901..3379f29 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -1143,6 +1143,7 @@ virLockDaemonUsage(const char *argv0, bool privileged) " -h | --help Display program help:\n" " -v | --verbose Verbose messages.\n" " -d | --daemon Run as a daemon & write PID file.\n" + " -t | --timeout <secs> Exit after timeout period.\n" " -f | --config <file> Configuration file.\n" " -V | --version Display version information.\n" " -p | --pid-file <file> Change name of PID file.\n" @@ -1195,6 +1196,7 @@ int main(int argc, char **argv) { char *pid_file = NULL; int pid_file_fd = -1; char *sock_file = NULL; + int timeout = -1; /* -t: Shutdown timeout */ char *state_file = NULL; bool implicit_conf = false; mode_t old_umask; @@ -1206,6 +1208,7 @@ int main(int argc, char **argv) { { "verbose", no_argument, &verbose, 'v'}, { "daemon", no_argument, &godaemon, 'd'}, { "config", required_argument, NULL, 'f'}, + { "timeout", required_argument, NULL, 't'}, { "pid-file", required_argument, NULL, 'p'}, { "version", no_argument, NULL, 'V' }, { "help", no_argument, NULL, 'h' }, @@ -1226,6 +1229,7 @@ int main(int argc, char **argv) { while (1) { int optidx = 0; int c; + char *tmp; c = getopt_long(argc, argv, "ldf:p:t:vVh", opts, &optidx); @@ -1244,6 +1248,16 @@ int main(int argc, char **argv) { godaemon = 1; break; + case 't': + if (virStrToLong_i(optarg, &tmp, 10, &timeout) != 0 + || timeout <= 0 + /* Ensure that we can multiply by 1000 without overflowing. */ + || timeout > INT_MAX / 1000) { + VIR_ERROR(_("Invalid value for timeout")); + exit(EXIT_FAILURE); + } + break; + case 'p': VIR_FREE(pid_file); if (VIR_STRDUP_QUIET(pid_file, optarg) < 0) @@ -1407,6 +1421,12 @@ int main(int argc, char **argv) { } } + if (timeout != -1) { + VIR_DEBUG("Registering shutdown timeout %d", timeout); + virNetServerAutoShutdown(lockDaemon->srv, + timeout); + } + if ((virLockDaemonSetupSignals(lockDaemon->srv)) < 0) { ret = VIR_LOCK_DAEMON_ERR_SIGNAL; goto cleanup; -- 1.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list