From 0c51170b87c6d13d82f802e4174520f20064c49a Mon Sep 17 00:00:00 2001 From: ubansal Date: Thu, 11 Jun 2020 17:09:18 +0530 Subject: [LibFix] Add arequal support on given path Calculates arequal for a particular path in the mountpoint Change-Id: I018302e6dbb11a9c11d42fc0381ec4183b3725a0 Signed-off-by: ubansal --- glustolibs-io/glustolibs/io/utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/glustolibs-io/glustolibs/io/utils.py b/glustolibs-io/glustolibs/io/utils.py index 2a2dff189..e4bb53b4f 100755 --- a/glustolibs-io/glustolibs/io/utils.py +++ b/glustolibs-io/glustolibs/io/utils.py @@ -27,12 +27,15 @@ from glustolibs.gluster.volume_libs import get_subvols from glustolibs.misc.misc_libs import upload_scripts -def collect_mounts_arequal(mounts): +def collect_mounts_arequal(mounts, path=''): """Collects arequal from all the mounts Args: mounts (list): List of all GlusterMount objs. + Kwargs: + path (str): Path whose arequal is to be calculated. + Defaults to root of mountpoint Returns: tuple(bool, list): On success returns (True, list of arequal-checksums of each mount) @@ -47,9 +50,10 @@ def collect_mounts_arequal(mounts): g.log.info("Start collecting arequal-checksum from all mounts") all_mounts_procs = [] for mount_obj in mounts: + total_path = os.path.join(mount_obj.mountpoint, path) g.log.info("arequal-checksum of mount %s:%s", mount_obj.client_system, - mount_obj.mountpoint) - cmd = "arequal-checksum -p %s -i .trashcan" % mount_obj.mountpoint + total_path) + cmd = "arequal-checksum -p %s -i .trashcan" % total_path proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) all_mounts_arequal_checksums = [] -- cgit