Can't get the test result from the board

Bug #906772 reported by Le Chi Thu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
LAVA Dispatcher
Fix Released
Critical
Michael Hudson-Doyle

Bug Description

Email from Chi Thu

Hi

I do not understand why the get_master_ip return wrong ip address ?

Here is the code in the lava-dispatcher

   def get_master_ip(self):
       #get master image ip address
       try:
           self.wait_network_up()
       except:
           logging.warning(traceback.format_exc())
           return None
       #tty device uses minimal match, see pexpect wiki
       #pattern1 = ".*\n(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
       pattern1 = "(\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?)"
       cmd = ("ifconfig %s | grep 'inet addr' | awk -F: '{print $2}' |"
               "awk '{print $1}'" % self._client.default_network_interface)
       self.run(
           cmd, [pattern1, pexpect.EOF, pexpect.TIMEOUT], timeout=5)
       if self.match_id == 0:
           logging.info("\nmatching pattern is %s" % self.match_id)
           ip = self.match.groups()[0]
           logging.info("Master IP is %s" % ip)
           return ip
       return None

In the log file from job
http://validation.linaro.org/lava-server/scheduler/job/6078

--- 192.168.1.10 ping statistics ---

1 packets transmitted, 1 received, 0% packet loss, time 0ms

rtt min/avg/max/mdev = 0.579/0.579/0.579/0.000 ms

root@master:/tmp# [rc=0]: ifconfig eth0 | grep 'inet addr' | awk -F:
'{print $2}' |awk '{print $1}'
ifconfig eth0 | grep 'inet addr' | awk -F: '{print $2
}' |awk '{print $1}'

192.168.1.152

root@master:/tmp# [rc=0]: <LAVA_DISPATCHER>2011-12-16 10:04:17 PM INFO:
matching pattern is 0
<LAVA_DISPATCHER>2011-12-16 10:04:17 PM INFO: Master IP is 192.168.1.1
python -m SimpleHTTPServer 80 &> /dev/null &

BR

/Chi Thu

reply from mwhudson:

The only thing I can think of is that for some reason pexpect received
just the "192.168.1.1" part of the ip address first, which matches the
regexp of course, returned that as the matched, then the "52" part came
in after this had been processed. I don't know enough about how pexpect
works to know if this is plausible, but if this is the problem I guess
we can fix it by getting awk to print out some delimiters for the ip
address, e.g. changing the last invocation to awk '{ print "<" $1 ">" }'
and including the delimiters in the regexp.

I suggest filing a bug as the next course of action :-)

Cheers,
mwh

Revision history for this message
Spring Zhang (qzhang) wrote :

pexpect use the minimal match in serial devices, but pattern is provided with enough: ".\d?\d?\d?", the only thing I can imagine is the buffer is not sent all when match.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I don't know how we got away with this for so many months, but it's causing real problems now. The fix should be simple, luckily.

Changed in lava-dispatcher:
status: New → Confirmed
importance: Undecided → Critical
Changed in lava-dispatcher:
status: Confirmed → Fix Committed
milestone: none → 2012.01
Le Chi Thu (le-chi-thu)
Changed in lava-dispatcher:
assignee: nobody → Le Chi Thu (le-chi-thu)
Le Chi Thu (le-chi-thu)
Changed in lava-dispatcher:
assignee: Le Chi Thu (le-chi-thu) → Michael Hudson-Doyle (mwhudson)
Changed in lava-dispatcher:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.