summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.c
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2014-12-16 10:28:57 -0500
committerShyamsundar Ranganathan <srangana@redhat.com>2015-02-13 07:19:46 -0800
commit04c4ec96b88ee6392812a511de32b48bbe63a421 (patch)
tree09ff8b662663bd99fb38cfd44b5b564bbfc5ec8e /xlators/cluster/dht/src/dht-common.c
parent47f6f41f1204d0a1fd3cb699919c757d3238fdf3 (diff)
cluster/dht: Modify dht-rebalance.c to use trusted.distribute.migrate-data
rather than distribute.migrate-data and work with CLI. The change makes this work both when it is internally driven and from the shell. The problem is further described in bugzilla # 1147107. Change-Id: I4fe04cae661dca25432530ddf5ac6ff2c957d6b3 BUG: 1147107 Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/9284 Reviewed-by: N Balachandran <nbalacha@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.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.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 0ab3b200f27..d396c2ee4ab 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -3164,8 +3164,9 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
local->call_cnt = call_cnt = layout->cnt;
- tmp = dict_get (xattr, "distribute.migrate-data");
+ tmp = dict_get (xattr, GF_XATTR_FILE_MIGRATE_KEY);
if (tmp) {
+
if (IA_ISDIR (loc->inode->ia_type)) {
op_errno = ENOTSUP;
goto err;
@@ -3181,7 +3182,25 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
if (conf->decommission_in_progress)
forced_rebalance = GF_DHT_MIGRATE_HARDLINK;
- local->rebalance.target_node = dht_subvol_get_hashed (this, loc);
+ if (!loc->path) {
+ op_errno = EINVAL;
+ goto err;
+ }
+
+ if (!local->loc.name)
+ local->loc.name = strrchr (local->loc.path, '/')+1;
+
+ if (!local->loc.parent)
+ local->loc.parent =
+ inode_parent(local->loc.inode, NULL, NULL);
+
+ if ((!local->loc.name) || (!local->loc.parent)) {
+ op_errno = EINVAL;
+ goto err;
+ }
+
+ local->rebalance.target_node =
+ dht_subvol_get_hashed (this, &local->loc);
if (!local->rebalance.target_node) {
gf_msg (this->name, GF_LOG_ERROR, 0,
DHT_MSG_HASHED_SUBVOL_GET_FAILED,