diff options
author | Gaurav Kumar Garg <ggarg@redhat.com> | 2015-06-05 13:58:28 +0530 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2015-06-15 05:23:46 -0700 |
commit | 554fa0c1315d0b4b78ba35a2d332d7ac0fd07d48 (patch) | |
tree | 2b56e439a5547fe27e6f33b9bffb5dd24ba38654 /cli | |
parent | 3fb18451311c34aeced1054472b6f81fc13dd679 (diff) |
features/bitrot: tuanble object signing waiting time value for bitrot
Currently bitrot using 120 second waiting time for object to be signed
after all fop's released. This signing waiting time value should be tunable.
Command for changing the signing waiting time will be
#gluster volume bitrot <VOLNAME> signing-time <waiting time value in second>
Change-Id: I89f3121564c1bbd0825f60aae6147413a2fbd798
BUG: 1228680
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/11105
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index f3dd58528b6..2f7885b80eb 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -4994,8 +4994,8 @@ cli_cmd_bitrot_parse (const char **words, int wordcount, dict_t **options) char *volname = NULL; char *opwords[] = {"enable", "disable", "scrub-throttle", - "scrub-frequency", - "scrub", NULL}; + "scrub-frequency", "scrub", + "signing-time", NULL}; char *scrub_throt_values[] = {"lazy", "normal", "aggressive", NULL}; char *scrub_freq_values[] = {"hourly", @@ -5006,6 +5006,7 @@ cli_cmd_bitrot_parse (const char **words, int wordcount, dict_t **options) NULL}; dict_t *dict = NULL; gf_bitrot_type type = GF_BITROT_OPTION_TYPE_NONE; + int32_t expiry_time = 0; GF_ASSERT (words); GF_ASSERT (options); @@ -5015,7 +5016,7 @@ cli_cmd_bitrot_parse (const char **words, int wordcount, dict_t **options) goto out; if (wordcount < 4 || wordcount > 5) { - gf_log ("", GF_LOG_ERROR, "Invalid syntax"); + gf_log ("cli", GF_LOG_ERROR, "Invalid syntax"); goto out; } @@ -5143,6 +5144,33 @@ cli_cmd_bitrot_parse (const char **words, int wordcount, dict_t **options) goto set_type; } } + } + + if (!strcmp (words[3], "signing-time")) { + if (!words[4]) { + cli_err ("Missing signing-time value for bitrot " + "option"); + ret = -1; + goto out; + } else { + type = GF_BITROT_OPTION_TYPE_EXPIRY_TIME; + + expiry_time = strtol (words[4], NULL, 0); + if (expiry_time < 1) { + cli_err ("Expiry time value should not be less" + " than 1"); + ret = -1; + goto out; + } + + ret = dict_set_uint32 (dict, "expiry-time", + (unsigned int) expiry_time); + if (ret) { + cli_out ("Failed to set dict for bitrot"); + goto out; + } + goto set_type; + } } else { cli_err ("Invalid option %s for bitrot. Please enter valid " "bitrot option", words[3]); |