summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xglustolibs-misc/glustolibs/misc/misc_libs.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/glustolibs-misc/glustolibs/misc/misc_libs.py b/glustolibs-misc/glustolibs/misc/misc_libs.py
index e913becf3..e2c1f6ca7 100755
--- a/glustolibs-misc/glustolibs/misc/misc_libs.py
+++ b/glustolibs-misc/glustolibs/misc/misc_libs.py
@@ -536,3 +536,26 @@ def are_nodes_offline(nodes):
ret = all(node_results.values())
return ret, node_results
+
+
+def drop_caches(hosts):
+ """Drops Kernel Cache on a list of hosts
+ (in order to run reads/renames etc on a cold cache).
+
+ Args:
+ hosts (list): List of hosts where kernel caches need to be
+ dropped (Servers/ Clients)
+
+ Returns:
+ bool : True , post succesful completion.Else,False.
+ """
+ cmd = "echo 3 > /proc/sys/vm/drop_caches"
+ results = g.run_parallel(hosts, cmd)
+ _rc = True
+ for host, ret_values in results.iteritems():
+ retcode, _, _ = ret_values
+ if retcode != 0:
+ g.log.error("Unable to drop cache on host %s", host)
+ _rc = False
+
+ return _rc