def _delete_all_files(cls, ip_address, username, password, path): ssh_connection = sf_util.get_ssh_connection(ip_address, username, password) ssh_connection.exec_command("sudo rm -rf " + path + "/*") ssh_connection.close()
def _get_kvm_iqn(self, ip_address, username, password): ssh_connection = sf_util.get_ssh_connection(ip_address, username, password) searchFor = "InitiatorName=" stdin, stdout, stderr = ssh_connection.exec_command("sudo grep " + searchFor + " /etc/iscsi/initiatorname.iscsi") result = stdout.read() ssh_connection.close() self.assertFalse(result is None, "Unable to locate the IQN of the KVM host (None)") self.assertFalse(len(result.strip()) == 0, "Unable to locate the IQN of the KVM host (Zero-length string)") return result[len(searchFor):].strip()
def _get_results(self, install_path): ssh_connection = sf_util.get_ssh_connection(TestData.secondary_storage_server, TestData.secondary_storage_server_username, TestData.secondary_storage_server_password) stdout = ssh_connection.exec_command("ls -l " + TestData.secondary_storage_server_root + install_path + " | grep qcow2")[1] result = stdout.read() stdout = ssh_connection.exec_command("ls -l " + TestData.secondary_storage_server_root + install_path + " | grep " + TestData.properties_file)[1] result2 = stdout.read() ssh_connection.close() return result, result2
def _get_kvm_iqn(self, ip_address, username, password): ssh_connection = sf_util.get_ssh_connection(ip_address, username, password) searchFor = "InitiatorName=" stdout = ssh_connection.exec_command( "sudo grep " + searchFor + " /etc/iscsi/initiatorname.iscsi")[1] result = stdout.read() ssh_connection.close() self.assertFalse(result is None, "Unable to locate the IQN of the KVM host (None)") self.assertFalse( len(result.strip()) == 0, "Unable to locate the IQN of the KVM host (Zero-length string)") return result[len(searchFor):].strip()
def _get_results(self, install_path): ssh_connection = sf_util.get_ssh_connection( TestData.secondary_storage_server, TestData.secondary_storage_server_username, TestData.secondary_storage_server_password) stdout = ssh_connection.exec_command( "ls -l " + TestData.secondary_storage_server_root + install_path + " | grep qcow2")[1] result = stdout.read() stdout = ssh_connection.exec_command( "ls -l " + TestData.secondary_storage_server_root + install_path + " | grep " + TestData.properties_file)[1] result2 = stdout.read() ssh_connection.close() return result, result2