From 24ee79345fc7346ef78b8adf54008ae77524026b Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Thu, 21 Feb 2013 22:10:27 +0530 Subject: storage/posix: introduce node-uuid-pathinfo enabling this option has an effect on pathinfo xattr request returning : instead of the default - which is :. Change-Id: Ice1b38abf8e5df1568bab6d79ec0d53dfa520332 BUG: 765380 Signed-off-by: Venky Shankar Reviewed-on: http://review.gluster.org/4567 Reviewed-by: Amar Tumballi Reviewed-by: Jeff Darcy Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/storage/posix/src/posix.c | 34 ++++++++++++++++++++++++++++++++-- xlators/storage/posix/src/posix.h | 3 +++ 2 files changed, 35 insertions(+), 2 deletions(-) (limited to 'xlators/storage') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index cd01a1137..5e014f8e9 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -2519,8 +2519,13 @@ posix_getxattr (call_frame_t *frame, xlator_t *this, else rpath = real_path; - (void) snprintf (host_buf, 1024, "", - priv->base_path, priv->hostname, rpath); + (void) snprintf (host_buf, 1024, + "", priv->base_path, + ((priv->node_uuid_pathinfo + && !uuid_is_null(priv->glusterd_uuid)) + ? uuid_utoa (priv->glusterd_uuid) + : priv->hostname), + rpath); dyn_rpath = gf_strdup (host_buf); if (!dyn_rpath) { @@ -4138,6 +4143,16 @@ reconfigure (xlator_t *this, dict_t *options) else posix_aio_off (this); + GF_OPTION_RECONF ("node-uuid-pathinfo", priv->node_uuid_pathinfo, + options, bool, out); + + if (priv->node_uuid_pathinfo && + (uuid_is_null (priv->glusterd_uuid))) { + gf_log (this->name, GF_LOG_INFO, + "glusterd uuid is NULL, pathinfo xattr would" + " fallback to :"); + } + ret = 0; out: return ret; @@ -4499,6 +4514,15 @@ init (xlator_t *this) } } + GF_OPTION_INIT ("node-uuid-pathinfo", + _private->node_uuid_pathinfo, bool, out); + if (_private->node_uuid_pathinfo && + (uuid_is_null (_private->glusterd_uuid))) { + gf_log (this->name, GF_LOG_INFO, + "glusterd uuid is NULL, pathinfo xattr would" + " fallback to :"); + } + pthread_mutex_init (&_private->janitor_lock, NULL); pthread_cond_init (&_private->janitor_cond, NULL); INIT_LIST_HEAD (&_private->janitor_fds); @@ -4616,5 +4640,11 @@ struct volume_options options[] = { .validate = GF_OPT_VALIDATE_MIN, .description = "Support for setting gid of brick's owner" }, + { .key = {"node-uuid-pathinfo"}, + .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", + .description = "return glusterd's node-uuid in pathinfo xattr" + " string instead of hostname" + }, { .key = {NULL} } }; diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h index 696422f64..2cee1905f 100644 --- a/xlators/storage/posix/src/posix.h +++ b/xlators/storage/posix/src/posix.h @@ -124,6 +124,9 @@ struct posix_private { io_context_t ctxp; pthread_t aiothread; #endif + + /* node-uuid in pathinfo xattr */ + gf_boolean_t node_uuid_pathinfo; }; typedef struct { -- cgit