diff options
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 692bd26e969..8a446595e79 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -13,6 +13,7 @@ #include <stdint.h> #include <pthread.h> #include <fnmatch.h> +#include <time.h> #include "cli.h" #include "cli-cmd.h" @@ -2366,6 +2367,9 @@ config_parse (const char **words, int wordcount, dict_t *dict, char *append_str = NULL; size_t append_len = 0; char *subop = NULL; + char *ret_chkpt = NULL; + struct tm checkpoint_time; + char chkpt_buf[20] = ""; switch ((wordcount - 1) - cmdi) { case 0: @@ -2427,6 +2431,27 @@ config_parse (const char **words, int wordcount, dict_t *dict, } snprintf (append_str, 300, "%" GF_PRI_SECOND, tv.tv_sec); + } else if ((strcmp (words[cmdi + 1], "checkpoint") == 0) && + (strcmp (append_str, "now") != 0)) { + memset(&checkpoint_time, 0, sizeof(struct tm)); + ret_chkpt = strptime(append_str, "%Y-%m-%d %H:%M:%S", + &checkpoint_time); + + if (ret_chkpt == NULL) { + ret = -1; + cli_err ("Invalid Checkpoint label. Use format " + "\"Y-m-d H:M:S\", Example: 2016-10-25 15:30:45"); + goto out; + } + GF_FREE (append_str); + append_str = GF_CALLOC (1, 300, cli_mt_append_str); + if (!append_str) { + ret = -1; + goto out; + } + strftime (chkpt_buf, sizeof(chkpt_buf), "%s", + &checkpoint_time); + snprintf (append_str, 300, "%s", chkpt_buf); } ret = dict_set_dynstr (dict, "op_value", append_str); @@ -3586,7 +3611,8 @@ cli_cmd_volume_heal_options_parse (const char **words, int wordcount, if (wordcount == 5) { if (strcmp (words[3], "info") && - strcmp (words[3], "statistics")) { + strcmp (words[3], "statistics") && + strcmp (words[3], "granular-entry-heal")) { ret = -1; goto out; } @@ -3616,6 +3642,19 @@ cli_cmd_volume_heal_options_parse (const char **words, int wordcount, goto done; } } + + if (!strcmp (words[3], "granular-entry-heal")) { + if (!strcmp (words[4], "enable")) { + ret = dict_set_int32 (dict, "heal-op", + GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE); + goto done; + } else if (!strcmp (words[4], "disable")) { + ret = dict_set_int32 (dict, "heal-op", + GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE); + goto done; + } + } + ret = -1; goto out; } |