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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will only work with the most recent rss.exe.

Usage examples:

vm.copy_files_from(r'C:\foobar\*', test.debugdir, timeout=30)
vm.copy_files_from(r'%SystemRoot%\memory.dmp', '/tmp/', timeout=60)
vm.copy_files_to('/usr/local', r'C:\Windows', timeout=600)

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_vm.py             |   20 +++++++++++++++-----
 client/tests/kvm/tests_base.cfg.sample |    7 ++++---
 2 files changed, 19 insertions(+), 8 deletions(-)

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..94e2d6f 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -997,9 +997,10 @@ variants:
         shell_linesep = "\r\n"
         shell_client = nc
         shell_port = 22
-        # File transfers are currently unsupported
-        # file_transfer_client = scp
-        # file_transfer_port = 22
+        file_transfer_client = rss
+        file_transfer_port = 23
+        redirs += " file_transfer"
+        guest_port_file_transfer = 23
 
         # This ISO will be used for all tests except install:
         cdrom = windows/winutils.iso
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux