diff mbox

[KVM-AUTOTEST,v2] KVM test: enable file transfers for Windows guests

Message ID 1277814027-13573-1-git-send-email-mgoldish@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Goldish June 29, 2010, 12:20 p.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 46b0aa3..7cc2ffa 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -6,7 +6,7 @@  Utility classes and functions to handle Virtual Machine creation using qemu.
 """
 
 import time, socket, os, logging, fcntl, re, commands, glob
-import kvm_utils, kvm_subprocess, kvm_monitor
+import kvm_utils, kvm_subprocess, kvm_monitor, rss_file_transfer
 from autotest_lib.client.common_lib import error
 from autotest_lib.client.bin import utils
 
@@ -954,17 +954,22 @@  class VM:
         client = self.params.get("file_transfer_client")
         address = self.get_address(nic_index)
         port = self.get_port(int(self.params.get("file_transfer_port")))
-        log_filename = ("scp-%s-%s.log" %
-                        (self.name, kvm_utils.generate_random_string(4)))
 
         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
 
 
     def copy_files_from(self, remote_path, local_path, nic_index=0, timeout=600):
@@ -982,17 +987,22 @@  class VM:
         client = self.params.get("file_transfer_client")
         address = self.get_address(nic_index)
         port = self.get_port(int(self.params.get("file_transfer_port")))
-        log_filename = ("scp-%s-%s.log" %
-                        (self.name, kvm_utils.generate_random_string(4)))
 
         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
 
 
     def serial_login(self, timeout=10):
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 2c78cfc..c90415a 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -996,10 +996,12 @@  variants:
         password = 123456
         shell_linesep = "\r\n"
         shell_client = nc
-        shell_port = 22
-        # File transfers are currently unsupported
-        # file_transfer_client = scp
-        # file_transfer_port = 22
+        shell_port = 10022
+        file_transfer_client = rss
+        file_transfer_port = 10023
+        redirs += " file_transfer"
+        guest_port_remote_shell = 10022
+        guest_port_file_transfer = 10023
 
         # This ISO will be used for all tests except install:
         cdrom = windows/winutils.iso