diff options
| author | kshithijiyer <kshithij.ki@gmail.com> | 2020-08-06 21:47:41 +0530 | 
|---|---|---|
| committer | kshithijiyer <kshithij.ki@gmail.com> | 2020-08-06 22:15:06 +0530 | 
| commit | 40f5b8754c854c07c38ee501c00a399df1ca1323 (patch) | |
| tree | c4e6f390f879d5f6a192acb5a741f028101d7b07 | |
| parent | 0b86bc1caa81ca558606d0e68fdf36f3eb5d4a59 (diff) | |
[Testfix] Add logic to log more info
Adding code to get dir tree and dump all
xattr in hex for Bug 1810901 before remove-brick
also adding logic to set log-level to debug.
Change-Id: I9c9c970c4de7d313832f6f189cdca8428a073b1e
Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
| -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 "  | 
