From: Michael Goldish Subject: [PATCH 08/19] KVM test: remove unused function is_sshd_running() Date: Wed, 9 Sep 2009 21:12:01 +0300 Message-ID: <1252519932-30733-8-git-send-email-mgoldish@redhat.com> References: <1252519932-30733-1-git-send-email-mgoldish@redhat.com> <1252519932-30733-2-git-send-email-mgoldish@redhat.com> <1252519932-30733-3-git-send-email-mgoldish@redhat.com> <1252519932-30733-4-git-send-email-mgoldish@redhat.com> <1252519932-30733-5-git-send-email-mgoldish@redhat.com> <1252519932-30733-6-git-send-email-mgoldish@redhat.com> <1252519932-30733-7-git-send-email-mgoldish@redhat.com> Cc: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:17799 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753945AbZIISPd (ORCPT ); Wed, 9 Sep 2009 14:15:33 -0400 In-Reply-To: <1252519932-30733-7-git-send-email-mgoldish@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Michael Goldish --- 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