Exemple #1
0
 def check_ports_on_blocking(self, ports, nodes, query_strs, logfile):
     nodes_obj = IPv6_IPv4([nodes])
     addr_family = nodes_obj.get_addr_family()
     shell = RemoteMachineShellConnection(nodes)
     shell.delete_file(self.LOG_PATH, logfile)
     pids = nodes_obj.block_ports(ports, addr_family)
     self.sleep(20)
     found = self.verify_logs_wrapper(nodes, logfile, query_strs)
     nodes_obj.unblock_ports(pids)
     shell.disconnect()
     return found
Exemple #2
0
 def run(self):
     remote = RemoteMachineShellConnection(self.server)
     server_type = 'membase'
     if remote.is_couchbase_installed():
         server_type = 'couchbase'
     stamp = time.strftime("%d_%m_%Y_%H_%M")
     try:
         info = remote.extract_remote_info()
         if info.type.lower() != 'windows':
             core_files = []
             print "looking for Erlang/Memcached crashes on {0} ... ".format(
                 info.ip)
             core_files.extend(
                 remote.file_starts_with(
                     "/opt/{0}/var/lib/{0}/".format(server_type),
                     "erl_crash"))
             core_files.extend(
                 remote.file_starts_with(
                     "/opt/{0}/var/lib/{0}/".format(server_type), "core"))
             core_files.extend(remote.file_starts_with("/tmp/", "core"))
             core_files.extend(
                 remote.file_ends_with(
                     "/opt/{0}/var/lib/{0}/crash".format(server_type),
                     ".dmp"))
             if core_files:
                 print "found dumps on {0}: {1}".format(info.ip, core_files)
                 command = "mkdir -p /tmp/backup_crash/{0};" \
                           "mv -f /tmp/core* /tmp/backup_crash/{0};" \
                           "mv -f /opt/{1}/var/lib/{1}/erl_crash.dump* /tmp/backup_crash/{0}; " \
                           "mv -f /opt/{1}/var/lib/{1}/crash/*.dmp /tmp/backup_crash/{0};".\
                     format(stamp, server_type)
                 print "Moved all dumps on {0} to backup folder: /tmp/backup_crash/{1}".format(
                     self.server.ip, stamp)
                 remote.execute_command(command)
                 output, error = remote.execute_command(
                     "ls -la /tmp/backup_crash/{0}".format(stamp))
                 for o in output:
                     print o
                 for core_file in core_files:
                     remote_path, file_name = os.path.dirname(
                         core_file), os.path.basename(core_file)
                     if remote.delete_file(remote_path, file_name):
                         print 'deleted core file : {0}'.format(core_file)
                 remote.disconnect()
             else:
                 print "dump files not found on {0}".format(info.ip)
                 if remote:
                     remote.disconnect()
     except Exception as ex:
         print ex
 def _delete_inbox_folder(self):
     shell = RemoteMachineShellConnection(self.host)
     final_path = self.install_path + x509main.CHAINFILEPATH
     shell = RemoteMachineShellConnection(self.host)
     os_type = shell.extract_remote_info().distribution_type
     log.info ("OS type is {0}".format(os_type))
     shell.delete_file(final_path , "root.crt")
     shell.delete_file(final_path , "chain.pem")
     shell.delete_file(final_path , "pkey.key")
     if os_type == 'windows':
         final_path = '/cygdrive/c/Program\ Files/Couchbase/Server/var/lib/couchbase/inbox'
         shell.execute_command('rm -rf ' + final_path)
     else:
         shell.execute_command('rm -rf ' + final_path)
Exemple #4
0
 def _delete_inbox_folder(self):
     shell = RemoteMachineShellConnection(self.host)
     final_path = self.install_path + x509main.CHAINFILEPATH
     shell = RemoteMachineShellConnection(self.host)
     os_type = shell.extract_remote_info().distribution_type
     log.info ("OS type is {0}".format(os_type))
     shell.delete_file(final_path , "root.crt")
     shell.delete_file(final_path , "chain.pem")
     shell.delete_file(final_path , "pkey.key")
     if os_type == 'windows':
         final_path = '/cygdrive/c/Program\ Files/Couchbase/Server/var/lib/couchbase/inbox'
         shell.execute_command('rm -rf ' + final_path)
     else:
         shell.execute_command('rm -rf ' + final_path)
Exemple #5
0
 def run(self):
     remote = RemoteMachineShellConnection(self.server)
     server_type = 'membase'
     if remote.is_couchbase_installed():
         server_type = 'couchbase'
     stamp = time.strftime("%d_%m_%Y_%H_%M")
     try:
         info = remote.extract_remote_info()
         if info.type.lower() != 'windows':
             core_files = []
             print "looking for Erlang/Memcached crashes on {0} ... ".format(info.ip)
             core_files.extend(remote.file_starts_with("/opt/{0}/var/lib/{0}/".format(server_type), "erl_crash"))
             core_files.extend(remote.file_starts_with("/opt/{0}/var/lib/{0}/".format(server_type), "core"))
             core_files.extend(remote.file_starts_with("/tmp/", "core"))
             core_files.extend(remote.file_ends_with("/opt/{0}/var/lib/{0}/crash".format(server_type), ".dmp"))
             if core_files:
                 print "found dumps on {0}: {1}".format(info.ip, core_files)
                 command = "mkdir -p /tmp/backup_crash/{0};" \
                           "mv -f /tmp/core* /tmp/backup_crash/{0};" \
                           "mv -f /opt/{1}/var/lib/{1}/erl_crash.dump* /tmp/backup_crash/{0}; " \
                           "mv -f /opt/{1}/var/lib/{1}/crash/*.dmp /tmp/backup_crash/{0};".\
                     format(stamp, server_type)
                 print "Moved all dumps on {0} to backup folder: /tmp/backup_crash/{1}".format(self.server.ip, stamp)
                 remote.execute_command(command)
                 output, error = remote.execute_command("ls -la /tmp/backup_crash/{0}".format(stamp))
                 for o in output:
                     print o
                 for core_file in core_files:
                     remote_path, file_name = os.path.dirname(core_file), os.path.basename(core_file)
                     if remote.delete_file(remote_path, file_name):
                         print 'deleted core file : {0}'.format(core_file)
                 remote.disconnect()
             else:
                 print "dump files not found on {0}".format(info.ip)
                 if remote:
                     remote.disconnect()
     except Exception as ex:
         print ex
Exemple #6
0
 def delete_files(self):
     for server in self.servers:
         shell = RemoteMachineShellConnection(server)
         shell.delete_file("/tmp/","block_ports.py")
         shell.delete_file("/tmp/","block_ports_out")
         shell.disconnect()