diff options
| author | Arthy Loganathan <aloganat@redhat.com> | 2016-06-26 23:53:34 +0530 | 
|---|---|---|
| committer | M S Vishwanath Bhat <msvbhat@gmail.com> | 2016-06-28 02:15:03 -0700 | 
| commit | a4bdba1ed44ba23d0a25c6192e854b29b45550bb (patch) | |
| tree | 6683e421564fcac301c8e60482bcb369c2984878 | |
| parent | 2ca5388692e70e079c99771d8c66a06bd90d5268 (diff) | |
distaf: Modified get_pathinfo() in lib_utils.py
Modified get_pathinfo() in lib_utils.py
Change-Id: I721d3704ec00c20b9678088d79e52e3eedbe4af5
BUG: 1350248
Signed-off-by: Arthy Loganathan <aloganat@redhat.com>
Reviewed-on: http://review.gluster.org/14802
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: M S Vishwanath Bhat <msvbhat@gmail.com>
| -rw-r--r-- | tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/lib_utils.py | 29 | 
1 files changed, 15 insertions, 14 deletions
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/lib_utils.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/lib_utils.py index 9349295381d..24267f8bc1d 100644 --- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/lib_utils.py +++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/lib_utils.py @@ -26,6 +26,7 @@ from distaflibs.gluster.mount_ops import mount_volume, umount_volume  import re  import time  from collections import OrderedDict +import tempfile  try:      import xml.etree.cElementTree as etree @@ -208,7 +209,7 @@ def get_extended_attributes_info(file_list, encoding='hex', attr_name='',      return attr_dict -def get_pathinfo(filename, volname, client=None): +def get_pathinfo(filename, volname, mnode=None):      """This module gets filepath of the given file in gluster server.      Example: @@ -219,44 +220,44 @@ def get_pathinfo(filename, volname, client=None):          volname (str): volume name      Kwargs: -        client (str): client on which cmd has to be executed. +        mnode (str): Node on which cmd has to be executed. Defaults +            to tc.servers[0].      Returns:          NoneType: None if command execution fails, parse errors.          list: file path for the given file in gluster server      """ -    if client is None: -        client = tc.clients[0] +    if mnode is None: +        mnode = tc.servers[0] -    server = get_volume_info(volname)[volname]['bricks'][0].split(':')[0] -    mount_point = '/mnt/tmp_fuse' +    mount_point = tempfile.mkdtemp()      # Performing glusterfs mount because only with glusterfs mount -    # the file location in gluster server can be identified from client -    # machine +    # the file location in gluster server can be identified      ret, _, _ = mount_volume(volname, mtype='glusterfs',                               mpoint=mount_point, -                             mserver=server, -                             mclient=client) +                             mserver=mnode, +                             mclient=mnode)      if ret != 0:          tc.logger.error("Failed to do gluster mount on volume %s to fetch" -                        "pathinfo from client %s" -                        % (volname, client)) +                        "pathinfo from server %s" +                        % (volname, mnode))          return None      filename = mount_point + '/' + filename      attr_name = 'trusted.glusterfs.pathinfo'      output = get_extended_attributes_info([filename],                                            attr_name=attr_name, -                                          mnode=client) +                                          mnode=mnode)      if output is None:          tc.logger.error("Failed to get path info for %s" % filename)          return None      pathinfo = output[filename][attr_name] -    umount_volume(client, mount_point) +    umount_volume(mnode, mount_point) +    tc.run(mnode, "rm -rf " + mount_point)      return re.findall(".*?POSIX.*?:(\S+)\>", pathinfo)  | 
