summaryrefslogtreecommitdiffstats
path: root/Libraries/GlusterCommands/ATFGlusterVolume.py
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/GlusterCommands/ATFGlusterVolume.py')
-rwxr-xr-xLibraries/GlusterCommands/ATFGlusterVolume.py230
1 files changed, 0 insertions, 230 deletions
diff --git a/Libraries/GlusterCommands/ATFGlusterVolume.py b/Libraries/GlusterCommands/ATFGlusterVolume.py
deleted file mode 100755
index 20bfd4f..0000000
--- a/Libraries/GlusterCommands/ATFGlusterVolume.py
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/usr/bin/env python
-import ATFUtils
-import ATFTestEnv
-import re
-
-def create_volume(volumekey, *exportdirs, **arguments):
- """
- Description:
- Create a new Volume of specified type with mentioned bricks
-
- Parameters:
- volumekey: Name of the Volume
-
- exportdirs: List of exportdirs to be used to create Volume
-
- arguments: Key=Value pair for "Volume Type" and "Transport Type".
- 'voltype' = stripe|replica|distribute
- 'transport' = tcp|rdma|tcp,rdma
- 'host' = Server_IP
- 'user' = User
-
- Return:
- Success: 0
- Failure: 1
-
- Example:
- create('Replicate',
- 'host1:export1',
- 'host2:export1,
- voltype='replica 2',
- transport='transport tcp'
- host = 'host(1..n)'
- server = 'server(1..n)'
- )
- """
-
- command = "gluster volume create"
-
- volumename = ATFUtils.TestEnvObj.get_volume(volumekey)
- if ( volumename == ''):
- ATFUtils.Logger.error("Volume %s Not defined in GlobalParam File" %
- volumekey)
- return 1
- else:
- command = command + " " + volumename
-
- if (arguments.has_key('voltype')):
- command = command + " " + arguments.pop('voltype')
-
- if (arguments.has_key('transport')):
- command = command + " " + arguments.pop('transport')
-
- exportdirlist = []
- for exportdir in exportdirs:
- hostkey, exportkey = re.split(':', exportdir)
-
- host = ATFUtils.TestEnvObj.get_host(hostkey)
- if ( host == '' ):
- ATFUtils.Logger.error("Host %s Not defined in GlobalParam File" %
- hostkey)
- return 1
-
- export = ATFUtils.TestEnvObj.get_exportdir(exportkey)
- if (export == '' ):
- ATFUtils.Logger.error(
- "ExportDir %s Not defined in GlobalParam File" % exportkey)
- return 1
-
- exportdirlist.append(host + ":" +export)
-
- for exportdir in exportdirlist:
- command = command + " " + exportdir
-
- 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 start_volume(volumekey, force='', **arguments):
- """
- Description:
- Start volume specified by volumename
-
- Parameters:
- volumekey: Name of the Volume
-
- Returns:
- Success: 0
- Failure: 1
- """
-
- command = "gluster volume start"
-
- volumename = ATFUtils.TestEnvObj.get_volume(volumekey)
- if ( volumename == ''):
- ATFUtils.Logger.error("Volume %s Not defined in GlobalParam File" %
- volumekey)
- return 1
- else:
- command = command + " " + volumename + " " + force
-
- 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_volume(volumekey, force='', **arguments):
- """
- Description:
- Stop volume specified by volumename
-
- Parameters:
- volumekey: Name of the Volume
- force: force stop Gluster Volume
-
- Returns:
- Success: 0
- Failure: 1
- """
-
- command = "gluster volume stop"
-
- volumename = ATFUtils.TestEnvObj.get_volume(volumekey)
- if ( volumename == ''):
- ATFUtils.Logger.error("Volume %s Not defined in GlobalParam File" %
- volumekey)
- return 1
- else:
- command = command + " " + volumename + " " + force
-
- arguments['user'] = 'root'
- status, stdin, stdout, stderr = ATFUtils.execute_command(command,
- **arguments)
-
- if (status == 1):
- return 1
- else:
- stdin.write("y\n")
- return ATFUtils.parse_output(stdout, stderr)
-
-
-def delete_volume(volumekey, **arguments):
- """
- Description:
- Delete volume specified by volumename
-
- Parameters:
- volumekey: Name of the Volume
-
- Returns:
- Success: 0
- Failure: 1
- """
-
- command = "gluster volume delete"
-
- volumename = ATFUtils.TestEnvObj.get_volume(volumekey)
- if ( volumename == ''):
- ATFUtils.Logger.error("Volume %s Not defined in GlobalParam File" %
- volumekey)
- return 1
- else:
- command = command + " " + volumename
-
- arguments['user'] = 'root'
- status, stdin, stdout, stderr = ATFUtils.execute_command(command,
- **arguments)
-
- if (status == 1):
- return 1
- else:
- stdin.write("y\n")
- return ATFUtils.parse_output(stdout, stderr)
-
-def create_exportdirs(*exportdirs, **arguments):
- """
- Description:
- Create Bricks on the Server 'server'
-
- Parameters:
- server: IP Address of Server where bricks has to be created
- username: User on Server 'server'
- bricks: List of Bricks to be created
-
- Return:
- Success: 0
- Failure: 1
- """
-
- command = "mkdir -p"
- cleanup_command = "rm -rf"
- exportdirlist = []
-
- for exportkey in exportdirs:
- exportdir = ATFUtils.TestEnvObj.get_exportdir(exportkey)
- if (exportdir == '' ):
- ATFUtils.Logger.error(
- "ExportDir %s Not defined in GlobalParam File" % exportkey)
- return 1
- else:
- exportdirlist.append(exportdir)
-
- for exportdir in exportdirlist:
- command = command + " " + exportdir
- cleanup_command = cleanup_command + " " + exportdir
-
- arguments['user'] = 'root'
- status, stdin, stdout, stderr = ATFUtils.execute_command(cleanup_command,
- **arguments)
- status, stdin, stdout, stderr = ATFUtils.execute_command(command,
- **arguments)
-
- if (status == 1):
- return 1
- else:
- return ATFUtils.parse_output(stdout, stderr)
-
-
-
-
-
-