summaryrefslogtreecommitdiffstats
path: root/heal/src
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-01-03 14:44:01 +0530
committerVijay Bellur <vbellur@redhat.com>2014-04-28 09:44:19 -0700
commit26843b00447cc14427b4f02ca136033b56ca093f (patch)
tree57ed6cc0b4fc3bbbad34ed427a88880760ff38b2 /heal/src
parent07ed48398e41df1b65202f3d2e0be6f2c3ca8ceb (diff)
heal: Enable logging for glfsheal.
logs will be written to <log-dir>/glfsheal-<volname>.log Moved some non-essential frequent logs to DEBUG. BUG: 1039544 Change-Id: I2aceda6e3092f8c5052e7a4b8b5dec3cdeebd9a9 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/7481 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'heal/src')
-rw-r--r--heal/src/glfs-heal.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
index 9e2be12ab4c..f198cbee00e 100644
--- a/heal/src/glfs-heal.c
+++ b/heal/src/glfs-heal.c
@@ -18,6 +18,8 @@
#include <string.h>
#include <time.h>
+#define DEFAULT_HEAL_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs"
+
int
glfsh_link_inode_update_loc (loc_t *loc, struct iatt *iattr)
{
@@ -212,8 +214,7 @@ glfsh_process_entries (xlator_t *xl, loc_t *parentloc, gf_dirent_t *entries,
goto out;
uuid_parse (entry->d_name, entry_loc.gfid);
- //TODO: put gfid-path
- glfs_loc_touchup (&entry_loc);
+ entry_loc.path = gf_strdup (uuid_utoa (entry_loc.gfid));
ret = syncop_lookup (xl->parents->xlator, &entry_loc, xattr_req,
&iattr, &xattr_rsp, &parent);
if (ret < 0)
@@ -407,6 +408,7 @@ main (int argc, char **argv)
xlator_t *top_subvol = NULL;
xlator_t *xl = NULL;
loc_t rootloc = {0};
+ char logfilepath[PATH_MAX];
if (argc != 2) {
printf ("Usage: %s <volname>\n", argv[0]);
@@ -423,6 +425,15 @@ main (int argc, char **argv)
}
ret = glfs_set_volfile_server (fs, "tcp", "localhost", 24007);
+ snprintf (logfilepath, sizeof (logfilepath),
+ DEFAULT_HEAL_LOG_FILE_DIRECTORY"/glfsheal-%s.log", volname);
+ ret = glfs_set_logging(fs, logfilepath, GF_LOG_INFO);
+ if (ret < 0) {
+ ret = -1;
+ printf ("Not able to initialize volume '%s'\n", volname);
+ goto out;
+ }
+
ret = glfs_init (fs);
if (ret < 0) {
@@ -473,16 +484,18 @@ main (int argc, char **argv)
}
loc_wipe (&rootloc);
- glfs_subvol_done (fs, top_subvol);
- glfs_fini (fs);
+ //Calling this sometimes gives log messages on stderr.
+ //There is no graceful way of disabling that at the moment,
+ //since this process dies anyway, ignoring cleanup for now.
+ //glfs_fini (fs);
return 0;
out:
if (fs && top_subvol)
glfs_subvol_done (fs, top_subvol);
loc_wipe (&rootloc);
- if (fs)
- glfs_fini (fs);
+ //if (fs)
+ // glfs_fini (fs);
return ret;
}