In order to prepare for the possibility to allow long running thread(s) to complete their task(s) when a quit signal is received by the daemon, create a configurable quit_timeout period in seconds. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/remote/libvirtd.aug | 1 + src/remote/libvirtd.conf | 8 ++++++++ src/remote/remote_daemon_config.c | 5 +++++ src/remote/remote_daemon_config.h | 2 ++ src/remote/test_libvirtd.aug.in | 1 + 5 files changed, 17 insertions(+) diff --git a/src/remote/libvirtd.aug b/src/remote/libvirtd.aug index 13333448a4..2c282e53e5 100644 --- a/src/remote/libvirtd.aug +++ b/src/remote/libvirtd.aug @@ -62,6 +62,7 @@ module Libvirtd = | int_entry "max_anonymous_clients" | int_entry "max_client_requests" | int_entry "prio_workers" + | int_entry "quit_timeout" let admin_processing_entry = int_entry "admin_min_workers" | int_entry "admin_max_workers" diff --git a/src/remote/libvirtd.conf b/src/remote/libvirtd.conf index 92562ab7ae..cc9647391d 100644 --- a/src/remote/libvirtd.conf +++ b/src/remote/libvirtd.conf @@ -321,6 +321,14 @@ # parameter. #max_client_requests = 5 +# Approximate number of seconds to wait to allow worker threads to +# complete when a signal to quit (e.g. SIGINT, SIGQUIT, SIGTERM) is +# received by libvirtd. This is only for currently processing workers +# in order to allow them to potentially complete their long running +# task such as stats collection or migrations. The default is to +# not wait. +#quit_timeout = 0 + # Same processing controls, but this time for the admin interface. # For description of each option, be so kind to scroll few lines # upwards. diff --git a/src/remote/remote_daemon_config.c b/src/remote/remote_daemon_config.c index b1516befb4..d6b3575a9a 100644 --- a/src/remote/remote_daemon_config.c +++ b/src/remote/remote_daemon_config.c @@ -155,6 +155,8 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED) data->max_client_requests = 5; + data->quit_timeout = 0; + data->audit_level = 1; data->audit_logging = 0; @@ -350,6 +352,9 @@ daemonConfigLoadOptions(struct daemonConfig *data, if (virConfGetValueUInt(conf, "max_client_requests", &data->max_client_requests) < 0) goto error; + if (virConfGetValueUInt(conf, "quit_timeout", &data->quit_timeout) < 0) + goto error; + if (virConfGetValueUInt(conf, "admin_min_workers", &data->admin_min_workers) < 0) goto error; if (virConfGetValueUInt(conf, "admin_max_workers", &data->admin_max_workers) < 0) diff --git a/src/remote/remote_daemon_config.h b/src/remote/remote_daemon_config.h index 49ea80104b..0f27bf44c8 100644 --- a/src/remote/remote_daemon_config.h +++ b/src/remote/remote_daemon_config.h @@ -73,6 +73,8 @@ struct daemonConfig { unsigned int max_client_requests; + unsigned int quit_timeout; + unsigned int log_level; char *log_filters; char *log_outputs; diff --git a/src/remote/test_libvirtd.aug.in b/src/remote/test_libvirtd.aug.in index 527e3d7d0d..c559696f58 100644 --- a/src/remote/test_libvirtd.aug.in +++ b/src/remote/test_libvirtd.aug.in @@ -43,6 +43,7 @@ module Test_libvirtd = { "max_workers" = "20" } { "prio_workers" = "5" } { "max_client_requests" = "5" } + { "quit_timeout" = "0" } { "admin_min_workers" = "1" } { "admin_max_workers" = "5" } { "admin_max_clients" = "5" } -- 2.17.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list