diff options
| -rwxr-xr-x | glustolibs-gluster/glustolibs/gluster/glusterfile.py | 13 | ||||
| -rw-r--r-- | tests/functional/bvt/test_cvt.py | 20 | 
2 files changed, 29 insertions, 4 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/glusterfile.py b/glustolibs-gluster/glustolibs/gluster/glusterfile.py index 70777c67c..7cb961c03 100755 --- a/glustolibs-gluster/glustolibs/gluster/glusterfile.py +++ b/glustolibs-gluster/glustolibs/gluster/glusterfile.py @@ -119,18 +119,25 @@ def get_fattr(host, fqpath, fattr):      return None -def get_fattr_list(host, fqpath): +def get_fattr_list(host, fqpath, encode_hex=False):      """List of xattr for filepath on remote system.      Args:          host (str): The hostname/ip of the remote system.          fqpath (str): The fully-qualified path to the file. +    Kwargs: +       encode_hex(bool): Fetch xattr in hex if True +                         (Default:False) +      Returns:          Dictionary of xattrs on success. None on fail.      """ -    command = "getfattr --absolute-names -d -m - %s" % fqpath -    rcode, rout, rerr = g.run(host, command) +    cmd = "getfattr --absolute-names -d -m - {}".format(fqpath) +    if encode_hex: +        cmd = ("getfattr --absolute-names -d -m - -e hex {}" +               .format(fqpath)) +    rcode, rout, rerr = g.run(host, cmd)      if rcode == 0:          xattr_list = {} diff --git a/tests/functional/bvt/test_cvt.py b/tests/functional/bvt/test_cvt.py index a3be67117..664652290 100644 --- a/tests/functional/bvt/test_cvt.py +++ b/tests/functional/bvt/test_cvt.py @@ -293,6 +293,24 @@ class TestGlusterShrinkVolumeSanity(GlusterBasicFeaturesSanityBaseClass):          g.log.info("Successful in logging volume info and status of volume %s",                     self.volname) +        # Temporary code: +        # Additional checks to gather infomartion from all +        # servers for Bug 1810901 and setting log level to debug. +        for opt in ('diagnostics.brick-log-level', +                    'diagnostics.client-log-level '): +            ret = set_volume_options(self.mnode, self.volname, +                                     {opt: 'DEBUG'}) +            if not ret: +                g.log.error('Failed to set volume option %s', opt) +        if self.volume_type == 'distributed-dispersed': +            for brick_path in get_all_bricks(self.mnode, self.volname): +                node, path = brick_path.split(':') +                ret, out, _ = g.run(node, 'find {}/'.format(path)) +                g.log.info(out) +                for filedir in out.split('\n'): +                    ret = get_fattr_list(node, filedir, encode_hex=True) +                    g.log.info(ret) +          # Shrinking volume by removing bricks from volume when IO in progress          g.log.info("Start removing bricks from volume when IO in progress")          ret = shrink_volume(self.mnode, self.volname) @@ -306,7 +324,7 @@ class TestGlusterShrinkVolumeSanity(GlusterBasicFeaturesSanityBaseClass):                  ret, out, _ = g.run(node, 'find {}/'.format(path))                  g.log.info(out)                  for filedir in out.split('\n'): -                    ret = get_fattr_list(node, filedir) +                    ret = get_fattr_list(node, filedir, encode_hex=True)                      g.log.info(ret)          self.assertTrue(ret, ("Failed to shrink the volume when IO in "  | 
