25
25
26
26
static enum {
27
27
cmd_none ,
28
- cmd_shutdown ,
29
28
cmd_health ,
30
- cmd_elect_dc ,
31
29
cmd_whois_dc ,
32
30
cmd_list_nodes ,
33
31
cmd_pacemakerd_health ,
@@ -50,36 +48,28 @@ gboolean command_cb(const gchar *option_name, const gchar *optarg, gpointer data
50
48
static GOptionEntry command_options [] = {
51
49
{ "status" , 'S' , 0 , G_OPTION_ARG_CALLBACK , command_cb ,
52
50
"Display the status of the specified node."
53
- "\n Result is state of node's internal finite state"
54
- "\n machine, which can be useful for debugging" ,
55
- NULL
51
+ "\n Result is state of node's internal finite state"
52
+ "\n machine, which can be useful for debugging" ,
53
+ "NODE"
56
54
},
57
55
{ "pacemakerd" , 'P' , G_OPTION_FLAG_NO_ARG , G_OPTION_ARG_CALLBACK , command_cb ,
58
56
"Display the status of local pacemakerd."
59
- "\n Result is the state of the sub-daemons watched"
60
- "\n by pacemakerd." ,
57
+ "\n Result is the state of the sub-daemons watched"
58
+ "\n by pacemakerd." ,
61
59
NULL
62
60
},
63
61
{ "dc_lookup" , 'D' , G_OPTION_FLAG_NO_ARG , G_OPTION_ARG_CALLBACK , command_cb ,
64
62
"Display the uname of the node co-ordinating the cluster."
65
- "\n This is an internal detail rarely useful to"
66
- "\n administrators except when deciding on which"
67
- "\n node to examine the logs." ,
63
+ "\n This is an internal detail rarely useful to"
64
+ "\n administrators except when deciding on which"
65
+ "\n node to examine the logs." ,
68
66
NULL
69
67
},
70
68
{ "nodes" , 'N' , G_OPTION_FLAG_OPTIONAL_ARG , G_OPTION_ARG_CALLBACK , command_cb ,
71
69
"Display the uname of all member nodes [optionally filtered by type (comma-separated)]"
72
- "\n Types: all (default), cluster, guest, remote" ,
70
+ "\n Types: all (default), cluster, guest, remote" ,
73
71
"TYPE"
74
72
},
75
- { "election" , 'E' , G_OPTION_FLAG_HIDDEN |G_OPTION_FLAG_NO_ARG , G_OPTION_ARG_CALLBACK , command_cb ,
76
- "(Advanced) Start an election for the cluster co-ordinator" ,
77
- NULL
78
- },
79
- { "kill" , 'K' , G_OPTION_FLAG_HIDDEN , G_OPTION_ARG_CALLBACK , command_cb ,
80
- "(Advanced) Stop controller (not rest of cluster stack) on specified node" ,
81
- NULL
82
- },
83
73
{ "health" , 'H' , G_OPTION_FLAG_HIDDEN , G_OPTION_ARG_NONE , & options .health ,
84
74
NULL ,
85
75
NULL
@@ -89,18 +79,18 @@ static GOptionEntry command_options[] = {
89
79
};
90
80
91
81
static GOptionEntry additional_options [] = {
92
- { "timeout" , 't' , 0 , G_OPTION_ARG_INT , & options . timeout ,
93
- "Time (in milliseconds) to wait before declaring the"
94
- "\n operation failed" ,
95
- NULL
82
+ { "timeout" , 't' , 0 , G_OPTION_ARG_CALLBACK , command_cb ,
83
+ "Time to wait before declaring the operation "
84
+ "\n failed" ,
85
+ "TIMESPEC"
96
86
},
97
87
{ "bash-export" , 'B' , 0 , G_OPTION_ARG_NONE , & options .BASH_EXPORT ,
98
88
"Display nodes as shell commands of the form 'export uname=uuid'"
99
- "\n (valid with -N/--nodes)" ,
89
+ "\n (valid with -N/--nodes)" ,
100
90
},
101
91
{ "ipc-name" , 'i' , 0 , G_OPTION_ARG_STRING , & options .ipc_name ,
102
92
"Name to use for ipc instead of 'crmadmin' (with -P/--pacemakerd)." ,
103
- NULL
93
+ "NAME"
104
94
},
105
95
106
96
{ NULL }
@@ -126,13 +116,12 @@ command_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError
126
116
command = cmd_list_nodes ;
127
117
}
128
118
129
- if (!strcmp (option_name , "--election" ) || !strcmp (option_name , "-E" )) {
130
- command = cmd_elect_dc ;
131
- }
132
-
133
- if (!strcmp (option_name , "--kill" ) || !strcmp (option_name , "-K" )) {
134
- command = cmd_shutdown ;
135
- crm_trace ("Option %c => %s" , 'K' , optarg );
119
+ if (!strcmp (option_name , "--timeout" ) || !strcmp (option_name , "-t" )) {
120
+ options .timeout = crm_parse_interval_spec (optarg );
121
+ if (errno == EINVAL ) {
122
+ return FALSE;
123
+ }
124
+ return TRUE;
136
125
}
137
126
138
127
if (optarg ) {
@@ -155,7 +144,12 @@ static GOptionContext *
155
144
build_arg_context (pcmk__common_args_t * args , GOptionGroup * * group ) {
156
145
GOptionContext * context = NULL ;
157
146
158
- const char * description = "Report bugs to users@clusterlabs.org" ;
147
+ const char * description = "Notes:\n\n"
148
+ "Time Specification:\n\n"
149
+ "The TIMESPEC in any command line option can be specified in many different\n"
150
+ "formats. It can be just an integer number of seconds, a number plus units\n"
151
+ "(ms/msec/us/usec/s/sec/m/min/h/hr), or an ISO 8601 period specification.\n\n"
152
+ "Report bugs to users@clusterlabs.org" ;
159
153
160
154
GOptionEntry extra_prog_entries [] = {
161
155
{ "quiet" , 'q' , 0 , G_OPTION_ARG_NONE , & (args -> quiet ),
@@ -257,12 +251,6 @@ main(int argc, char **argv)
257
251
case cmd_whois_dc :
258
252
rc = pcmk__designated_controller (out , options .timeout );
259
253
break ;
260
- case cmd_shutdown :
261
- rc = pcmk__shutdown_controller (out , options .optarg );
262
- break ;
263
- case cmd_elect_dc :
264
- rc = pcmk__start_election (out );
265
- break ;
266
254
case cmd_none :
267
255
rc = pcmk_rc_error ;
268
256
break ;
0 commit comments