diff options
author | Vijaykumar <vkoppad@redhat.com> | 2012-02-13 14:54:42 +0530 |
---|---|---|
committer | root <vkoppad@redhat.com> | 2012-03-14 21:03:51 +0530 |
commit | da93b886f28f3818cb11a5a35fae37abe2ebb988 (patch) | |
tree | e627ca2e4c6cc786f8f52fe42e1a1a08ad6d07bb /libs/utils/hostutils.py | |
parent | 4a0b5f9d0e0266c8c67b5faa76599fc78a247437 (diff) |
* Geo-replication library function in glusterutils
* A new section in configuration file for geo-rep
* In gluster installation , changing libexecdir
to /usr/local/libexec in configuration.
* Removed some unwanted code.
* handling to have a geo-rep session locally also.
Change-Id: Ifcf00b73ed933077640113ce0528b39bdad55999
Signed-off-by: Vijaykumar <vkoppad@redhat.com>
Signed-off-by: root <root@vostro.(none)>
Diffstat (limited to 'libs/utils/hostutils.py')
-rw-r--r-- | libs/utils/hostutils.py | 333 |
1 files changed, 0 insertions, 333 deletions
diff --git a/libs/utils/hostutils.py b/libs/utils/hostutils.py index 3955cc6..bc7efa0 100644 --- a/libs/utils/hostutils.py +++ b/libs/utils/hostutils.py @@ -258,336 +258,3 @@ def _substitute_value_for_variables(command): return new_command -def gluster_install_tar(version): - """ - """ - logger = GlobalObj.getLoggerObj() - env = GlobalObj.getTestenvObj() - cm = GlobalObj.getConnectionsManagerObj() - down_path = ''.join(env.getGlusterDownloadPaths()) - - if system_dirs.match(down_path): - logger.error("System Directiories cannot be created") - return 1 - - if not down_path[-1] is '/': - down_path= down_path+'/' - - install_path = "/opt/gusterfs/"+version+"/" - - host_keys = env.getHostsKeys() - for hostkey in host_keys: - host_connection = cm.getConnection(hostkey) - if not host_connection: - logger.error("SSH Connection not established to host'%s'" - %hostkey) - return 1 - """ - stopping all the gluster processes - """ - kill_command = "killall glusterd && killall glusterfsd && killall glusterfs" - logger.debug('%s: Executing command : %s' %(hostkey, kill_command)) - output = host_connection.executecommand(kill_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - """ - Cleaning /etc/glusterd, usr/local/sbin and /usr/sbin - """ - remove_command = "rm -rf /etc/glusterd/ && rm -rf /usr/local/sbin/gluster* && rm -rf /usr/sbin/gluster* " - logger.debug('%s: Executing command : %s' %(hostkey, remove_command)) - output = host_connection.executecommand(remove_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - """ - checking for rpm installation of gluster and removing it. - """ - cleanup_command = "rpm -qa | grep gluster | xargs rpm -e" - logger.debug('%s: Executing command : %s' %(hostkey, cleanup_command)) - output = host_connection.executecommand(cleanup_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - mkdir_command = ["mkdir -p",down_path] - mkdir_command =' '.join(mkdir_command) - logger.debug('%s: Executing command : %s' %(hostkey, mkdir_command)) - output = host_connection.executecommand(mkdir_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - download_url= "http://bits.gluster.com/pub/gluster/glusterfs/src/glusterfs-"+version+".tar.gz" - """ - changing directory to the download path - """ - chdir = 'cd '+down_path+' && ' - wget_command = 'wget '+download_url - download_command = chdir + wget_command - logger.debug('%s: Executing command:%s'%(hostkey, download_command)) - output = host_connection.executecommand(download_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - extract = 'tar -xzf glusterfs-'+version+'.tar.gz' - extract_command = chdir + extract - logger.debug('%s: Executing command : %s'%(hostkey, extract_command)) - output = host_connection.executecommand(extract_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - """ - changing directory to the glusterfs directory - """ - chdir = 'cd '+down_path+'glusterfs-'+version+' && ' - configure = "./autogen.sh && ./configure --prefix="+install_path+" CFLAGS=\"-g -O0 -DDEBUG\" " - configure_command = chdir + configure - logger.debug('%s: Executing command : %s' %(hostkey, configure_command)) - output = host_connection.executecommand(configure_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - make = "make && make install" - make_command = chdir + make - logger.debug('%s: Executing command : %s'%(hostkey, make_command)) - output = host_connection.executecommand(make_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - """ - """ - symlink_command = "ln -s "+install_path+"sbin/gluster /usr/sbin/gluster && ln -s "+install_path+"sbin/glusterd /usr/sbin/glusterd && ln -s "+install_path+"sbin/glusterfsd /usr/sbin/glusterfsd && ln -s "+install_path+"sbin/glusterfs /usr/sbin/glusterfs" - logger.debug('%s: Executing command : %s'%(hostkey, symlink_command)) - output = host_connection.executecommand(symlink_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - - return 0 - -def gluster_install_git(branch): - """ - """ - logger = GlobalObj.getLoggerObj() - env = GlobalObj.getTestenvObj() - cm = GlobalObj.getConnectionsManagerObj() - down_path = ''.join(env.getGlusterDownloadPaths()) - - if system_dirs.match(down_path): - logger.error("System Directiories cannot be created") - return 1 - - if not down_path[-1] is '/': - down_path= down_path+'/' - - install_path = "/opt/gusterfs/"+branch+'/' - - host_keys = env.getHostsKeys() - for hostkey in host_keys: - host_connection = cm.getConnection(hostkey) - if not host_connection: - logger.error("SSH Connection not established to host'%s'" - %hostkey) - return 1 - """ - stopping all the gluster processes - """ - kill_command = "killall glusterd && killall glusterfsd && killall glusterfs" - logger.debug('%s: Executing command : %s' %(hostkey, kill_command)) - output = host_connection.executecommand(kill_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - """ - Cleaning /etc/glusterd , /usr/local/sbin , /usr/sbin/ - and previous git directory - """ - remove_command = "rm -rf /etc/glusterd/ && rm -rf "+down_path+"glusterfs.git && rm -rf /usr/local/sbin/gluster* && rm -rf /usr/sbin/gluster*" - logger.debug('%s: Executing command : %s' %(hostkey, remove_command)) - output = host_connection.executecommand(remove_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - """ - checking for rpm installation of gluster and removing it. - """ - cleanup_command = "rpm -qa | grep gluster | xargs rpm -e" - logger.debug('%s: Executing command : %s' %(hostkey, cleanup_command)) - output = host_connection.executecommand(cleanup_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - mkdir_command = ["mkdir -p",down_path] - mkdir_command =' '.join(mkdir_command) - logger.debug('%s: Executing command : %s' %(hostkey, mkdir_command)) - output = host_connection.executecommand(mkdir_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - git_url ='https://github.com/gluster/glusterfs.git' - - """ - changing directory to the download path - """ - chdir = 'cd '+down_path+' && ' - clone_command = ' git clone '+git_url+" "+"glusterfs.git" - git_command = chdir + clone_command - - logger.debug('%s: Executing command:%s'%(hostkey, git_command)) - output = host_connection.executecommand(git_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - """ - changing directory to the glusterfs directory and checking out - to the branch - """ - chdir = 'cd '+down_path+'glusterfs.git'+' && ' - checkout = "git checkout "+branch+' && ' - git_pull = "git pull" - git_command = chdir+ checkout + git_pull - logger.debug('%s: Executing command : %s' %(hostkey, git_command)) - output = host_connection.executecommand(git_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - configure = "./autogen.sh && ./configure --prefix="+install_path+" CFLAGS=\"-g -O0 -DDEBUG -lefence\" " - configure_command = chdir + configure - logger.debug('%s: Executing command : %s' %(hostkey, configure_command)) - output = host_connection.executecommand(configure_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - make = "make && make install" - make_command = chdir + make - logger.debug('%s: Executing command : %s'%(hostkey, make_command)) - output = host_connection.executecommand(make_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - """ - """ - symlink_command = "ln -s "+install_path+"sbin/gluster /usr/sbin/gluster && ln -s "+install_path+"sbin/glusterd /usr/sbin/glusterd && ln -s "+install_path+"sbin/glusterfsd /usr/sbin/glusterfsd && ln -s "+install_path+"sbin/glusterfs /usr/sbin/glusterfs" - logger.debug('%s: Executing command : %s'%(hostkey, symlink_command)) - output = host_connection.executecommand(symlink_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - return 0 - -def gluster_install_rpm(version, *components): - """ - """ - logger = GlobalObj.getLoggerObj() - env = GlobalObj.getTestenvObj() - cm = GlobalObj.getConnectionsManagerObj() - down_path = ''.join(env.getGlusterDownloadPaths()) - - if system_dirs.match(down_path): - logger.error("System Directiories cannot be created") - return 1 - - if not down_path[-1] is '/': - down_path= down_path+'/' - rpm_path = down_path+"glusterfs.rpm" - - host_keys = env.getHostsKeys() - for hostkey in host_keys: - host_connection = cm.getConnection(hostkey) - if not host_connection: - logger.error("SSH Connection not established to host'%s'" - %hostkey) - return 1 - - """ - stopping all the gluster processes - """ - kill_command = "killall glusterd && killall glusterfsd && killall glusterfs" - logger.debug('%s: Executing command : %s' %(hostkey, kill_command)) - output = host_connection.executecommand(kill_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - """ - deleting /etc/glusterd - """ - remove_command = "rm -rf /etc/glusterd/ && rm -rf /usr/sbin/gluster* && rm -rf /usr/local/sbin/gluster*" - logger.debug('%s: Executing command : %s' %(hostkey, remove_command)) - output = host_connection.executecommand(remove_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - """ - checking for rpm installation of gluster and removing it. - """ - cleanup_command = "rpm -qa | grep gluster | xargs rpm -e" - logger.debug('%s: Executing command : %s' %(hostkey, cleanup_command)) - output = host_connection.executecommand(cleanup_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - - mkdir_command = ["mkdir -p",rpm_path] - mkdir_command =' '.join(mkdir_command) - logger.debug('%s: Executing command : %s' %(hostkey, mkdir_command)) - output = host_connection.executecommand(mkdir_command) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - - for component in components: - component_url = "http://bits.gluster.com/pub/gluster/glusterfs/"+version+"/x86_64/glusterfs-"+component+"-"+version+"-1.x86_64.rpm" - chdir = 'cd '+rpm_path+' && ' - wget_command = "wget "+component_url - down_command = chdir + wget_command - - logger.debug('%s: Executing command:%s'%(hostkey, down_command)) - output = host_connection.executecommand(down_command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - - install_command = "rpm -ivh glusterfs-"+component+"-"+version+"-1.x86_64.rpm --nodeps" - - command = chdir + install_command - - logger.debug('%s: Executing command:%s'%(hostkey, command)) - output = host_connection.executecommand(command) - return_status = atfutils.assert_success(output['exitstatus']) - atfutils.print_stdout(output['stdoutdata']) - atfutils.print_stderr(output['stderrdata']) - if return_status: - return 1 - - return 0 |