2525
2626static enum {
2727 cmd_none ,
28- cmd_shutdown ,
2928 cmd_health ,
30- cmd_elect_dc ,
3129 cmd_whois_dc ,
3230 cmd_list_nodes ,
3331 cmd_pacemakerd_health ,
@@ -50,36 +48,28 @@ gboolean command_cb(const gchar *option_name, const gchar *optarg, gpointer data
5048static GOptionEntry command_options [] = {
5149 { "status" , 'S' , 0 , G_OPTION_ARG_CALLBACK , command_cb ,
5250 "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"
5654 },
5755 { "pacemakerd" , 'P' , G_OPTION_FLAG_NO_ARG , G_OPTION_ARG_CALLBACK , command_cb ,
5856 "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." ,
6159 NULL
6260 },
6361 { "dc_lookup" , 'D' , G_OPTION_FLAG_NO_ARG , G_OPTION_ARG_CALLBACK , command_cb ,
6462 "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." ,
6866 NULL
6967 },
7068 { "nodes" , 'N' , G_OPTION_FLAG_OPTIONAL_ARG , G_OPTION_ARG_CALLBACK , command_cb ,
7169 "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" ,
7371 "TYPE"
7472 },
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- },
8373 { "health" , 'H' , G_OPTION_FLAG_HIDDEN , G_OPTION_ARG_NONE , & options .health ,
8474 NULL ,
8575 NULL
@@ -89,18 +79,18 @@ static GOptionEntry command_options[] = {
8979};
9080
9181static 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"
9686 },
9787 { "bash-export" , 'B' , 0 , G_OPTION_ARG_NONE , & options .BASH_EXPORT ,
9888 "Display nodes as shell commands of the form 'export uname=uuid'"
99- "\n (valid with -N/--nodes)" ,
89+ "\n (valid with -N/--nodes)" ,
10090 },
10191 { "ipc-name" , 'i' , 0 , G_OPTION_ARG_STRING , & options .ipc_name ,
10292 "Name to use for ipc instead of 'crmadmin' (with -P/--pacemakerd)." ,
103- NULL
93+ "NAME"
10494 },
10595
10696 { NULL }
@@ -126,13 +116,12 @@ command_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError
126116 command = cmd_list_nodes ;
127117 }
128118
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;
136125 }
137126
138127 if (optarg ) {
@@ -155,7 +144,12 @@ static GOptionContext *
155144build_arg_context (pcmk__common_args_t * args , GOptionGroup * * group ) {
156145 GOptionContext * context = NULL ;
157146
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" ;
159153
160154 GOptionEntry extra_prog_entries [] = {
161155 { "quiet" , 'q' , 0 , G_OPTION_ARG_NONE , & (args -> quiet ),
@@ -257,12 +251,6 @@ main(int argc, char **argv)
257251 case cmd_whois_dc :
258252 rc = pcmk__designated_controller (out , options .timeout );
259253 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 ;
266254 case cmd_none :
267255 rc = pcmk_rc_error ;
268256 break ;
0 commit comments