summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2009-06-08 10:49:25 -0500
committerDavid Teigland <teigland@redhat.com>2009-06-08 10:49:25 -0500
commit5ec1391ac616458db01fae1188fdbc1ba130cabc (patch)
tree1eada5596a72eb9ad47a76f12b4a798c38634d43
parent162ad93715eb6b268bb1c8832559f95b654acc27 (diff)
downloaddct-stuff-5ec1391ac616458db01fae1188fdbc1ba130cabc.tar.gz
dct-stuff-5ec1391ac616458db01fae1188fdbc1ba130cabc.tar.xz
dct-stuff-5ec1391ac616458db01fae1188fdbc1ba130cabc.zip
cpgx: improve options
Signed-off-by: David Teigland <teigland@redhat.com>
-rw-r--r--cpgx/cpgx.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/cpgx/cpgx.c b/cpgx/cpgx.c
index 398c715..c2555ad 100644
--- a/cpgx/cpgx.c
+++ b/cpgx/cpgx.c
@@ -53,6 +53,9 @@ static char *exec_name = "corosync";
#define DUMP_SIZE (1024 * 1024)
#define HISTORY_EVENTS (1024 * 1024)
#define DEFAULT_SYNC_MAX 2000 /* sync up to this many events */
+#define DEFAULT_TIMEOUT_SEC 60
+#define DEFAULT_PORT 5405
+#define DEFAULT_RESTART_SEC 10
#define DUMP_WRITE_PATH "/var/log/cluster/cpgx_debug.txt"
#define LEAVE_TIME_MAX 10 /* leave or exit up to this long after join*/
@@ -137,7 +140,7 @@ static int dct_cpg_fd;
static char iptables_a[128];
static char iptables_d[128];
static char exec_addr[64];
-static int exec_port = 5405;
+static int exec_port = DEFAULT_PORT;
static int exec_join = 0;
static int prog_quit;
static int cluster_down;
@@ -145,7 +148,8 @@ static int opt_leave = 1;
static int opt_exit = 1;
static int opt_die = 0;
static int iterations_sec = 0;
-static int timeout_sec = 0;
+static int timeout_sec = DEFAULT_TIMEOUT_SEC;
+static int restart_sec = DEFAULT_RESTART_SEC;
static int run_iptables = 0;
static int continue_after_error = 0;
static int opt_print_event = 1;
@@ -1511,7 +1515,7 @@ void restart_cluster(void)
/* others should see us fail before we rejoin, not sure 10s will
be enough for some people */
- sleep(10);
+ sleep(restart_sec);
system(iptables_d);
@@ -1652,17 +1656,19 @@ void print_usage(void)
printf(" (program kills and restarts %s)\n", exec_name);
printf(" -s <num> sync up to num events, default %d\n",
DEFAULT_SYNC_MAX);
- printf(" -t <sec> timeout after no dispatch for this many seconds, default 0 (never)\n");
+ printf(" -t <sec> timeout after no dispatch for this many seconds, default %d\n", DEFAULT_TIMEOUT_SEC);
+ printf(" (0 to wait forever)\n");
printf(" -i <sec> run for this many seconds, default 0 (forever)\n");
- printf(" -j join cluster by running \"%s\", not cman_tool\n", exec_name);
- printf(" (used by -d restart after killing %s\n", exec_name);
- printf(" -a <addr> IP address used for %s communication\n", exec_name);
- printf(" (implies that iptables should be used with -d)\n");
- printf(" -p <port> udp port used for %s communication\n", exec_name);
- printf(" -I [A|D] run iptables Append or Delete to block/unblock %s communication\n", exec_name);
- printf(" (use with -a and optionally -p)\n");
printf(" -c continue after error\n");
printf(" -V print version\n");
+ printf(" die options, used with -d1:\n");
+ printf(" -j restart cluster by running \"%s\", not cman_tool\n", exec_name);
+ printf(" -w <sec> wait this many seconds between kill and restart, default %d\n", DEFAULT_RESTART_SEC);
+ printf(" -a <addr> IP address used for %s communication\n", exec_name);
+ printf(" iptables blocks <addr> before kill, unblocks before restart\n");
+ printf(" -p <port> udp port used for %s communication, default %d\n", exec_name, DEFAULT_PORT);
+ printf(" -I [A|D] run iptables Append or Delete to block/unblock %s comms\n", exec_name);
+ printf(" (utility, not used by test, use with -a, optionally -p)\n");
printf("\n");
printf("Output:\n");
printf(" <time> ERROR: <error string> (stderr)\n");