Skip to contentSkip to conversation

telnet login fails in win2k8 DC 64. here are debug and other info

AUTOTEST Michael Goldish 1 participant 1 message Aug 4, 2009 1 message not in the archive KVM

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 70 lines · ----- "sudhir kumar
Quoted 4 lines · Michael Goldish
Quoted 1 line · ----- "sudhir kumar

On Tue, Aug 4, 2009 at 5:01 PM, Michael

Goldish<[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:

Maybe the problem is related to how you implemented TAP support

in

Quoted 1 line
Quoted 1 line
Quoted 1 line

your tree.  You're obviously not using user mode networking

because

Quoted 9 lines
Quoted 9 lines

I do not understand what do you mean here. Yes the setup is a tap network and I can login into the guest using the same command manually. Here is the output

# telnet -l Administrator 10.0.99.100 23
Trying 10.0.99.100...
Connected to ichigo-dom100.linuxperf9025.net (10.0.99.100).
Escape character is '^]'.
Welcome to Microsoft Telnet Service
Quoted 8 lines
Quoted 8 lines

password:

*===============================================================
Microsoft Telnet Server.
*===============================================================
C:\Users\Administrator>

Quoted 1 line

the guest's IP address is 10.0.99.100.  I'm not sure exactly

what

Quoted 4 lines
Quoted 4 lines

the

Quoted 1 line

problem is, so can you print the connection command in

remote_login()?

Quoted 1 line

Add something like 'print "COMMAND: " + command' at the top of

the

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

function, and that might help us figure out what's wrong.

Here is the command:
23:35:13 INFO | COMMAND: telnet -l Administrator 10.0.99.100 23

Quoted 14 lines
Quoted 6 lines

So on further inspection the problem limits to that read_nonblocking()
 is reading only 3 lines. So the culprit may be the following code data = ""
        while True:
            r, w, x = select.select([self.fd], [], [], timeout)

Quoted 8 lines

            if self.fd in r:
                try:
                    data += os.read(self.fd, 1024) except OSError:
                    return data
            else:
                return data
in this function. Since all the 5 lines(including last empty line)

do

Quoted 1 line
Quoted 1 line

not appear in one go it is possible that select() returns before

the

Quoted 2 lines
Quoted 2 lines

whole lines have been writen to the file pointed by fd and read() reads only those 3 lines(which looks to be less likely). I observe

a

Quoted 1 line
Quoted 1 line

slight delay in printing the lines. First 3 lines are printed in

one

Quoted 2 lines
Quoted 2 lines

go and the last two lines are printed after a very small(< 1 sec) time. What do you say? I will try by putting one more call to

read()

Quoted 3 lines
Quoted 1 line

and see what happens.

I don't think that'll help because it's OK to get 3 lines, wait a

little,

Quoted 2 lines

and then get 2 more lines.  read_until_output_matches() calls read_nonblocking() repeatedly to read output from the Telnet

Quoted 8 lines

process, so

Quoted 1 line

pauses in output from the process are OK.

At this point my head is out of thoughts. Even putting a time.sleep() before os.read() does not print any more lines. double read() statement causes an indefinite wait after the telnet server starts running in the guest. I am clueless now. Anyone else who faced the same problem?
/me beats his head.....

Like I said, the problem is not likely to be in read_until_output_matches() or read_nonblocking(). It's normal for read() to cause an indefinite wait because it's a blocking function, so when there's nothing to read, it waits.
time.sleep() shouldn't help either because there's simply nothing more to read.

If I were you, I'd add a little debug print in remote_login(), to print the command used to log in, just to make sure the command you run by hand equals the command used by autotest.
Simply add 'print "COMMAND: " + command' to the top of remote_login() and then run the test again and look at the logs.

Quoted 342 lines
Quoted 1 line

I thought it was a good idea to print the login command because

although

Quoted 1 line

the IP is OK, maybe the port isn't, and in the logs we don't see

what

Quoted 7 lines

port ssh_login() is actually trying to connect to.

Quoted 5 lines
Quoted 5 lines

----- Original Message -----
From: "sudhir kumar" <[email protected]>
To: "Michael Goldish" <[email protected]>
Cc: "Lucas Meneghel Rodrigues" <[email protected]>, "Ryan

Harper"

Quoted 2 lines
Quoted 2 lines

<[email protected]>, "kvm-devel" <[email protected]>

Quoted 1 line

Sent: Tuesday, August 4, 2009 9:43:42 AM (GMT+0200)

Auto-Detected

Quoted 1 line
Quoted 1 line
Quoted 1 line

Subject: Re: [AUTOTEST]telnet login fails in win2k8 DC 64. here

are

Quoted 5 lines
Quoted 5 lines

debug and  other info

Quoted 4 lines

For making it more clear here are the timoeout debug prints

14:31:04 INFO | ('DEBUG: timeout in read_until_output_matches

=%d',

Quoted 7 lines
Quoted 7 lines

30)

Quoted 1 line

14:31:04 INFO | ('DEBUG: internal_timeout in

read_until_output_matches

Quoted 4 lines

=%d', 3.5)
{sorry with little syntax typo :(  }

On Tue, Aug 4, 2009 at 12:12 PM, sudhir

kumar<[email protected]>

Quoted 5 lines
Quoted 5 lines
Quoted 1 line · wrote:
Quoted 1 line

On Tue, Aug 4, 2009 at 11:23 AM, Michael

Quoted 2 lines · Goldish
Quoted 2 lines
Quoted 2 lines

Looks like there really are only 3 lines to read. Telnet is printing those lines, not windows. It's just

indicating

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

that it successfully connected. Windows is saying nothing.

This is a little weird, because:
- It can happen when the telnet server isn't running at all, but it seemed to be running fine when you connected manually.
- It can happen when trying to connect to the wrong port, but

I

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

 see you set the port to 23.

It can also happen due to the short default timeout of 10

seconds.

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

Windows can take longer than that to send something.

My manual observation also says that it does not take that

much.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Are you sure you increased the timeout? You only sent a log of

4

Quoted 9 lines
Quoted 9 lines
Quoted 1 line
Quoted 1 line

I increased the timeout and did not send the complete log. here

are

Quoted 4 lines
Quoted 4 lines

the start and end of the complete log

12:26:44 INFO | Waiting for guest to be up...
12:26:44 INFO | DEBUG: in ssh_login ssh_prompt =

C:\Users\Administrator>

Quoted 2 lines
Quoted 2 lines

12:26:44 INFO | DEBUG: in ssh_login timeout = 20 12:26:47 INFO | DEBUG: Printing data read by read_nonblocking

from

Quoted 4 lines
Quoted 4 lines

output:

Quoted 1 line
Quoted 1 line

12:26:47 INFO | DEBUG: data read from output is Trying

10.0.99.100...

Quoted 1 line
Quoted 1 line

12:26:47 INFO | telnet: connect to address 10.0.99.100: No route

to

Quoted 2 lines
Quoted 2 lines

host

Quoted 1 line
Quoted 1 line

12:26:47 INFO | telnet: Unable to connect to remote host: No

route

Quoted 5 lines
Quoted 5 lines

to host

Quoted 4 lines
Quoted 4 lines

<snip>

12:30:48 INFO | DEBUG: Printing accumulated data read from

output

Quoted 3 lines
Quoted 3 lines

done.

Quoted 2 lines
Quoted 2 lines

12:30:48 INFO | DEBUG: Printing data after filter:
12:30:48 INFO | DEBUG: filtered data is Escape character is

'^]'.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

12:30:48 INFO | DEBUG: Printing data after filter done:
12:30:50 ERROR| Test failed: Could not log into guest

Quoted 2 lines

seconds (starting at 12:27:25). How long does read_until_output_matches() wait before it gives up?

Here is the complete code flow with parameters.
in kvm_tests.py
   session = kvm_utils.wait_for(vm.ssh_login, 240, 0, 2) which calls in kvm_utils.py
       output = func()
This calls ssh_login() in kvm_vm.py with default parameters and

Quoted 5 lines
Quoted 5 lines

the

Quoted 4 lines
Quoted 4 lines

default def is changed to have timeout 20 second instead of 10 seconds.
   def ssh_login(self, timeout=20):
This calls the telnet which calls remote_login() in

kvm_utils.py

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

       if use_telnet:
           session = kvm_utils.telnet(address, port, username,

password,

Quoted 3 lines
Quoted 3 lines

                                      prompt, timeout) So timeout is 20 now. This calls remote_login return remote_login(command, password, prompt, "\r\n",

timeout)

Quoted 12 lines
Quoted 12 lines
Quoted 1 line
Quoted 1 line

PS: A dumb Question: Does "\r\n" have to do something with the

failure ?

Quoted 4 lines
Quoted 4 lines

So timeout is still 20. The next call is
   while True:
       (match, text) = sub.read_until_last_line_matches( [r"[Aa]re you sure", r"[Pp]assword:\s*$",

r"^\s*[Ll]ogin:\s*$",

Quoted 1 line
Quoted 1 line

                r"[Cc]onnection.*closed",

r"[Cc]onnection.*refused", prompt],

Quoted 3 lines
Quoted 3 lines

                timeout=timeout, internal_timeout=3.5) which calls to
       return self.read_until_output_matches(patterns,

Quoted 6 lines
Quoted 6 lines

self.get_last_line,

Quoted 1 line
Quoted 1 line

                                             timeout,

internal_timeout,

Quoted 3 lines
Quoted 3 lines

                                             print_func)

Hence this function waits for 20 seconds in each try. i think

that

Quoted 4 lines
Quoted 4 lines

is

Quoted 3 lines
Quoted 3 lines

good enough.

In my manual observation there is no delay between the above

all

Quoted 2 lines
Quoted 2 lines

the

Quoted 1 line
Quoted 1 line

lines printed. So this should not be an issue. I can bet that

there

Quoted 6 lines
Quoted 6 lines

is

Quoted 5 lines
Quoted 5 lines

not even a delay of 2 secs between these two lines:
 Escape character is '^]'.
 Welcome to Microsoft Telnet Service

But yes there is a very small delay(looks < 1 second), which

should

Quoted 2 lines
Quoted 2 lines

be

Quoted 1 line
Quoted 1 line

taken care by increased internal_timeout which i have increased

to

Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines

around 3 seconds.

Quoted 5 lines

----- Original Message -----
From: "sudhir kumar" <[email protected]>
To: "kvm-devel" <[email protected]>
Cc: "Lucas Meneghel Rodrigues" <[email protected]>, "Michael

Goldish" <[email protected]>, "Ryan Harper" <[email protected]>

Quoted 1 line
Quoted 1 line
Quoted 1 line

Sent: Tuesday, August 4, 2009 8:06:32 AM (GMT+0200)

Auto-Detected

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Subject: [AUTOTEST]telnet login fails in win2k8 DC 64. here

are

Quoted 16 lines
Quoted 16 lines

debug and  other info

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Hi,
I am seeing a telnet failure in autotest to a win2k8 DC 64 bit

guest.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I have tried some debugging and came to a conclusion that read_nonblocking() is reading only 3 lines. let me first print

the

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

output of manual login

 # telnet -l Administrator 10.0.99.100 23
Trying 10.0.99.100...
Connected to ichigo-dom100.linuxperf9025.net (10.0.99.100).
Escape character is '^]'.
Welcome to Microsoft Telnet Service
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

password:

*===============================================================

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Microsoft Telnet Server.

*===============================================================

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

C:\Users\Administrator>

Now autotest only reads the first 3 lines(upto Escape.....).

It

Quoted 10 lines
Quoted 10 lines

seems

Quoted 1 line
Quoted 1 line
Quoted 1 line

windows is doing something nasty here. I have put some debug

prints in

Quoted 1 line
Quoted 1 line
Quoted 1 line

the code and here is the output. let me first put the code

snippet

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

from kvm_utils.py with added debug prints.

   def read_until_output_matches(self, patterns,

filter=lambda(x):x,

Quoted 1 line
Quoted 1 line
Quoted 1 line

                                 timeout=30.0,

Quoted 8 lines
Quoted 8 lines

internal_timeout=3.0,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

                                 print_func=None):
<snip>
       end_time = time.time() + timeout
       while time.time() < end_time:
           # Read data from child
           newdata = self.read_nonblocking(internal_timeout) print("DEBUG: Printing data read by

read_nonblocking

Quoted 2 lines
Quoted 2 lines

from output:")

Quoted 1 line
Quoted 1 line
Quoted 1 line

           print("DEBUG: data read from output is %s" %

newdata)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

           print("DEBUG: Printing data read by

read_nonblocking

Quoted 9 lines
Quoted 9 lines

from

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

output done.")
           # Print it if necessary
           if print_func and newdata:
               map(print_func, newdata.splitlines()) data += newdata
           print("DEBUG: Printing accumulated data read from

output:")

Quoted 1 line
Quoted 1 line
Quoted 1 line

           print("DEBUG: accumulated data read from output is

%s"

Quoted 4 lines
Quoted 4 lines

% data)

Quoted 1 line
Quoted 1 line
Quoted 1 line

           print("DEBUG: Printing accumulated data read from

output done.")

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

           done = False
           # Look for patterns
           print("DEBUG: Printing data after filter:") print("DEBUG: filtered data is %s" % filter(data)) print("DEBUG: Printing data after filter done:") match = self.match_patterns(filter(data), patterns) if match != None:
               done = True
           # Check if child has died
           if self.poll() != None:
               logging.debug("Process terminated with status

%d",

Quoted 9 lines
Quoted 9 lines

self.poll())

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

               done = True
           # Are we done?
           if done: break
<snip>

Here is the output once the guest comes up.

12:27:25 INFO | DEBUG: Printing data read by read_nonblocking

from

Quoted 8 lines
Quoted 8 lines

output:

Quoted 1 line
Quoted 1 line
Quoted 1 line

12:27:25 INFO | DEBUG: data read from output is Trying

10.0.99.100...

Quoted 1 line
Quoted 1 line
Quoted 1 line

12:27:25 INFO | Connected to ichigo-dom100.linuxperf9025.net

(10.0.99.100).

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
12:27:25 INFO | Escape character is '^]'.
12:27:25 INFO |
12:27:25 INFO | DEBUG: Printing data read by read_nonblocking

from

Quoted 11 lines
Quoted 11 lines

output done.

Quoted 1 line
Quoted 1 line
Quoted 1 line

12:27:25 INFO | DEBUG: Printing accumulated data read from

output:

Quoted 1 line
Quoted 1 line
Quoted 1 line

12:27:25 INFO | DEBUG: accumulated data read from output is

Trying

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

10.0.99.100...
12:27:25 INFO | Connected to ichigo-dom100.linuxperf9025.net

(10.0.99.100).

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
12:27:25 INFO | Escape character is '^]'.
12:27:25 INFO |
12:27:25 INFO | DEBUG: Printing accumulated data read from

output

Quoted 3 lines
Quoted 3 lines

done.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

12:27:25 INFO | DEBUG: Printing data after filter:
12:27:25 INFO | DEBUG: filtered data is Escape character is

'^]'.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

12:27:25 INFO | DEBUG: Printing data after filter done:
12:27:29 INFO | DEBUG: Printing data read by read_nonblocking

from

Quoted 3 lines
Quoted 3 lines

output:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

12:27:29 INFO | DEBUG: data read from output is 12:27:29 INFO | DEBUG: Printing data read by read_nonblocking

from

Quoted 11 lines
Quoted 11 lines

output done.

Quoted 1 line
Quoted 1 line
Quoted 1 line

12:27:29 INFO | DEBUG: Printing accumulated data read from

output:

Quoted 1 line
Quoted 1 line
Quoted 1 line

12:27:29 INFO | DEBUG: accumulated data read from output is

Trying

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

10.0.99.100...
12:27:29 INFO | Connected to ichigo-dom100.linuxperf9025.net

(10.0.99.100).

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
12:27:29 INFO | Escape character is '^]'.
12:27:29 INFO |
12:27:29 INFO | DEBUG: Printing accumulated data read from

output

Quoted 3 lines
Quoted 3 lines

done.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

12:27:29 INFO | DEBUG: Printing data after filter:
12:27:29 INFO | DEBUG: filtered data is Escape character is

'^]'.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

12:27:29 INFO | DEBUG: Printing data after filter done:

and so on... timeout elapses and test fails.

I am not able to find out why read_nonblocking() is reading

only

Quoted 2 lines
Quoted 2 lines

3

Quoted 1 line
Quoted 1 line
Quoted 1 line

lines. I have tried increasing the timeouts and

internal_timeouts

Quoted 5 lines
Quoted 5 lines

as

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

well. But no luck.

Here is how my kvm_tests.cfg looks like.

# colorful prompt, so migration_test_command will fail, try

with

Quoted 31 lines
Quoted 30 lines

telnet

Quoted 11 lines
Quoted 11 lines
Quoted 8 lines

               ssh_prompt = "C:\Users\Administrator>" ssh_port = 23
               use_telnet = yes
Any clues ?

--
Sudhir Kumar

Quoted 9 lines
Quoted 3 lines

--
Sudhir Kumar

--
Sudhir Kumar

--
Sudhir Kumar
--
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

Signature · 1 line
Sudhir Kumar