File bug-1191734_0010-dlm_tool-man-add-new-command-set_config.patch of Package libdlm
From 041c136eb5f843369ec3fa5f0bbebde621121397 Mon Sep 17 00:00:00 2001
From: Heming Zhao <heming.zhao@suse.com>
Date: Fri, 8 Oct 2021 09:33:38 +0800
Subject: [PATCH 10/14] dlm_tool man: add new command set_config
add new command set_config and examples
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
dlm_tool/dlm_tool.8 | 131 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 128 insertions(+), 3 deletions(-)
diff --git a/dlm_tool/dlm_tool.8 b/dlm_tool/dlm_tool.8
index 6c1d471abe68..f6d869620822 100644
--- a/dlm_tool/dlm_tool.8
+++ b/dlm_tool/dlm_tool.8
@@ -32,6 +32,10 @@ dlm_tool \- a utility for the dlm and dlm_controld daemon
.br
Reload dlm_controld config settings from dlm.conf.
+.B set_config
+.br
+ Set dlm_controld config settings on the fly.
+
.BI fence_ack " nodeid"
.br
Quit trying to fence a node.
@@ -144,6 +148,12 @@ Print program version information, then exit
-
+.B dlm_tool set_config "dlm_controld-config-item=x"
+
+* see below \fBset_config EXAMPLES\fP section
+
+-
+
.B dlm_tool fence_ack \fInodeid\fP
* run "dlm_tool status -v" to get \fInodeid\fP
@@ -181,9 +191,9 @@ Print program version information, then exit
.B dlm_tool run|run_start [-n] \fIcommand\fP
* current run & run_start support \fIcommand\fP:
-.br
+.
- "lvm lvchange --refresh"
-.br
+.
- "lvm lvs"
-
@@ -202,7 +212,122 @@ Print program version information, then exit
.B dlm_tool -V
+.SH set_config EXAMPLES
+
+\fIdlm_tool set_config "xxx"\fP can do the dynamic config job. It makes possible to debug, or to do flexible operations on the fly.
+
+supported option items
+
+.RS
+.EX
+daemon_debug
+log_debug
+debug_logfile
+plock_debug
+plock_rate_limit
+drop_resources_time
+drop_resources_count
+drop_resources_age
+post_join_delay
+enable_quorum_fencing
+enable_quorum_lockspace
+repeat_failed_fencing
+.EE
+.RE
+
+.SS display style
+
+Currently, there are 5 ways of setting: default, cli, dlm.conf, reload_config, set_config
+
+The "dlm_tool dump_config" shows the config item by 4 styles.
+
+.TP
+key=val
+For default values that have not been set by cli or config file or dynamically.
+
+.TP
+key=val (cli option)
+For values that have been last set from a command line option.
+
+.TP
+key=val (dlm.conf)
+For values that have been last set from dlm.conf. (reload_config also belongs to this style)
+
+.TP
+key=val (set_config)
+For values that have been last set by dlm_tool set_config.
+
+.TP
+i.e.
+
+.EX
+# dlm_tool dump_config | head -n 5
+daemon_debug=1 (set_config)
+foreground=0
+log_debug=1 (dlm.conf)
+timewarn=0
+protocol=detect
+.EE
+
+In this case, the "daemon_debug" is set by set_config, the "log_debug" is set by dlm.conf.
+meanwhile foreground, timewarn & protocol are using default values.
+
+.SS set_config usage
+
+log_debug is set by dlm.conf (value is 1), then run "set_config" to change to 0. at last use "restore" to restore to dlm.conf setting.
+
+.RS
+.EX
+# dlm_tool dump_config | grep log_debug
+log_debug=1 (dlm.conf)
+
+# dlm_tool set_config "log_debug=0"
+set_config done
+
+# dlm_tool dump_config | grep log_debug
+log_debug=0 (set_config)
+
+# dlm_tool set_config "log_debug=restore"
+set_config done
+
+# dlm_tool dump_config | grep log_debug
+log_debug=1 (dlm.conf)
+.EE
+.RE
+
+restore method
+
+Once user uses "set_config key=val" to change value, whatever user sets 0 or 1, the related item belongs to "set_config" type. There are 2 ways to do restoration job: key=restore, restore_all
+
+restore - to reset single option item (see above example)
+
+restore_all - to reset all set_config items.
+
+.RS
+.EX
+# dlm_tool dump_config | grep _debug
+daemon_debug=0
+log_debug=1 (dlm.conf)
+plock_debug=0
+
+# dlm_tool set_config "daemon_debug=1 log_debug=1 plock_debug=1"
+set_config done
+
+# dlm_tool dump_config | grep _debug
+daemon_debug=1 (set_config)
+log_debug=1 (set_config)
+plock_debug=1 (set_config)
+
+# dlm_tool set_config "restore_all"
+set_config done
+
+# dlm_tool dump_config | grep _debug
+daemon_debug=0
+log_debug=1 (dlm.conf)
+plock_debug=0
+.EE
+.RE
+
.SH SEE ALSO
.BR dlm_controld (8),
.BR dlm.conf (5)
-
--
2.33.0