Beispiel #1
0
    def copy_files_to(self, local_path, remote_path, nic_index=0, timeout=600):
        """
        Transfer files to the guest.

        @param local_path: Host path
        @param remote_path: Guest path
        @param nic_index: The index of the NIC to connect to.
        @param timeout: Time (seconds) before giving up on doing the remote
                copy.
        """
        username = self.params.get("username", "")
        password = self.params.get("password", "")
        client = self.params.get("file_transfer_client")
        address = self.get_address(nic_index)
        port = self.get_port(int(self.params.get("file_transfer_port")))

        if not address or not port:
            logging.debug("IP address or port unavailable")
            return None

        if client == "scp":
            log_filename = ("scp-%s-%s.log" %
                            (self.name, kvm_utils.generate_random_string(4)))
            return kvm_utils.scp_to_remote(address, port, username, password,
                                           local_path, remote_path,
                                           log_filename, timeout)
        elif client == "rss":
            c = rss_file_transfer.FileUploadClient(address, port)
            c.upload(local_path, remote_path, timeout)
            c.close()
            return True
Beispiel #2
0
    def scp_to_remote(self, local_path, remote_path, timeout=300):
        """
        Transfer files to the guest via SCP.

        @param local_path: Host path
        @param remote_path: Guest path
        @param timeout: Time (seconds) before giving up on doing the remote
                copy.
        """
        username = self.params.get("username", "")
        password = self.params.get("password", "")
        address = self.get_address()
        port = self.get_port(int(self.params.get("ssh_port")))
        if not port:
            return None
        return kvm_utils.scp_to_remote(address, port, username, password,
                                       local_path, remote_path, timeout)
Beispiel #3
0
    def copy_files_to(self, local_path, remote_path, nic_index=0, timeout=300):
        """
        Transfer files to the guest.

        @param local_path: Host path
        @param remote_path: Guest path
        @param nic_index: The index of the NIC to connect to.
        @param timeout: Time (seconds) before giving up on doing the remote
                copy.
        """
        username = self.params.get("username", "")
        password = self.params.get("password", "")
        client = self.params.get("file_transfer_client")
        address = self.get_address(nic_index)
        port = self.get_port(int(self.params.get("file_transfer_port")))

        if not address or not port:
            logging.debug("IP address or port unavailable")
            return None

        if client == "scp":
            return kvm_utils.scp_to_remote(address, port, username, password, local_path, remote_path, timeout)