From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Goldish Subject: Re: [PATCH] KVM Test: add -w parameter in nc command in kvm_utils.py Date: Wed, 20 Oct 2010 11:11:32 +0200 Message-ID: <4CBEB244.8080406@redhat.com> References: <1287557753-13831-1-git-send-email-fyang@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: autotest@test.kernel.org, kvm@vger.kernel.org To: Feng Yang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:59618 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750891Ab0JTJLf (ORCPT ); Wed, 20 Oct 2010 05:11:35 -0400 In-Reply-To: <1287557753-13831-1-git-send-email-fyang@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 10/20/2010 08:55 AM, Feng Yang wrote: > If a connection and stdin are idle for more than timeout seconds, > then the connection is silently closed. withou this paramter, > nc will listen forever for a connection. This may cause our test > hang. redmine issue: > http://redmine.englab.nay.redhat.com/issues/show/6947 > Add -w parameter should fix this issue. > > Signed-off-by: Feng Yang > --- > client/tests/kvm/kvm_utils.py | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py > index a51c857..526d38d 100644 > --- a/client/tests/kvm/kvm_utils.py > +++ b/client/tests/kvm/kvm_utils.py > @@ -733,7 +733,7 @@ def remote_login(client, host, port, username, password, prompt, linesep="\n", > elif client == "telnet": > cmd = "telnet -l %s %s %s" % (username, host, port) > elif client == "nc": > - cmd = "nc %s %s" % (host, port) > + cmd = "nc %s %s -w %s" % (host, port, timeout) > else: > logging.error("Unknown remote shell client: %s" % client) > return I don't understand how remote_login() can stall here. kvm_utils._remote_login() doesn't rely on nc's self-termination. If no shell prompt is available after 10 seconds, nc is forcefully terminated and _remote_login() fails. If it somehow stalls this might indicate a bug somewhere.