summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.c
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2017-06-21 17:52:45 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-06-26 16:27:07 +0000
commitf67dbab74a3d0a13a8f7ed31b8cc840c05042913 (patch)
tree5e859d63d2b5b9b26a182e6ef8c9d08f8126ab19 /xlators/cluster/dht/src/dht-common.c
parent91c44b41654ae10a2278ee8c494910a46196077a (diff)
cluster/rebalance: Use GF_XATTR_LIST_NODE_UUIDS_KEY to figure out local subvols.
Afr has introduced a new key GF_XATTR_LIST_NODE_UUIDS_KEY, through which rebalance will figure out its local subvolumes.(Reference bugid=1463250) key: GF_XATTR_NODE_UUID_KEY will continue to serve it's old purpose of returning the first afr chiild. test: prove tests/basic/distribute/rebal-all-nodes-migrate.t > BUG: 1463648 > Signed-off-by: Susant Palai <spalai@redhat.com> Change-Id: I4d602feda2a05b29d2210c712a07a4ac6b8bc112 BUG: 1463250 Signed-off-by: N Balachandran <nbalacha@redhat.com> Reviewed-on: https://review.gluster.org/17627 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r--xlators/cluster/dht/src/dht-common.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index cb63d0ad13b..87cd55d216c 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -2982,7 +2982,8 @@ dht_vgetxattr_fill_and_set (dht_local_t *local, dict_t **dict, xlator_t *this,
(void) dht_fill_pathinfo_xattr (this, local, xattr_buf,
local->alloc_len, flag,
layout_buf);
- } else if (XATTR_IS_NODE_UUID (local->xsel)) {
+ } else if ((XATTR_IS_NODE_UUID (local->xsel))
+ || (XATTR_IS_NODE_UUID_LIST (local->xsel))) {
(void) snprintf (xattr_buf, local->alloc_len, "%s",
local->xattr_val);
} else {
@@ -3574,6 +3575,31 @@ dht_getxattr (call_frame_t *frame, xlator_t *this,
if (key && DHT_IS_DIR(layout) &&
(!strcmp (key, GF_REBAL_FIND_LOCAL_SUBVOL))) {
ret = gf_asprintf
+ (&node_uuid_key, "%s", GF_XATTR_LIST_NODE_UUIDS_KEY);
+ if (ret == -1 || !node_uuid_key) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_NO_MEMORY,
+ "Failed to copy key");
+ op_errno = ENOMEM;
+ goto err;
+ }
+ (void) strncpy (local->xsel, node_uuid_key, 256);
+ cnt = local->call_cnt = conf->subvolume_cnt;
+ for (i = 0; i < cnt; i++) {
+ STACK_WIND_COOKIE (frame, dht_find_local_subvol_cbk,
+ conf->subvolumes[i],
+ conf->subvolumes[i],
+ conf->subvolumes[i]->fops->getxattr,
+ loc, node_uuid_key, xdata);
+ }
+ if (node_uuid_key)
+ GF_FREE (node_uuid_key);
+ return 0;
+ }
+
+ if (key && DHT_IS_DIR(layout) &&
+ (!strcmp (key, GF_REBAL_OLD_FIND_LOCAL_SUBVOL))) {
+ ret = gf_asprintf
(&node_uuid_key, "%s", GF_XATTR_NODE_UUID_KEY);
if (ret == -1 || !node_uuid_key) {
gf_msg (this->name, GF_LOG_ERROR, 0,
@@ -3608,7 +3634,8 @@ dht_getxattr (call_frame_t *frame, xlator_t *this,
if (key && DHT_IS_DIR(layout) &&
(XATTR_IS_PATHINFO (key)
- || (strcmp (key, GF_XATTR_NODE_UUID_KEY) == 0))) {
+ || (strcmp (key, GF_XATTR_NODE_UUID_KEY) == 0)
+ || (strcmp (key, GF_XATTR_LIST_NODE_UUIDS_KEY) == 0))) {
(void) strncpy (local->xsel, key, 256);
cnt = local->call_cnt = layout->cnt;
for (i = 0; i < cnt; i++) {