Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 5a84b9719b8c39ff0a13bdd438745bfa02270219
Parent: adff37be43519da0cf40d7de541d217fbcf842c5
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 5 15:58:37 2012 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 5 15:58:37 2012 -0500
dlm_controld: clean up unfence_all option
fix inconsistency, unfence_all is a boolean
that sets the unfence field in the fence_all_device
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
dlm_controld/config.c | 2 +-
dlm_controld/daemon_cpg.c | 4 ----
dlm_controld/dlm_controld.8 | 3 +--
dlm_controld/dlm_daemon.h | 2 +-
dlm_controld/main.c | 25 ++++++++++++++++---------
5 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/dlm_controld/config.c b/dlm_controld/config.c
index 1efea45..c07c6ee 100644
--- a/dlm_controld/config.c
+++ b/dlm_controld/config.c
@@ -53,7 +53,7 @@ static void get_val_str(char *line, char *val_out)
strcpy(val_out, val);
}
-void setup_config(int update)
+void set_opt_file(int update)
{
struct dlm_option *o;
FILE *file;
diff --git a/dlm_controld/daemon_cpg.c b/dlm_controld/daemon_cpg.c
index 3e7ed74..3ee5f7b 100644
--- a/dlm_controld/daemon_cpg.c
+++ b/dlm_controld/daemon_cpg.c
@@ -458,10 +458,6 @@ static struct node_daemon *add_node_daemon(int nodeid)
/* explicit command line arg has first priority */
if (dlm_options[fence_all_ind].cli_set) {
- memset(&fence_all_device, 0, sizeof(struct fence_device));
- strcpy(fence_all_device.name, "fence_all");
- strcpy(fence_all_device.agent, dlm_options[fence_all_ind].cli_str);
-
fc->dev[0] = &fence_all_device;
goto out;
}
diff --git a/dlm_controld/dlm_controld.8 b/dlm_controld/dlm_controld.8
index 99190da..262ef8a 100644
--- a/dlm_controld/dlm_controld.8
+++ b/dlm_controld/dlm_controld.8
@@ -89,8 +89,7 @@ For default settings, see dlm_controld -h.
fence all nodes with this agent
.B --unfence_all
-.I str
- unfence all nodes with this agent
+ enable unfencing self with fence_all agent
.B --help | -h
print this help, then exit
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 788f4e8..6fef5b4 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -307,7 +307,7 @@ int setup_misc_devices(void);
int path_exists(const char *path);
/* config.c */
-void setup_config(int update);
+void set_opt_file(int update);
int get_weight(int nodeid, char *lockspace);
/* cpg.c */
diff --git a/dlm_controld/main.c b/dlm_controld/main.c
index cc1f0b5..14ac1c7 100644
--- a/dlm_controld/main.c
+++ b/dlm_controld/main.c
@@ -925,8 +925,6 @@ static void loop(void)
void (*workfn) (int ci);
void (*deadfn) (int ci);
- setup_config(0);
-
rv = setup_queries();
if (rv < 0)
goto out;
@@ -1215,6 +1213,8 @@ static void print_usage(void)
printf(" [%d]\n", o->default_int);
else if (o->req_arg == req_arg_bool)
printf(" [%d]\n", o->default_int);
+ else if (o->req_arg == no_arg && !o->default_int)
+ printf(" [0]\n");
else
printf("\n");
@@ -1338,9 +1338,9 @@ static void set_opt_defaults(void)
"fence all nodes with this agent");
set_opt_default(unfence_all_ind,
- "unfence_all", '\0', req_arg_str,
- -1, NULL,
- "unfence all nodes with this agent");
+ "unfence_all", '\0', no_arg,
+ 0, NULL,
+ "enable unfencing self with fence_all agent");
set_opt_default(help_ind,
"help", 'h', no_arg,
@@ -1546,18 +1546,25 @@ int main(int argc, char **argv)
struct sigaction act;
int fd, rv;
+ /*
+ * config priority: cli, config file, default
+ * - explicit cli setting will override default,
+ * - explicit file setting will override default
+ * - explicit file setting will not override explicit cli setting
+ */
+
set_opt_defaults();
+ set_opt_cli(argc, argv);
+ set_opt_file(0);
- memset(&fence_all_device, 0, sizeof(struct fence_device));
strcpy(fence_all_device.name, "fence_all");
- strcpy(fence_all_device.agent, dlm_options[fence_all_ind].default_str);
+ strcpy(fence_all_device.agent, opts(fence_all_ind));
+ fence_all_device.unfence = opt(unfence_all_ind);
INIT_LIST_HEAD(&lockspaces);
INIT_LIST_HEAD(&fs_register_list);
init_daemon();
- set_opt_cli(argc, argv);
-
if (!opt(daemon_debug_ind)) {
if (daemon(0, 0) < 0) {
perror("daemon error");