[Sheepdog] [PATCH 2/4] sheep: transient failure - parameter changes
yaohaiting.wujue at gmail.com
yaohaiting.wujue at gmail.com
Tue Mar 6 11:51:58 CET 2012
From: HaiTing Yao <wujue.yht at taobao.com>
Add one parameter, user can specify the time one node leave then join
again.
-t, --templeft specify the time(in seconds) node can leave then
join again
If do not use this parameter, the sheep works without transient failure
detection as before
Signed-off-by: HaiTing Yao <wujue.yht at taobao.com>
---
sheep/sheep.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/sheep/sheep.c b/sheep/sheep.c
index b3b834b..63c53be 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -38,11 +38,12 @@ static struct option const long_options[] = {
{"zone", required_argument, NULL, 'z'},
{"vnodes", required_argument, NULL, 'v'},
{"cluster", required_argument, NULL, 'c'},
+ {"templeft", required_argument, NULL, 't'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0},
};
-static const char *short_options = "p:fl:dDz:v:c:h";
+static const char *short_options = "p:fl:dDz:v:c:t:h";
static void usage(int status)
{
@@ -62,6 +63,7 @@ Options:\n\
-z, --zone specify the zone id\n\
-v, --vnodes specify the number of virtual nodes\n\
-c, --cluster specify the cluster driver\n\
+ -t, --templeft specify the time(in seconds) node can leave then join again\n\
-h, --help display this help and exit\n\
", PACKAGE_VERSION, program_name);
exit(status);
@@ -98,6 +100,8 @@ int main(int argc, char **argv)
char *p;
struct cluster_driver *cdrv;
+ memset(sys, 0, sizeof(struct cluster_info));
+
signal(SIGPIPE, SIG_IGN);
while ((ch = getopt_long(argc, argv, short_options, long_options,
@@ -165,6 +169,9 @@ int main(int argc, char **argv)
sys->cdrv_option = get_cdrv_option(sys->cdrv, optarg);
break;
+ case 't':
+ sys->templeft_time = atoi(optarg);
+ break;
case 'h':
usage(0);
break;
--
1.7.1
More information about the sheepdog
mailing list