summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2020-03-19 15:07:47 +0530
committerKshithij Iyer <kiyer@redhat.com>2020-03-19 10:11:59 +0000
commit2e567185989009ef0543b38282659c39ca8940f6 (patch)
tree18c9ddff92c10f5502eabe83312d21ec222976e4 /glustolibs-gluster/glustolibs/gluster
parent36418ed2d794ad34dd80d85dbaacac8bcab2cd20 (diff)
[Test+libfix] Add testcase to access of file
Testcase steps: (file access) - rename the file so that the hashed and cached are different - make sure file can be accessed as long as cached is up Fixes a library issue as well in find_new_hashed() Change-Id: Id81264848d6470b9fe477b50290f5ecf917ceda3 Co-authored-by: Susant Palai <spalai@redhat.com> Signed-off-by: Susant Palai <spalai@redhat.com> Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/dht_test_utils.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/dht_test_utils.py b/glustolibs-gluster/glustolibs/gluster/dht_test_utils.py
index 1a62ab2..8cef301 100644
--- a/glustolibs-gluster/glustolibs/gluster/dht_test_utils.py
+++ b/glustolibs-gluster/glustolibs/gluster/dht_test_utils.py
@@ -297,11 +297,22 @@ def find_new_hashed(subvols, parent_path, oldname):
g.log.error("could not form brickobject list")
return None
+ for bro in brickobject:
+ bro._get_hashrange()
+ low = bro._hashrange_low
+ high = bro._hashrange_high
+ g.log.debug("low hashrange %s high hashrange %s", str(low), str(high))
+ g.log.debug("absoulte path %s", bro._fqpath)
+
+ hash_num = calculate_hash(brickobject[0]._host, oldname)
oldhashed, _ = find_hashed_subvol(subvols, parent_path, oldname)
if oldhashed is None:
g.log.error("could not find old hashed subvol")
return None
+ g.log.debug("oldhashed: %s oldname: %s oldhash %s", oldhashed._host,
+ oldname, hash_num)
+
count = -1
for item in range(1, 5000, 1):
newhash = calculate_hash(brickobject[0]._host, str(item))
@@ -309,9 +320,10 @@ def find_new_hashed(subvols, parent_path, oldname):
count += 1
ret = brickdir.hashrange_contains_hash(newhash)
if ret == 1:
- g.log.debug("oldhashed %s new %s count %s",
- oldhashed, brickdir._host, str(count))
- return NewHashed(item, brickdir, count)
+ if oldhashed._fqpath != brickdir._fqpath:
+ g.log.debug("oldhashed %s new %s count %s",
+ oldhashed, brickdir._host, str(count))
+ return NewHashed(item, brickdir, count)
count = -1
return None