Merge lp:~qzhang/lava-dispatcher/gen-test-tarball into lp:lava-dispatcher
Status: | Rejected |
---|---|
Rejected by: | Spring Zhang |
Proposed branch: | lp:~qzhang/lava-dispatcher/gen-test-tarball |
Merge into: | lp:lava-dispatcher |
Diff against target: |
127 lines (+83/-1) 2 files modified
lava/actions/deploy.py (+73/-1) lava/config.py (+10/-0) |
To merge this branch: | bzr merge lp:~qzhang/lava-dispatcher/gen-test-tarball |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paul Larson (community) | Needs Fixing | ||
Review via email: mp+51733@code.launchpad.net |
Description of the change
Implement generate_tarballs interface based on new base
1. refactor on generate_tarballs()
2. use Popen() instead of system()
3. add unit test, but haven't pass unit test yet
4. Fix some error in lava-dispatch file
will fix errors later
Unmerged revisions
- 17. By Spring Zhang
-
Modification according to comments:
1. move hard code to config.py
2. remove sleep instructions
3. fix tar bug: ~ not recognized and -C
4. use /tmp as temp directory
5. remove self test code
6. add message in exception - 16. By Spring Zhang
-
pull from lp:lava r15
- 15. By Spring Zhang
-
1. refactor on generate_tarballs()
2. use Popen() instead of system()
3. add unit test - 14. By Spring Zhang
-
Fix no params error
- 13. By Spring Zhang
-
fix BOARD_TYPE reference
- 12. By Spring Zhang
-
implement generate_tarballs interface
- 11. By Spring Zhang
-
Merged from lp:lava r11
Paul Larson 2011-02-28 [merge] Merge some quickstart documentation and add --help
Loïc Minier 2011-02-26 Add quickstart with random notes to get started.
Loïc Minier 2011-02-26 Add sample JSON file from the spec.
Loïc Minier 2011-02-26 Test sys.argv's length and output usage information when it's too short or when
Paul Larson 2011-02-28 [merge] Merge some misc cleanups
Loïc Minier 2011-02-26 Small simplification of the handling of the default parameters value.
Loïc Minier 2011-02-26 Drop unused identifier "id" as the expect() return value isn't checked there.
Loïc Minier 2011-02-26 Drop useless try/except/raise construct.
Loïc Minier 2011-02-26 Add missing definition of expected response (master_str). - 10. By Spring Zhang
-
Add mx51evk test image uboot command, move board info to LavaClient for re-use
On Tue, Mar 01, 2011, Spring Zhang wrote: 'parameters' , {}) 'parameters' , {})
> --- lava-dispatch 2011-03-01 03:56:20 +0000
> +++ lava-dispatch 2011-03-01 11:48:59 +0000
> - cmd.get(
> + params = cmd.get(
Wups, thanks!
> step = lava_commands[ cmd['command' ]](target) deploy. py' deploy. py 2011-02-26 14:41:09 +0000 deploy. py 2011-03-01 11:48:59 +0000 linaro_ image(BaseActio n):
> step.run(**params)
>
> === modified file 'lava/actions/
> --- lava/actions/
> +++ lava/actions/
> @@ -1,33 +1,118 @@
> #!/usr/bin/python
> from lava.actions import BaseAction
> +from lava.client import LavaClient
> import time
> +from subprocess import PIPE
> +from subprocess import Popen
> +import shutil
> +import shlex
>
> class cmd_deploy_
> + #board type: [bootfs partition index, rootfs partition index]
> + BOARD_PARTS = {
> + "panda": [1, 2],
> + "beagle": [1, 2],
> + "vexpress": [1, 2],
> + "mx51evk": [2, 3],
It's a bit sad to hardcode this
The immediate thing I would have proposed would be to have a config
file, but in reality I'm thinking we want to work towards not knowing
the partition layout at all.
> + #use l-m-c to install hwpack and rootfs to qemu image media-create --rootfs ext3 --image_file %s" \
> + #assume root permission
> + hwpack_name = hwpack.rsplit("/", 1)[1]
> + rootfs_name = rootfs.rsplit("/", 1)[1]
> + qemuimg = "%s_sd.img" % boardtype
> + lmc_cmd = "linaro-
> + " --dev %s --binary %s --hwpack %s" % (qemuimg, boardtype,
> + rootfs_name, hwpack_name)
Hmm why do you actually need to pass just the filename to l-m-c? Just
pass hwpack_name and rootfs_name directly?
> + print "l-m-c command: %s" % lmc_cmd split(lmc_ cmd), stdin=PIPE, stdout=PIPE,
> +
> + #TODO: should import l-m-c to use python way,
> + # and l-m-c supports no keyboard-input
> + """
> + proc = Popen(shlex.
> + stderr=PIPE)
> + output, rc = proc.communicate()
You don't seem to use the output at all; use proc.wait() instead? if
you don't want to see it on the console, open /dev/null and pass that
as stdout / stderr.
> + if proc.returncode != 0:
> + print "l-m-c fails"
> + raise OperationFailed()
Would be good to return a message in OperationFailed():
" linaro- media-create failed with %s" % proc.returncode)
if proc.returncode != 0:
raise OperationFailed(
> + #package qemu image content to tarballs
> + #an ugly tar, need to find a way to create tar in relative path,
> + #maybe tarfile
> + qemu_img_cmds = [ "modprobe nbd max_part=8",
> + "qemu-nbd --connect=/dev/nbd0 %s" % qemuimg,
Do we need to modprovbe nbd explicitly?
> + "mkdir -p /mnt/bootfs",
> + "sleep 2",
a comment on why the sleep is needed would be nice
> + "mount /dev/nbd0p%s /mnt/bootfs" % self.BOARD_ PARTS[boardtype ][0],
> + "cd /mnt/bootfs",
> + "tar czf ~/%s ." % hwpack_name,
tar -C to change directory; e.g. tar -C /mnt/bootfs czf foo.tgz .
/mnt/bootfs sou...