summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorGaurav Kumar Garg <ggarg@redhat.com>2015-06-05 13:58:28 +0530
committerVenky Shankar <vshankar@redhat.com>2015-06-17 09:38:59 -0700
commit8a7dfb0d4b856578e89898c2bb84a0a675ade50b (patch)
treef232c1cb343c7cb5fa547162161508cd78604bd2 /cli
parent08e404e9d397004ad24f3734862632fbeb66f2b0 (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: 1231832 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/11105 (cherry picked from commit 554fa0c1315d0b4b78ba35a2d332d7ac0fd07d48) Reviewed-on: http://review.gluster.org/11235 Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c34
1 files changed, 31 insertions, 3 deletions
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]);