From patchwork Wed Sep 9 18:12:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 46430 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n89IFh4X019155 for ; Wed, 9 Sep 2009 18:15:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753959AbZIISPf (ORCPT ); Wed, 9 Sep 2009 14:15:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753919AbZIISPf (ORCPT ); Wed, 9 Sep 2009 14:15:35 -0400 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 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n89IFZwF019281; Wed, 9 Sep 2009 14:15:36 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n89IFZ6p014410; Wed, 9 Sep 2009 14:15:35 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n89IFNFT012008; Wed, 9 Sep 2009 14:15:34 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: 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> In-Reply-To: <1252519932-30733-7-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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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.