summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xglustolibs-gluster/glustolibs/gluster/glusterfile.py8
-rw-r--r--tests/functional/dht/test_dht_custom_xattr.py17
-rw-r--r--tests/functional/dht/test_directory_custom_extended_attributes.py21
3 files changed, 27 insertions, 19 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/glusterfile.py b/glustolibs-gluster/glustolibs/gluster/glusterfile.py
index 86383e800..227ef6f8d 100755
--- a/glustolibs-gluster/glustolibs/gluster/glusterfile.py
+++ b/glustolibs-gluster/glustolibs/gluster/glusterfile.py
@@ -116,7 +116,7 @@ def get_fattr(host, fqpath, fattr, encode="hex"):
(encode, fattr, fqpath))
rcode, rout, rerr = g.run(host, command)
if not rcode:
- return rout.strip().split('=')[1]
+ return rout.strip().split('=')[1].replace('"', '')
g.log.error('getfattr failed: %s' % rerr)
return None
@@ -400,7 +400,8 @@ def get_pathinfo(host, fqpath):
A dictionary of pathinfo data for a remote file. None on fail.
"""
pathinfo = {}
- pathinfo['raw'] = get_fattr(host, fqpath, 'trusted.glusterfs.pathinfo')
+ pathinfo['raw'] = get_fattr(host, fqpath, 'trusted.glusterfs.pathinfo',
+ encode="text")
pathinfo['brickdir_paths'] = re.findall(r".*?POSIX.*?:(\S+)\>",
pathinfo['raw'])
@@ -444,7 +445,8 @@ def get_dht_linkto_xattr(host, fqpath):
Returns:
Return value of get_fattr trusted.glusterfs.dht.linkto call.
"""
- linkto_xattr = get_fattr(host, fqpath, 'trusted.glusterfs.dht.linkto')
+ linkto_xattr = get_fattr(host, fqpath, 'trusted.glusterfs.dht.linkto',
+ encode="text")
return linkto_xattr
diff --git a/tests/functional/dht/test_dht_custom_xattr.py b/tests/functional/dht/test_dht_custom_xattr.py
index a0a17958b..fa2ad8cdb 100644
--- a/tests/functional/dht/test_dht_custom_xattr.py
+++ b/tests/functional/dht/test_dht_custom_xattr.py
@@ -44,7 +44,8 @@ class TestDhtCustomXattrClass(GlusterBaseClass):
for mount_object in self.mounts:
for fname in self.files_and_soft_links:
attr_val = get_fattr(mount_object.client_system,
- fname, 'user.foo')
+ fname, 'user.foo',
+ encode='text')
self.assertEqual(attr_val, xattr_val,
"Custom xattr not found from mount.")
g.log.info("Custom xattr found on mount point.")
@@ -59,7 +60,7 @@ class TestDhtCustomXattrClass(GlusterBaseClass):
for fname in files:
attr_val = get_fattr(node,
"{}/{}".format(brick_path, fname),
- 'user.foo')
+ 'user.foo', encode='text')
self.assertEqual(attr_val, xattr_val,
"Custom xattr not visible on bricks")
g.log.info("Custom xattr found on bricks.")
@@ -104,7 +105,7 @@ class TestDhtCustomXattrClass(GlusterBaseClass):
for mount_object in self.mounts:
for fname in list_of_all_files:
ret = get_fattr(mount_object.client_system,
- fname, 'user.foo')
+ fname, 'user.foo', encode='text')
self.assertIsNone(ret,
"Custom attribute visible at mount "
"point even after deletion")
@@ -118,7 +119,7 @@ class TestDhtCustomXattrClass(GlusterBaseClass):
if fname.split('/')[3] in files_on_bricks]
for fname in files:
ret = get_fattr(node, "{}/{}".format(brick_path, fname),
- 'user.foo')
+ 'user.foo', encode='text')
self.assertIsNone(ret,
"Custom attribute visible on "
"brick even after deletion")
@@ -216,13 +217,13 @@ class TestDhtCustomXattrClass(GlusterBaseClass):
self.set_xattr_user_foo(self.list_of_files, 'bar2')
# Check if custom xattr is set to all the regular files
- self.check_custom_xattr_visible('bar2')
+ self.check_custom_xattr_visible("bar2")
# Change the custom xattr on all the regular files
self.set_xattr_user_foo(self.list_of_files, 'ABC')
# Check if xattr is set to all the regular files
- self.check_custom_xattr_visible('ABC')
+ self.check_custom_xattr_visible("ABC")
# Delete Custom xattr from all regular files
self.delete_xattr_user_foo(self.list_of_files)
@@ -238,13 +239,13 @@ class TestDhtCustomXattrClass(GlusterBaseClass):
self.set_xattr_user_foo(list_of_softlinks, 'bar2')
# Check if custom xattr is set to all the regular files
- self.check_custom_xattr_visible('bar2')
+ self.check_custom_xattr_visible("bar2")
# Change the custom xattr on all the regular files
self.set_xattr_user_foo(list_of_softlinks, 'ABC')
# Check if xattr is set to all the regular files
- self.check_custom_xattr_visible('ABC')
+ self.check_custom_xattr_visible("ABC")
# Delete Custom xattr from all regular files
self.delete_xattr_user_foo(list_of_softlinks)
diff --git a/tests/functional/dht/test_directory_custom_extended_attributes.py b/tests/functional/dht/test_directory_custom_extended_attributes.py
index b391593b1..fd1493622 100644
--- a/tests/functional/dht/test_directory_custom_extended_attributes.py
+++ b/tests/functional/dht/test_directory_custom_extended_attributes.py
@@ -117,7 +117,8 @@ class TestDirectoryCustomExtendedAttributes(GlusterBaseClass):
mount_point, folder_name)
ret = get_fattr(mount_point.client_system,
mount_point.mountpoint,
- 'trusted.glusterfs.pathinfo')
+ 'trusted.glusterfs.pathinfo',
+ encode="text")
self.assertIsNotNone(ret,
"trusted.glusterfs.pathinfo is not "
"presented on %s:%s" %
@@ -139,7 +140,7 @@ class TestDirectoryCustomExtendedAttributes(GlusterBaseClass):
g.log.debug('Check xarttr user.foo on %s:%s',
mount_point.client_system, folder_name)
ret = get_fattr(mount_point.client_system, folder_name,
- 'user.foo')
+ 'user.foo', encode="text")
self.assertEqual(ret, 'bar2',
"Xattr attribute user.foo is not presented on "
"mount point %s and directory %s" %
@@ -153,7 +154,8 @@ class TestDirectoryCustomExtendedAttributes(GlusterBaseClass):
brick_path = dir_prefix.format(root=brick_dir,
client_index=mount_index)
- ret = get_fattr(brick_server, brick_path, 'user.foo')
+ ret = get_fattr(brick_server, brick_path, 'user.foo',
+ encode="text")
g.log.debug('Check custom xattr for directory on brick %s:%s',
brick_server, brick_path)
@@ -177,7 +179,8 @@ class TestDirectoryCustomExtendedAttributes(GlusterBaseClass):
g.log.debug('Looking if custom extra attribute user.foo is '
'presented on mount or on bricks after deletion')
self.assertIsNone(get_fattr(mount_point.client_system,
- folder_name, 'user.foo'),
+ folder_name, 'user.foo',
+ encode="text"),
"Xattr user.foo is presented on mount point"
" %s:%s after deletion" %
(mount_point.mountpoint, folder_name))
@@ -277,7 +280,7 @@ class TestDirectoryCustomExtendedAttributes(GlusterBaseClass):
g.log.debug('Check mountpoint and bricks for custom xattribute')
self.assertEqual('bar2', get_fattr(mount_point.client_system,
linked_folder_name,
- 'user.foo'),
+ 'user.foo', encode="text"),
'Custom xattribute is not presented on '
'mount point %s:%s' %
(mount_point.client_system, linked_folder_name))
@@ -297,7 +300,8 @@ class TestDirectoryCustomExtendedAttributes(GlusterBaseClass):
continue
self.assertEqual(get_fattr(brick_server, brick_path,
- 'user.foo'), 'bar2',
+ 'user.foo', encode="text"),
+ 'bar2',
"Actual: custom attribute not "
"found on brick %s:%s" % (
brick_server, brick_path))
@@ -319,7 +323,8 @@ class TestDirectoryCustomExtendedAttributes(GlusterBaseClass):
"after deletion", mount_point.client_system,
linked_folder_name)
self.assertIsNone(get_fattr(mount_point.client_system,
- linked_folder_name, 'user.foo'),
+ linked_folder_name, 'user.foo',
+ encode="text"),
"Expected: xattr user.foo to be not presented on"
" %s:%s" % (mount_point.client_system,
linked_folder_name))
@@ -339,7 +344,7 @@ class TestDirectoryCustomExtendedAttributes(GlusterBaseClass):
continue
self.assertIsNone(get_fattr(brick_server, brick_path,
- 'user.foo'),
+ 'user.foo', encode="text"),
"Extended custom attribute is presented on "
"%s:%s after deletion" % (brick_server,
brick_path))