diff options
| author | Ravishankar N <ravishankar@redhat.com> | 2018-11-28 15:19:24 +0530 | 
|---|---|---|
| committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2018-11-29 15:30:11 +0000 | 
| commit | 70ae565c759cb019b73c7b4d6ac3650293984bc2 (patch) | |
| tree | 6030abec5c2f39c05f795867da0aa1fcf101754a /cli/src | |
| parent | 4c3cfd0f85c1044c804b2c31d99a4bc3b1c1fe49 (diff) | |
glfsheal: add a '--nolog' flag
....and if set, change the log level to GF_LOG_NONE. This is useful for
monitoring applications which invoke the heal info set of commands once
every minute, leading to un-necessary glfsheal* logs in
/var/log/glusterfs/. For example, we can now run
`gluster volume heal <VOLNAME> info --nolog`
`gluster volume heal <VOLNAME> info split-brain --nolog` etc.
The default log level is still retained at GF_LOG_INFO.
The patch also changes glfsheal internally to accept '--xml' instead of 'xml'.
Note: The --nolog flag is *not* displayed in the help anywhere, for the
sake of consistency in how the other flags are not displayed anywhere in
the help.
fixes: bz#1654229
Change-Id: Ia08b6aa6e4a0548379db7e313dd4411ebc66f206
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'cli/src')
| -rw-r--r-- | cli/src/cli-cmd-volume.c | 8 | ||||
| -rw-r--r-- | cli/src/cli.c | 5 | ||||
| -rw-r--r-- | cli/src/cli.h | 1 | 
3 files changed, 11 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index ee7e8f94c9e..22f02c7224e 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -2841,7 +2841,7 @@ cli_launch_glfs_heal (int heal_op, dict_t *options)          switch (heal_op) {          case GF_SHD_OP_INDEX_SUMMARY:                  if (global_state->mode & GLUSTER_MODE_XML) { -                        runner_add_args (&runner, "xml", NULL); +                        runner_add_args (&runner, "--xml", NULL);                  }                  break;          case GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE: @@ -2865,7 +2865,7 @@ cli_launch_glfs_heal (int heal_op, dict_t *options)          case GF_SHD_OP_SPLIT_BRAIN_FILES:                  runner_add_args (&runner, "split-brain-info", NULL);                  if (global_state->mode & GLUSTER_MODE_XML) { -                        runner_add_args (&runner, "xml", NULL); +                        runner_add_args (&runner, "--xml", NULL);                  }                  break;          case GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE: @@ -2875,13 +2875,15 @@ cli_launch_glfs_heal (int heal_op, dict_t *options)          case GF_SHD_OP_HEAL_SUMMARY:                  runner_add_args (&runner, "info-summary", NULL);                  if (global_state->mode & GLUSTER_MODE_XML) { -                        runner_add_args (&runner, "xml", NULL); +                        runner_add_args (&runner, "--xml", NULL);                  }                  break;          default:                  ret = -1;                  goto out;          } +        if (global_state->mode & GLUSTER_MODE_GLFSHEAL_NOLOG) +                runner_add_args(&runner, "--nolog", NULL);          ret = runner_start (&runner);          if (ret == -1)                  goto out; diff --git a/cli/src/cli.c b/cli/src/cli.c index b58f211d3dd..dd49198feed 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -347,6 +347,11 @@ cli_opt_parse (char *opt, struct cli_state *state)                  return 0;          } +        if (strcmp(opt, "nolog") == 0) { +                state->mode |= GLUSTER_MODE_GLFSHEAL_NOLOG; +                return 0; +        } +          if (strcmp (opt, "wignore-partition") == 0) {                  state->mode |= GLUSTER_MODE_WIGNORE_PARTITION;                  return 0; diff --git a/cli/src/cli.h b/cli/src/cli.h index 3421d6911fb..6ce6f002221 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -61,6 +61,7 @@ typedef enum {  #define GLUSTER_MODE_XML                (1 << 2)  #define GLUSTER_MODE_WIGNORE            (1 << 3)  #define GLUSTER_MODE_WIGNORE_PARTITION  (1 << 4) +#define GLUSTER_MODE_GLFSHEAL_NOLOG     (1 << 5)  #define GLUSTERD_GET_QUOTA_LIST_MOUNT_PATH(abspath, volname, path) do {       \  | 
