Merge lp://staging/~qzhang/lava-dispatcher/reliable-result-transfer into lp://staging/lava-dispatcher

Proposed by Spring Zhang
Status: Merged
Merged at revision: 84
Proposed branch: lp://staging/~qzhang/lava-dispatcher/reliable-result-transfer
Merge into: lp://staging/lava-dispatcher
Diff against target: 232 lines (+68/-87)
4 files modified
lava_dispatcher/actions/launch_control.py (+47/-86)
lava_dispatcher/client.py (+19/-0)
lava_dispatcher/config.py (+1/-0)
lava_dispatcher/utils.py (+1/-1)
To merge this branch: bzr merge lp://staging/~qzhang/lava-dispatcher/reliable-result-transfer
Reviewer Review Type Date Requested Status
Paul Larson (community) Approve
Spring Zhang (community) Needs Resubmitting
Review via email: mp+71341@code.staging.launchpad.net

Description of the change

Tested on normal image except one issue-download() fails to get lava_result.tgz, other part pass.

1. For getting the master image IP, I use enumerating, it may waste some time, but I can't get better idea now, it needs to install python-netaddr package on server.
2. For python-minimal, I use development branch master image now, it includes SimpleHTTPServer, I didn't get a chance to check nano yet.
3. It now gets IP by eth0, if there is no network_interface member in self.client.board.
4. Add a new macro LAVA_MASTER_NETWORK in config.py to provide the validation farm IP range.
5. Update Android part code.

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

174 + def enum_master_ip(self, network):
175 + #store ip in myip of current path
176 + print "Determine master image IP"
177 + client = self.client
178 + try:
179 + if client.board.network_interface:
180 + eth_device = client.board.network_interface
181 + else:
182 + eth_device = "eth0"
183 + except:
184 + eth_device = "eth0"
185 + cmd = ("ifconfig %s | grep 'inet addr' | awk -F: '{print $2}' |"
186 + "awk '{print $1}' > myip" % eth_device)
187 + client.run_shell_command(cmd, response=MASTER_STR)
188 + for ip in IPNetwork(network):
189 + try:
190 + client.run_shell_command('cat myip',
191 + response=str(ip), timeout=2)
This is pretty complicated, and fails to deal with the fact that some boards may need to have some other interface, say usb0 for instance. I think there's two things we need to do around this:
1. Add a config item for the network interface we will use (using the new config files would be great for this!)
2. simplify this by just running ifconfig ont hat interface, and using expect to match the pattern

97 + client.proc.sendline('python -m SimpleHTTPServer 80')
98 + time.sleep(5)
Instead, why not just run 'python -m SimpleHTTPServer &> /dev/null &' and expect the shell prompt back? Then when it's over, we can just kill %1 to end the process.

review: Needs Fixing
Revision history for this message
David Schwarz (david-schwarz) wrote :

   Not sure if this helps, but we were thinking about devices with one
or more interfaces when discussing the new config system here. We were
thinking of something along the lines of:

----

File: niftyboard01.conf

[machine]
stuff=things
more_stuff = other things
interfaces = eth0, eth1, usb0

[eth0]
mac_addr = 11:22:33:44:55:66
ip_addr = 192.168.1.1

[eth1]
mac_addr = 22:33:44:55:66:77
ip_addr = 192.168.1.5

etc.

----

   Internally, you can then easily represent the interfaces for each
machine as a list of dictionaries.

David

Revision history for this message
Paul Larson (pwlars) wrote :

What about also adding a default_interface config item? This would point to the nic that could be used to communicate with the controller for gathering results, or whatever else is needed.

Revision history for this message
Paul Larson (pwlars) wrote :

I don't think this has been tested, when I tried to run with it, there were some quickly noticeable problems:

51 + bundle = "/tmp/%s/%s", % (LAVA_RESULT_DIR, bundle_name)
No comma there

189 + try:
190 + client.run_shell_command('cat myip',
191 + response=str(ip), timeout=2)
Indent

89. By Spring Zhang

use string match to determine master IP

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

> I don't think this has been tested, when I tried to run with it, there were
> some quickly noticeable problems:
>
> 51 + bundle = "/tmp/%s/%s", % (LAVA_RESULT_DIR, bundle_name)
> No comma there
The normal image code is tested but download() fails. On Android part code, it is modified after I tested normal image, but I have no available android board to test, so I modify it and push. I have fixed the bug when I find it unable to run on recent commits.

>
> 189 + try:
> 190 + client.run_shell_command('cat myip',
> 191 + response=str(ip), timeout=2)
> Indent

90. By Spring Zhang

adjust download timeout

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

change to match IP determination way

review: Needs Resubmitting
91. By Spring Zhang

change log to null device

Revision history for this message
Paul Larson (pwlars) wrote :

22 +from netaddr import IPNetwork
no longer needed

Otherwise, looks good. I'll try to get this merged today. The downloading worked fine for me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches