From 8a7dfb0d4b856578e89898c2bb84a0a675ade50b Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Fri, 5 Jun 2015 13:58:28 +0530 Subject: 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 signing-time Change-Id: I89f3121564c1bbd0825f60aae6147413a2fbd798 BUG: 1231832 Signed-off-by: Gaurav Kumar Garg Signed-off-by: Venky Shankar Reviewed-on: http://review.gluster.org/11105 (cherry picked from commit 554fa0c1315d0b4b78ba35a2d332d7ac0fd07d48) Reviewed-on: http://review.gluster.org/11235 Tested-by: Gluster Build System --- cli/src/cli-cmd-parser.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'cli/src/cli-cmd-parser.c') diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 917be5337cd..36f64dd1cb5 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -4999,8 +4999,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", @@ -5011,6 +5011,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); @@ -5020,7 +5021,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; } @@ -5148,6 +5149,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]); -- cgit