[KVM-AUTOTEST PATCH 3/5] 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 4bc8dc7..09af62d 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.
@@ -635,7 +636,8 @@ 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 = kvm_subprocess.kvm_spawn(command)
+    sub.set_linesep(linesep)
     sub.set_prompt(prompt)
 
     password_prompt_count = 0
@@ -670,7 +672,7 @@ def remote_login(command, password, prompt, linesep="\n", timeout=10):
             sub.close()
             return None
         elif match == 4:  # "Connection refused"
-            kvm_log.debug("Got 'Connection refused'")
+            logging.debug("Got 'Connection refused'")
             sub.close()
             return None
         elif match == 5:  # prompt
@@ -702,7 +704,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_spawn(command)
 
     password_prompt_count = 0
     _timeout = login_timeout
@@ -733,9 +735,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