コード例 #1
0
ファイル: kvm_vm.py プロジェクト: ehabkost/my-autotest-hacks
    def copy_files_from(self, remote_path, local_path, nic_index=0, timeout=600):
        """
        Transfer files from the guest.

        @param local_path: Guest path
        @param remote_path: Host 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_from_remote(address, port, username, password,
                                             remote_path, local_path,
                                             log_filename, timeout)
        elif client == "rss":
            c = rss_file_transfer.FileDownloadClient(address, port)
            c.download(remote_path, local_path, timeout)
            c.close()
            return True
コード例 #2
0
ファイル: kvm_vm.py プロジェクト: yochow/autotest
    def scp_from_remote(self, remote_path, local_path, timeout=300):
        """
        Transfer files from the guest via SCP.

        @param local_path: Guest path
        @param remote_path: Host 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_from_remote(address, port, username, password,
                                         remote_path, local_path, timeout)
コード例 #3
0
ファイル: kvm_vm.py プロジェクト: wenhann/chromiumos
    def copy_files_from(self, remote_path, local_path, nic_index=0, timeout=300):
        """
        Transfer files from the guest.

        @param local_path: Guest path
        @param remote_path: Host 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_from_remote(address, port, username, password, remote_path, local_path, timeout)