summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2020-01-02 15:23:01 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2020-01-07 05:55:08 +0000
commitd131ce9f70c528cdd50aa0d4f2923f5a9f14aefc (patch)
tree84193d598c45db8bb545fc2e29869b694819cee2
parente6c1c5d7809494ced4f7273dac9784b3276c798e (diff)
[lib] Adding function upload_file_dir_ops() to io/utils.py
Adding a function upload_file_dir_ops() to upload file_dir_ops.py to all clients. This is to remove the redundant code given below: ``` g.log.info("Upload io scripts to clients %s for running IO on " "mounts", cls.clients) cls.script_upload_path = ("/usr/share/glustolibs/io/scripts/" "file_dir_ops.py") ret = upload_scripts(cls.clients, cls.script_upload_path) if not ret: raise ExecutionError("Failed to upload IO scripts to clients %s" % cls.clients) g.log.info("Successfully uploaded IO scripts to clients %s", cls.clients) ``` Change-Id: I28ca528bfbaea20139808b7af812559715a27022 Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
-rwxr-xr-xglustolibs-io/glustolibs/io/utils.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/glustolibs-io/glustolibs/io/utils.py b/glustolibs-io/glustolibs/io/utils.py
index 96cf8a0..67b3fe2 100755
--- a/glustolibs-io/glustolibs/io/utils.py
+++ b/glustolibs-io/glustolibs/io/utils.py
@@ -24,6 +24,7 @@ import subprocess
from glusto.core import Glusto as g
from glustolibs.gluster.mount_ops import GlusterMount
from glustolibs.gluster.volume_libs import get_subvols
+from glustolibs.misc.misc_libs import upload_scripts
def collect_mounts_arequal(mounts):
@@ -955,3 +956,30 @@ def run_cthon(mnode, volname, clients, dir_name):
else:
g.log.info("%s test successfully passed" % test_type)
return True
+
+
+def upload_file_dir_ops(clients):
+ """Upload file_dir_ops.py to all the clients.
+
+ Args:
+ clients(list): List of client machines where we need to upload
+ the script.
+
+ Returns:
+ bool: True if script is uploaded successfully
+ False otherwise.
+ """
+
+ g.log.info("Upload io scripts to clients %s for running IO on "
+ "mounts", clients)
+ file_dir_ops_path = ("/usr/share/glustolibs/io/scripts/"
+ "file_dir_ops.py")
+
+ if not upload_scripts(clients, file_dir_ops_path):
+ g.log.error("Failed to upload IO scripts to clients %s" %
+ clients)
+ return False
+
+ g.log.info("Successfully uploaded IO scripts to clients %s",
+ clients)
+ return True