summaryrefslogtreecommitdiffstats
path: root/Libraries/GlusterCommands/ATFGlusterd.py
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/GlusterCommands/ATFGlusterd.py')
-rwxr-xr-xLibraries/GlusterCommands/ATFGlusterd.py103
1 files changed, 103 insertions, 0 deletions
diff --git a/Libraries/GlusterCommands/ATFGlusterd.py b/Libraries/GlusterCommands/ATFGlusterd.py
new file mode 100755
index 0000000..fe2a838
--- /dev/null
+++ b/Libraries/GlusterCommands/ATFGlusterd.py
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+import ATFUtils
+
+def start_glusterd(**arguments):
+ """
+ Objective :
+ Start Glusterd process on the server
+
+ Parameter :
+ arguments: key = value pair.
+ server = 'server(1..n)'
+ host = 'host(1..n)'
+ Return:
+ Success : 0
+ Failure : 1
+ """
+
+ command = "/etc/init.d/glusterd start"
+ arguments['user'] = 'root'
+ status, stdin, stdout, stderr = ATFUtils.execute_command(command,
+ **arguments)
+
+ if (status == 1):
+ return 1
+ else:
+ return ATFUtils.parse_output(stdout, stderr)
+
+def stop_glusterd(**arguments):
+ """
+ Description:
+ Stop Glusterd process on the server
+
+ Parameter:
+ arguments: key = value pair.
+ server = 'server(1..n)'
+ host = 'host(1..n)'
+
+ Return:
+ Success : 0
+ Failure : 1
+ """
+
+ command = "/etc/init.d/glusterd stop"
+ arguments['user'] = 'root'
+ status, stdin, stdout, stderr = ATFUtils.execute_command(command,
+ **arguments)
+
+ if (status == 1):
+ return 1
+ else:
+ return ATFUtils.parse_output(stdout, stderr)
+
+def restart_glusterd(**arguments):
+ """
+ Description:
+ Restart Glusterd process on the server
+
+ Parameter:
+ arguments: key = value pair.
+ server = 'server(1..n)'
+ host = 'host(1..n)'
+
+ Return:
+ Success : 0
+ Failure : 1
+ """
+
+ command = "/etc/init.d/glusterd restart"
+ arguments['user'] = 'root'
+ status, stdin, stdout, stderr = ATFUtils.execute_command(command,
+ **arguments)
+
+ if (status == 1):
+ return 1
+ else:
+ return ATFUtils.parse_output(stdout, stderr)
+
+def cleanup_glusterd(**arguments):
+ """
+ Description:
+ Cleans up the glusterd directory on Servers
+
+ Parameter:
+ arguments: key = value pair.
+ server = 'server(1..n)'
+ host = 'host(1..n)'
+
+ Return:
+ Success : 0
+ Failure : 1
+ """
+
+ command = "rm -rf /etc/glusterd/*"
+ arguments['user'] = 'root'
+ status, stdin, stdout, stderr = ATFUtils.execute_command(command,
+ **arguments)
+
+ if (status == 1):
+ return 1
+ else:
+ return ATFUtils.parse_output(stdout, stderr)
+
+