diff options
author | Susant Palai <spalai@redhat.com> | 2017-06-21 17:52:45 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-06-26 10:47:00 +0000 |
commit | 4700c5be55b0e567755b4c8a1a91f33d29c06e6b (patch) | |
tree | c0f85caba100c9f9d46dd61f3cdd96c407a19d5a /xlators/cluster/dht/src/dht-common.c | |
parent | d66fb14a952729caf51c8328448a548c4d198082 (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
Change-Id: I4d602feda2a05b29d2210c712a07a4ac6b8bc112
BUG: 1463648
Signed-off-by: Susant Palai <spalai@redhat.com>
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://review.gluster.org/17595
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
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.c | 31 |
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 272a639aee6..8c6df4a811a 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++) { |