diff options
| author | Amar Tumballi <amar@gluster.com> | 2010-08-31 07:51:14 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-08-31 10:49:40 -0700 | 
| commit | 6530488a49ed0c9395b091c42b148091075a9d86 (patch) | |
| tree | 18c85cb3bfa4fc0f0dce0aef27bf6af1ade19af9 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
| parent | da5bf7cf104cd060b2f94d47132029689bfff685 (diff) | |
'gluster volume log' feature added
* 'gluster volume log filename <VOLNAME> [BRICK] <path>'
* 'gluster volume log locate <VOLNAME> [BRICK]'
* 'gluster volume log rotate <VOLUME> [BRICK]'
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 23 | 
1 files changed, 15 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 024f5e5fa1f..1866a9904ec 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -765,8 +765,8 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t  *volinfo,          char                    cmd_str[8192] = {0,};          char                    rundir[PATH_MAX] = {0,};          char                    exp_path[PATH_MAX] = {0,}; +        char                    logfile[PATH_MAX] = {0,};          int                     port = 0; -        int                     i = 0;          GF_ASSERT (volinfo);          GF_ASSERT (brickinfo); @@ -792,19 +792,23 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t  *volinfo,          GLUSTERD_GET_BRICK_PIDFILE (pidfile, path, brickinfo->hostname,                                      brickinfo->path); -        for (i = 1; i < strlen (brickinfo->path); i++) { -                exp_path[i-1] = brickinfo->path[i]; -                if (exp_path[i-1] == '/') -                        exp_path[i-1] = '-'; -        } + +        GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, exp_path);          snprintf (volfile, PATH_MAX, "%s.%s.%s", volinfo->volname,                    brickinfo->hostname, exp_path); +        if (!brickinfo->logfile) { +                snprintf (logfile, PATH_MAX, "%s/logs/%s.log", +                          priv->workdir, exp_path); +                brickinfo->logfile = gf_strdup (logfile); +        } +          snprintf (cmd_str, 8192,                    "%s/sbin/glusterfs --xlator-option %s-server.listen-port=%d "                    "-s localhost --volfile-id %s -p %s --brick-name %s " -                  "--brick-port %d", GFS_PREFIX, volinfo->volname, -                  port, volfile, pidfile, brickinfo->path, port); +                  "--brick-port %d -l %s", GFS_PREFIX, volinfo->volname, +                  port, volfile, pidfile, brickinfo->path, port, +                  brickinfo->logfile);          ret = gf_system (cmd_str);          if (ret == 0) { @@ -957,6 +961,9 @@ glusterd_is_cli_op_req (int32_t op)                  case GD_MGMT_CLI_DEFRAG_VOLUME:                  case GD_MGMT_CLI_ADD_BRICK:                  case GD_MGMT_CLI_REMOVE_BRICK: +                case GD_MGMT_CLI_LOG_FILENAME: +                case GD_MGMT_CLI_LOG_LOCATE: +                case GD_MGMT_CLI_LOG_ROTATE:                          return _gf_true;                          break;          }  | 
