Skip to contentSkip to conversation

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

PATCH In review Feng Yang 3 participants 4 messages Oct 20, 2010 – Oct 28, 2010 KVM

lore
Share & tools
lore

Feng Yang

author
#0 lore raw

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

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.

---
 client/tests/kvm/kvm_utils.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
client/tests/kvm/kvm_utils.py +1 -1
index a51c857..526d38d 100644
@@ -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
Signature · 1 line
1.6.5.2
#1 lore raw
Quoted 17 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.

---
 client/tests/kvm/kvm_utils.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
client/tests/kvm/kvm_utils.py +0 -0
index a51c857..526d38d 100644

client/tests/kvm/kvm_utils.py def remote_login(client, host, port, username, password, prompt, linesep="\n", · line 739

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

#2 lore raw
In reply to Feng Yang
Quoted 6 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.

Feng, for reasons already explained by Michael, I'll drop this patch from the queue and not apply it, OK?

Thanks!

Quoted 18 lines
---
 client/tests/kvm/kvm_utils.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
client/tests/kvm/kvm_utils.py +1 -1
index a51c857..526d38d 100644
@@ -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
author
#3 lore raw
Quoted 14 lines · ----- "Lucas Meneghel Rodrigues

From: "Lucas Meneghel Rodrigues" <[email protected]>
To: "Feng Yang" <[email protected]>
Cc: [email protected], [email protected]
Sent: Thursday, October 28, 2010 4:26:17 AM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
Subject: Re: [Autotest] [PATCH] KVM Test: add -w parameter in nc command in kvm_utils.py

Quoted 6 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.

Quoted 2 lines

Feng, for reasons already explained by Michael, I'll drop this patch from the queue and not apply it, OK?

Yes, please drop it. Thanks!

Quoted 29 lines

Thanks!

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, password, prompt, linesep="\n", · 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html