From: Heming Zhao <heming.zhao@suse.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 08/10] dlm_controld: support "dlm_tool dump_config" to show dynamic setting
Date: Sun, 19 Sep 2021 14:43:20 +0800 [thread overview]
Message-ID: <20210919064322.1670-9-heming.zhao@suse.com> (raw)
In-Reply-To: <20210919064322.1670-1-heming.zhao@suse.com>
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
dlm_controld/main.c | 70 +++++++++++++++++++++++++--------------------
1 file changed, 39 insertions(+), 31 deletions(-)
diff --git a/dlm_controld/main.c b/dlm_controld/main.c
index 91187f2d2402..c4ee3540f508 100644
--- a/dlm_controld/main.c
+++ b/dlm_controld/main.c
@@ -920,17 +920,24 @@ static void copy_options(char *buf, int *len)
{
struct dlm_option *o;
char tmp[256];
- int i, ret, pos = 0;
+ int i, ret, pos = 0, p=5;
for (i = 0; i < dlm_options_max; i++) {
o = &dlm_options[i];
memset(tmp, 0, sizeof(tmp));
+ if (o->dynamic)
+ snprintf(tmp, p+1, "(%c%c) ", '*', o->dynamic_set ? '+' : '-');
+ else
+ memset(tmp, ' ', p);
+
if (o->req_arg == req_arg_str)
- snprintf(tmp, 255, "%s=%s\n", o->name, o->use_str);
+ snprintf(tmp+p, 250, "%s=%s\n", o->name, o->use_str);
+ else if (o->req_arg == req_arg_uint)
+ snprintf(tmp+p, 250, "%s=%u\n", o->name, o->use_uint);
else
- snprintf(tmp, 255, "%s=%d\n", o->name, o->use_int);
+ snprintf(tmp+p, 250, "%s=%d\n", o->name, o->use_int);
if (pos + strlen(tmp) >= LOG_DUMP_SIZE)
break;
@@ -1750,12 +1757,13 @@ static void print_usage(void)
static void set_opt_default(int ind, const char *name, char letter, int arg_type,
int default_int, const char *default_str,
- unsigned int default_uint, const char *desc)
+ unsigned int default_uint, int dynamic, const char *desc)
{
dlm_options[ind].name = name;
dlm_options[ind].letter = letter;
dlm_options[ind].req_arg = arg_type;
dlm_options[ind].desc = desc;
+ dlm_options[ind].dynamic = dynamic;
dlm_options[ind].default_int = default_int;
dlm_options[ind].default_str = default_str;
dlm_options[ind].default_uint = default_uint;
@@ -1768,137 +1776,137 @@ static void set_opt_defaults(void)
{
set_opt_default(daemon_debug_ind,
"daemon_debug", 'D', no_arg,
- 0, NULL, 0,
+ 0, NULL, 0, 1,
"enable debugging to stderr and don't fork");
set_opt_default(foreground_ind,
"foreground", '\0', no_arg,
- 0, NULL, 0,
+ 0, NULL, 0, 0,
"don't fork");
set_opt_default(log_debug_ind,
"log_debug", 'K', no_arg,
- 0, NULL, 0,
+ 0, NULL, 0, 1,
"enable kernel dlm debugging messages");
set_opt_default(timewarn_ind,
"timewarn", '\0', req_arg_int,
- 0, NULL, 0,
+ 0, NULL, 0, 0,
""); /* do not advertise */
set_opt_default(protocol_ind,
"protocol", 'r', req_arg_str,
- -1, "detect", 0,
+ -1, "detect", 0, 0,
"dlm kernel lowcomms protocol: tcp, sctp, detect");
set_opt_default(port_ind,
"port", 'R', req_arg_uint,
- -1, NULL, 21064,
+ -1, NULL, 21064, 0,
"dlm kernel lowcomms protocol port");
set_opt_default(bind_all_ind,
"bind_all", '\0', req_arg_int,
- 0, NULL, 0,
+ 0, NULL, 0, 0,
""); /* do not advertise */
set_opt_default(mark_ind,
"mark", '\0', req_arg_uint,
- 0, NULL, 0,
+ 0, NULL, 0, 0,
"set mark value for DLM if not explicit by nodeid specified");
set_opt_default(debug_logfile_ind,
"debug_logfile", 'L', no_arg,
- 0, NULL, 0,
+ 0, NULL, 0, 1,
"write debugging to log file");
set_opt_default(enable_fscontrol_ind,
"enable_fscontrol", '\0', req_arg_bool,
- 0, NULL, 0,
+ 0, NULL, 0, 0,
""); /* do not advertise */
set_opt_default(enable_plock_ind,
"enable_plock", 'p', req_arg_bool,
- 1, NULL, 0,
+ 1, NULL, 0, 0,
"enable/disable posix lock support for cluster fs");
set_opt_default(plock_debug_ind,
"plock_debug", 'P', no_arg,
- 0, NULL, 0,
+ 0, NULL, 0, 1,
"enable plock debugging");
set_opt_default(plock_rate_limit_ind,
"plock_rate_limit", 'l', req_arg_int,
- 0, NULL, 0,
+ 0, NULL, 0, 1,
"limit rate of plock operations (0 for none)");
set_opt_default(plock_ownership_ind,
"plock_ownership", 'o', req_arg_bool,
- 0, NULL, 0,
+ 0, NULL, 0, 0,
"enable/disable plock ownership");
set_opt_default(drop_resources_time_ind,
"drop_resources_time", 't', req_arg_int,
- 10000, NULL, 0,
+ 10000, NULL, 0, 1,
"plock ownership drop resources time (milliseconds)");
set_opt_default(drop_resources_count_ind,
"drop_resources_count", 'c', req_arg_int,
- 10, NULL, 0,
+ 10, NULL, 0, 1,
"plock ownership drop resources count");
set_opt_default(drop_resources_age_ind,
"drop_resources_age", 'a', req_arg_int,
- 10000, NULL, 0,
+ 10000, NULL, 0, 1,
"plock ownership drop resources age (milliseconds)");
set_opt_default(post_join_delay_ind,
"post_join_delay", 'j', req_arg_int,
- 30, NULL, 0,
+ 30, NULL, 0, 1,
"seconds to delay fencing after cluster join");
set_opt_default(enable_fencing_ind,
"enable_fencing", 'f', req_arg_bool,
- 1, NULL, 0,
+ 1, NULL, 0, 0,
"enable/disable fencing");
set_opt_default(enable_concurrent_fencing_ind,
"enable_concurrent_fencing", '\0', req_arg_bool,
- 0, NULL, 0,
+ 0, NULL, 0, 0,
"enable/disable concurrent fencing");
set_opt_default(enable_startup_fencing_ind,
"enable_startup_fencing", 's', req_arg_bool,
- 1, NULL, 0,
+ 1, NULL, 0, 0,
"enable/disable startup fencing");
set_opt_default(repeat_failed_fencing_ind,
"repeat_failed_fencing", '\0', req_arg_bool,
- 1, NULL, 0,
+ 1, NULL, 0, 1,
"enable/disable retrying after fencing fails");
set_opt_default(enable_quorum_fencing_ind,
"enable_quorum_fencing", 'q', req_arg_bool,
- 1, NULL, 0,
+ 1, NULL, 0, 1,
"enable/disable quorum requirement for fencing");
set_opt_default(enable_quorum_lockspace_ind,
"enable_quorum_lockspace", '\0', req_arg_bool,
- 1, NULL, 0,
+ 1, NULL, 0, 1,
"enable/disable quorum requirement for lockspace operations");
set_opt_default(enable_helper_ind,
"enable_helper", '\0', req_arg_bool,
- 1, NULL, 0,
+ 1, NULL, 0, 0,
"enable/disable helper process for running commands");
set_opt_default(help_ind,
"help", 'h', no_arg,
- -1, NULL, 0,
+ -1, NULL, 0, 0,
"print this help, then exit");
set_opt_default(version_ind,
"version", 'V', no_arg,
- -1, NULL, 0,
+ -1, NULL, 0, 0,
"Print program version information, then exit");
}
--
2.32.0
next prev parent reply other threads:[~2021-09-19 6:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-19 6:43 [Cluster-devel] [RFC PATCH dlm 00/10] dlm_controld config settings can be Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 01/10] dlm_tool man: add command "joinleave", add "USAGE" section Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 02/10] dlm_tool: add run_(check|cancel) all feature Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 03/10] dlm_tool man: add dynamic setting and examples Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 04/10] dlm_controld: put MAX_LINE in header file Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 05/10] dlm_controld: add dynamic setting items in "struct dlm_option" Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 06/10] dlm_controld: change dlm_options[] to shared memory type Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 07/10] dlm_controld: make few APIs public Heming Zhao
2021-09-19 6:43 ` Heming Zhao [this message]
2021-09-19 6:43 ` [Cluster-devel] [PATCH 09/10] dlm_controld: add new API set_opt_online() Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 10/10] dlm_controld: enable "dlm_tool run|run_start" dynamic setting feature Heming Zhao
2021-09-20 17:57 ` [Cluster-devel] [RFC PATCH dlm 00/10] dlm_controld config settings can be David Teigland
2021-09-21 6:38 ` heming.zhao
2021-09-21 13:54 ` David Teigland
2021-09-22 9:32 ` heming.zhao
2021-09-22 13:46 ` David Teigland
2021-09-22 14:35 ` heming.zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210919064322.1670-9-heming.zhao@suse.com \
--to=heming.zhao@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).