[KVM-AUTOTEST PATCH 03/17] Modify remote_login and remote_scp in kvm_utils to use kvm_subprocess

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

 



Also remove a reference to kvm_log that was left behind.

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_utils.py |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index b2b0d1a..fb587c5 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -2,6 +2,7 @@ import md5, thread, subprocess, time, string, random, socket, os, signal, pty
 import select, re, logging
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib import error
+import kvm_subprocess
 
 """
 KVM test utility functions.
@@ -631,8 +632,9 @@ def remote_login(command, password, prompt, linesep="\n", timeout=10):
 
     @return Return the kvm_spawn object on success and None on failure.
     """
-    sub = kvm_spawn(command, linesep)
-    sub.set_prompt(prompt)
+    sub = kvm_subprocess.kvm_shell_session(command,
+                                           linesep=linesep,
+                                           prompt=prompt)
 
     password_prompt_count = 0
 
@@ -698,7 +700,7 @@ def remote_scp(command, password, timeout=300, login_timeout=10):
 
     @return: True if the transfer succeeds and False on failure.
     """
-    sub = kvm_spawn(command)
+    sub = kvm_subprocess.kvm_expect(command)
 
     password_prompt_count = 0
     _timeout = login_timeout
@@ -729,9 +731,10 @@ def remote_scp(command, password, timeout=300, login_timeout=10):
             sub.close()
             return False
         else:  # match == None
-            logging.debug("Timeout or process terminated")
+            logging.debug("Timeout elapsed or process terminated")
+            status = sub.get_status()
             sub.close()
-            return sub.poll() == 0
+            return status == 0
 
 
 def scp_to_remote(host, port, username, password, local_path, remote_path,
-- 
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