[PATCH 08/19] KVM test: remove unused function is_sshd_running()

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

 



Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_utils.py |   46 -----------------------------------------
 client/tests/kvm/kvm_vm.py    |   15 -------------
 2 files changed, 0 insertions(+), 61 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index f686a53..ac9ede7 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -605,52 +605,6 @@ def netcat(host, port, username, password, prompt, timeout=10):
 
 # The following are utility functions related to ports.
 
-def is_sshd_running(host, port, timeout=10.0):
-    """
-    Connect to the given host and port and wait for output.
-    Return True if the given host and port are responsive.
-
-    @param host: Host's hostname
-    @param port: Host's port
-    @param timeout: Time (seconds) before we giving up on checking the SSH
-            daemon.
-
-    @return: If output is available, return True. If timeout expires and no
-            output was available, return False.
-    """
-    try:
-        # Try to connect
-        #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        s = socket.socket()
-        s.connect((host, port))
-    except socket.error:
-        # Can't connect -- return False
-        s.close()
-        logging.debug("Could not connect")
-        return False
-    s.setblocking(False)
-    # Wait up to 'timeout' seconds
-    end_time = time.time() + timeout
-    while time.time() < end_time:
-        try:
-            time.sleep(0.1)
-            # Try to receive some text
-            str = s.recv(1024)
-            if len(str) > 0:
-                s.shutdown(socket.SHUT_RDWR)
-                s.close()
-                logging.debug("Success! got string %r" % str)
-                return True
-        except socket.error:
-            # No text was available; try again
-            pass
-    # Timeout elapsed and no text was received
-    s.shutdown(socket.SHUT_RDWR)
-    s.close()
-    logging.debug("Timeout")
-    return False
-
-
 def is_port_free(port):
     """
     Return True if the given port is available for use.
diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 79ca81d..d360d8e 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -654,21 +654,6 @@ class VM:
         return self.process.get_pid()
 
 
-    def is_sshd_running(self, timeout=10):
-        """
-        Return True iff the guest's remote shell port is responsive.
-
-        @param timeout: Time (seconds) before giving up checking the daemon's
-                responsiveness.
-        """
-        address = self.get_address()
-        port = self.get_port(int(self.params.get("shell_port")))
-        if not address or not port:
-            logging.debug("IP address or port unavailable")
-            return False
-        return kvm_utils.is_sshd_running(address, port, timeout=timeout)
-
-
     def remote_login(self, nic_index=0, timeout=10):
         """
         Log into the guest via SSH/Telnet/Netcat.
-- 
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