Skip to contentSkip to conversation

KVM Test: add -w parameter in nc command in kvm_utils.py

PATCH Feng Yang 2 participants 2 messages Oct 20, 2010 1 message not in the archive KVM

lore
Share & tools
lore

Feng Yang

author
#1 lore raw
In reply to a message not in the archive
Quoted 35 lines · ----- "Michael Goldish

From: "Michael Goldish" <[email protected]>
To: "Feng Yang" <[email protected]>
Cc: [email protected], [email protected]
Sent: Wednesday, October 20, 2010 5:11:32 PM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
Subject: Re: [PATCH] KVM Test: add -w parameter in nc command in kvm_utils.py

Quoted 7 lines · Feng Yang

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.

Review

Quoted 6 lines
---
 client/tests/kvm/kvm_utils.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/client/tests/kvm/kvm_utils.py

client/tests/kvm/kvm_utils.py def remote_login(client, host, port, username,

Quoted 4 lines

index a51c857..526d38d 100644

client/tests/kvm/kvm_utils.py +0 -0
@@ -733,7 +733,7 @@ def remote_login(client, host, port, username,

password, prompt, linesep="\n",

client/tests/kvm/kvm_utils.py def remote_login(client, host, port, username, · line 739

Quoted 8 lines
client/tests/kvm/kvm_utils.py +1 -1
     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
Quoted 8 lines

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.

It is really rarely reproduce. Only meet this issue when guest panic or core dump. nc stall. Do not know why it is not terminated after 10s.

I think -w parameter is helpful in this situation.
If it does not cause other issue, we'd better add -w in nc command.

Thanks for your command. What do you think?

Feng Yang

#2 lore raw
Quoted 49 lines · Feng Yang
Quoted 35 lines · ----- "Michael Goldish

From: "Michael Goldish" <[email protected]>
To: "Feng Yang" <[email protected]>
Cc: [email protected], [email protected]
Sent: Wednesday, October 20, 2010 5:11:32 PM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
Subject: Re: [PATCH] KVM Test: add -w parameter in nc command in kvm_utils.py

Quoted 7 lines · Feng Yang

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.

Review

Quoted 6 lines
---
 client/tests/kvm/kvm_utils.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/client/tests/kvm/kvm_utils.py

client/tests/kvm/kvm_utils.py def remote_login(client, host, port, username,

Quoted 4 lines

index a51c857..526d38d 100644

client/tests/kvm/kvm_utils.py +0 -0
@@ -733,7 +733,7 @@ def remote_login(client, host, port, username,

password, prompt, linesep="\n",

client/tests/kvm/kvm_utils.py def remote_login(client, host, port, username, · line 739

Quoted 8 lines
client/tests/kvm/kvm_utils.py +1 -1
     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
Quoted 8 lines

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.

It is really rarely reproduce. Only meet this issue when guest panic or core dump. nc stall. Do not know why it is not terminated after 10s.

Quoted 6 lines

I think -w parameter is helpful in this situation.
If it does not cause other issue, we'd better add -w in nc command.

Thanks for your command. What do you think?

Feng Yang

Adding -w 10 may cause trouble. If a good functional session is idle for more than 10 seconds during a test, it will be closed. For example, if you run a command that takes more than 10 seconds to complete, and produces no output while it runs, the session will be closed.

Also, I doubt it'll solve the problem you've experienced. As it is, the code should (and usually does) properly handle the case of nc not terminating.

If you manage to reproduce this again please save the log so I can have a look at it.