Merge lp:~qzhang/lava-dispatcher/another-inject-kernel into lp:lava-dispatcher

Proposed by Spring Zhang
Status: Merged
Merged at revision: 110
Proposed branch: lp:~qzhang/lava-dispatcher/another-inject-kernel
Merge into: lp:lava-dispatcher
Diff against target: 309 lines (+159/-14)
6 files modified
doc/android-new-kernel.json (+37/-0)
doc/lava-new-kernel.json (+30/-0)
lava_dispatcher/actions/android_deploy.py (+28/-7)
lava_dispatcher/actions/deploy.py (+58/-5)
lava_dispatcher/client.py (+1/-1)
lava_dispatcher/utils.py (+5/-1)
To merge this branch: bzr merge lp:~qzhang/lava-dispatcher/another-inject-kernel
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+72927@code.launchpad.net

Description of the change

Another injecting kernel, use l-h-r now.
1. use linaro-hwpack-replace to get a new hwpack with new kernel before deployment.
2. tested once and pass
3. only support new kernel in deb format in normal image and tarball format in Android image.
4. job file like:
  "actions": [
    {
      "command": "deploy_linaro_image",
      "parameters":
        {
          "rootfs":
"http://snapshots.linaro.org/11.05-daily/linaro-nano/20110612/0/images/tar/nano-n-tar-20110612-0.tar.gz",
          "hwpack":
"http://snapshots.linaro.org/11.05-daily/linaro-hwpacks/lt-mx53loco/20110609/0/images/hwpack/hwpack_linaro-lt-mx53loco_20110609-0_armel_supported.tar.gz",
          "kernel_matrix":[
"http://pkgserver/original/linux-image-2.6.38-1000-linaro-lt-mx5_2.6.38-1000.7_armel.deb", "linux-image-2.6.38"]
        }
    },

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

This looks basically OK to me, bet it conflicts with trunk now though.

101. By Spring Zhang

sync with mainline

102. By Spring Zhang

sync with mainline

103. By Spring Zhang

sync with mainline

104. By Spring Zhang

sync with mainline

105. By Spring Zhang

fix another OSError 18 link error

106. By Spring Zhang

fix minor bugs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'doc/android-new-kernel.json'
--- doc/android-new-kernel.json 1970-01-01 00:00:00 +0000
+++ doc/android-new-kernel.json 2011-09-15 07:09:50 +0000
@@ -0,0 +1,37 @@
1{
2 "job_name": "android_new_kernel",
3 "image_type": "android",
4 "target": "panda01",
5 "timeout": 18000,
6 "actions": [
7 {
8 "command": "deploy_linaro_android_image",
9 "parameters":
10 {
11 "boot": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/boot.tar.bz2",
12 "system": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/system.tar.bz2",
13 "data": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/userdata.tar.bz2",
14 "pkg": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/171/artifact/build/out/target/product/pandaboard/boot.tar.bz2"
15 },
16 "metadata":
17 {
18 "rootfs.type": "android",
19 "rootfs.build": "61"
20 }
21 },
22 {
23 "command": "boot_linaro_android_image"
24 },
25 {
26 "command": "test_android_basic"
27 },
28 {
29 "command": "submit_results_on_host",
30 "parameters":
31 {
32 "server": "http://validation.linaro.org/launch-control",
33 "stream": "/anonymous/android-panda01-basic/"
34 }
35 }
36 ]
37}
038
=== renamed file 'doc/lava-ltp-job' => 'doc/lava-ltp-job.json'
=== added file 'doc/lava-new-kernel.json'
--- doc/lava-new-kernel.json 1970-01-01 00:00:00 +0000
+++ doc/lava-new-kernel.json 2011-09-15 07:09:50 +0000
@@ -0,0 +1,30 @@
1{
2 "job_name": "new-kernel",
3 "target": "mx53loco01",
4 "timeout": 6000,
5 "actions": [
6 {
7 "command": "deploy_linaro_image",
8 "parameters":
9 {
10 "rootfs":
11"http://snapshots.linaro.org/11.05-daily/linaro-nano/20110612/0/images/tar/nano-n-tar-20110612-0.tar.gz",
12 "hwpack":
13"http://snapshots.linaro.org/11.05-daily/linaro-hwpacks/lt-mx53loco/20110609/0/images/hwpack/hwpack_linaro-lt-mx53loco_20110609-0_armel_supported.tar.gz",
14 "kernel_matrix":[
15"http://pkgserver/original/linux-image-2.6.38-1000-linaro-lt-mx5_2.6.38-1000.7_armel.deb", "linux-image-2.6.38"]
16 }
17 },
18 {
19 "command": "boot_linaro_image"
20 },
21 {
22 "command": "submit_results",
23 "parameters":
24 {
25 "server": "http://validation.linaro.org/launch-control",
26 "stream": "/anonymous/testresult/"
27 }
28 }
29 ]
30}
031
=== modified file 'lava_dispatcher/actions/android_deploy.py'
--- lava_dispatcher/actions/android_deploy.py 2011-09-05 22:39:47 +0000
+++ lava_dispatcher/actions/android_deploy.py 2011-09-15 07:09:50 +0000
@@ -29,7 +29,7 @@
29from lava_dispatcher.client import CriticalError29from lava_dispatcher.client import CriticalError
3030
31class cmd_deploy_linaro_android_image(BaseAction):31class cmd_deploy_linaro_android_image(BaseAction):
32 def run(self, boot, system, data, use_cache=True):32 def run(self, boot, system, data, pkg=None, use_cache=True):
33 LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir33 LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
34 LAVA_IMAGE_URL = self.context.lava_image_url34 LAVA_IMAGE_URL = self.context.lava_image_url
35 client = self.client35 client = self.client
@@ -49,8 +49,8 @@
49 raise CriticalError("Unable to reach LAVA server, check network")49 raise CriticalError("Unable to reach LAVA server, check network")
5050
51 try:51 try:
52 boot_tbz2, system_tbz2, data_tbz2 = self.download_tarballs(boot,52 boot_tbz2, system_tbz2, data_tbz2, pkg_tbz2 = \
53 system, data, use_cache)53 self.download_tarballs(boot, system, data, pkg, use_cache)
54 except:54 except:
55 tb = traceback.format_exc()55 tb = traceback.format_exc()
56 client.sio.write(tb)56 client.sio.write(tb)
@@ -66,9 +66,16 @@
66 LAVA_IMAGE_URL, system_tarball])66 LAVA_IMAGE_URL, system_tarball])
67 data_url = '/'.join(u.strip('/') for u in [67 data_url = '/'.join(u.strip('/') for u in [
68 LAVA_IMAGE_URL, data_tarball])68 LAVA_IMAGE_URL, data_tarball])
69 if pkg_tbz2:
70 pkg_tarball = pkg_tbz2.replace(LAVA_IMAGE_TMPDIR, '')
71 pkg_url = '/'.join(u.strip('/') for u in [
72 LAVA_IMAGE_URL, pkg_tarball])
6973
70 try:74 try:
71 self.deploy_linaro_android_testboot(boot_url)75 if pkg_tbz2:
76 self.deploy_linaro_android_testboot(boot_url, pkg_url)
77 else:
78 self.deploy_linaro_android_testboot(boot_url)
72 self.deploy_linaro_android_testrootfs(system_url)79 self.deploy_linaro_android_testrootfs(system_url)
73 self.purge_linaro_android_sdcard()80 self.purge_linaro_android_sdcard()
74 except:81 except:
@@ -78,12 +85,14 @@
78 finally:85 finally:
79 shutil.rmtree(self.tarball_dir)86 shutil.rmtree(self.tarball_dir)
8087
81 def download_tarballs(self, boot_url, system_url, data_url, use_cache=True):88 def download_tarballs(self, boot_url, system_url, data_url, pkg_url=None,
89 use_cache=True):
82 """Download tarballs from a boot, system and data tarball url90 """Download tarballs from a boot, system and data tarball url
8391
84 :param boot_url: url of the Linaro Android boot tarball to download92 :param boot_url: url of the Linaro Android boot tarball to download
85 :param system_url: url of the Linaro Android system tarball to download93 :param system_url: url of the Linaro Android system tarball to download
86 :param data_url: url of the Linaro Android data tarball to download94 :param data_url: url of the Linaro Android data tarball to download
95 :param pkg_url: url of the custom kernel tarball to download
87 :param use_cache: whether or not to use the cached copy (if it exists)96 :param use_cache: whether or not to use the cached copy (if it exists)
88 """97 """
89 lava_cachedir = self.context.lava_cachedir98 lava_cachedir = self.context.lava_cachedir
@@ -96,13 +105,21 @@
96 boot_path = download_with_cache(boot_url, tarball_dir, lava_cachedir)105 boot_path = download_with_cache(boot_url, tarball_dir, lava_cachedir)
97 system_path = download_with_cache(system_url, tarball_dir, lava_cachedir)106 system_path = download_with_cache(system_url, tarball_dir, lava_cachedir)
98 data_path = download_with_cache(data_url, tarball_dir, lava_cachedir)107 data_path = download_with_cache(data_url, tarball_dir, lava_cachedir)
108 if pkg_url:
109 pkg_path = download_with_cache(pkg_url, tarball_dir)
110 else:
111 pkg_path = None
99 else:112 else:
100 boot_path = download(boot_url, tarball_dir)113 boot_path = download(boot_url, tarball_dir)
101 system_path = download(system_url, tarball_dir)114 system_path = download(system_url, tarball_dir)
102 data_path = download(data_url, tarball_dir)115 data_path = download(data_url, tarball_dir)
103 return boot_path, system_path, data_path116 if pkg_url:
117 pkg_path = download(pkg_url, tarball_dir)
118 else:
119 pkg_path = None
120 return boot_path, system_path, data_path, pkg_path
104121
105 def deploy_linaro_android_testboot(self, boottbz2):122 def deploy_linaro_android_testboot(self, boottbz2, pkgbz2=None):
106 client = self.client123 client = self.client
107 client.run_cmd_master('mkfs.vfat /dev/disk/by-label/testboot '124 client.run_cmd_master('mkfs.vfat /dev/disk/by-label/testboot '
108 '-n testboot')125 '-n testboot')
@@ -111,6 +128,10 @@
111 client.run_cmd_master('mount /dev/disk/by-label/testboot '128 client.run_cmd_master('mount /dev/disk/by-label/testboot '
112 '/mnt/lava/boot')129 '/mnt/lava/boot')
113 client.run_cmd_master('wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -' % boottbz2)130 client.run_cmd_master('wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -' % boottbz2)
131 if pkgbz2:
132 client.run_shell_command(
133 'wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -'
134 % pkgbz2, response = MASTER_STR)
114135
115 self.recreate_uInitrd()136 self.recreate_uInitrd()
116137
117138
=== modified file 'lava_dispatcher/actions/deploy.py'
--- lava_dispatcher/actions/deploy.py 2011-09-08 23:35:05 +0000
+++ lava_dispatcher/actions/deploy.py 2011-09-15 07:09:50 +0000
@@ -15,11 +15,11 @@
15# GNU General Public License for more details.15# GNU General Public License for more details.
16#16#
17# You should have received a copy of the GNU General Public License17# You should have received a copy of the GNU General Public License
18# along18# along with this program; if not, see <http://www.gnu.org/licenses>.
19# with this program; if not, see <http://www.gnu.org/licenses>.
2019
21from commands import getoutput, getstatusoutput20from commands import getoutput, getstatusoutput
22import os21import os
22import sys
23import re23import re
24import shutil24import shutil
25import traceback25import traceback
@@ -31,13 +31,15 @@
3131
3232
33class cmd_deploy_linaro_image(BaseAction):33class cmd_deploy_linaro_image(BaseAction):
34 def run(self, hwpack, rootfs, use_cache=True):34 def run(self, hwpack, rootfs, kernel_matrix=None, use_cache=True):
35 LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir35 LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
36 LAVA_IMAGE_URL = self.context.lava_image_url36 LAVA_IMAGE_URL = self.context.lava_image_url
37 client = self.client37 client = self.client
38 print "deploying on %s" % client.hostname38 print "deploying on %s" % client.hostname
39 print " hwpack: %s" % hwpack39 print " hwpack: %s" % hwpack
40 print " rootfs: %s" % rootfs40 print " rootfs: %s" % rootfs
41 if kernel_matrix:
42 print " package: %s" % kernel_matrix[0]
41 print "Booting master image"43 print "Booting master image"
42 client.boot_master_image()44 client.boot_master_image()
4345
@@ -49,9 +51,17 @@
49 client.sio.write(tb)51 client.sio.write(tb)
50 raise CriticalError("Unable to reach LAVA server, check network")52 raise CriticalError("Unable to reach LAVA server, check network")
5153
54 if kernel_matrix:
55 hwpack = self.refresh_hwpack(kernel_matrix, hwpack, use_cache)
56 #make new hwpack downloadable
57 hwpack = hwpack.replace(LAVA_IMAGE_TMPDIR, '')
58 hwpack = '/'.join(u.strip('/') for u in [
59 LAVA_IMAGE_URL, hwpack])
60 print "Hwpack with new kernel: %s" % hwpack
61
52 try:62 try:
53 boot_tgz, root_tgz = self.generate_tarballs(63 boot_tgz, root_tgz = self.generate_tarballs(hwpack, rootfs,
54 hwpack, rootfs, use_cache)64 use_cache)
55 except:65 except:
56 tb = traceback.format_exc()66 tb = traceback.format_exc()
57 client.sio.write(tb)67 client.sio.write(tb)
@@ -119,6 +129,7 @@
119 self.tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)129 self.tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)
120 tarball_dir = self.tarball_dir130 tarball_dir = self.tarball_dir
121 os.chmod(tarball_dir, 0755)131 os.chmod(tarball_dir, 0755)
132 #fix me: if url is not http-prefix, copy it to tarball_dir
122 if use_cache:133 if use_cache:
123 hwpack_path = download_with_cache(hwpack_url, tarball_dir, lava_cachedir)134 hwpack_path = download_with_cache(hwpack_url, tarball_dir, lava_cachedir)
124 rootfs_path = download_with_cache(rootfs_url, tarball_dir, lava_cachedir)135 rootfs_path = download_with_cache(rootfs_url, tarball_dir, lava_cachedir)
@@ -184,3 +195,45 @@
184 'wget -qO- %s |tar --numeric-owner -C /mnt/boot -xzf -' % bootfs)195 'wget -qO- %s |tar --numeric-owner -C /mnt/boot -xzf -' % bootfs)
185 client.run_cmd_master('umount /mnt/boot')196 client.run_cmd_master('umount /mnt/boot')
186197
198 def refresh_hwpack(self, kernel_matrix, hwpack, use_cache=True):
199 client = self.client
200 LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
201 print "Deploying new kernel"
202 new_kernel = kernel_matrix[0]
203 deb_prefix = kernel_matrix[1]
204 filesuffix = new_kernel.split(".")[-1]
205
206 if filesuffix != "deb":
207 raise CriticalError("New kernel only support deb kernel package!")
208
209 # download package to local
210 tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)
211 os.chmod(tarball_dir, 0755)
212 if use_cache:
213 kernel_path = download_with_cache(new_kernel, tarball_dir)
214 hwpack_path = download_with_cache(hwpack, tarball_dir)
215 else:
216 kernel_path = download(new_kernel, tarball_dir)
217 hwpack_path = download(hwpack, tarball_dir)
218
219 cmd = ("sudo linaro-hwpack-replace -t %s -p %s -r %s"
220 % (hwpack_path, kernel_path, deb_prefix))
221
222 rc, output = getstatusoutput(cmd)
223 if rc:
224 shutil.rmtree(tarball_dir)
225 tb = traceback.format_exc()
226 client.sio.write(tb)
227 raise RuntimeError("linaro-hwpack-replace failed: %s" % output)
228
229 #fix it:l-h-r doesn't make a output option to specify the output hwpack,
230 #so it needs to do manually here
231
232 #remove old hwpack and leave only new hwpack in tarball_dir
233 os.remove(hwpack_path)
234 hwpack_list = os.listdir(tarball_dir)
235 for hp in hwpack_list:
236 if hp.split(".")[-1] == "gz":
237 new_hwpack_path = os.path.join(tarball_dir, hp)
238 return new_hwpack_path
239
187240
=== modified file 'lava_dispatcher/client.py'
--- lava_dispatcher/client.py 2011-09-14 16:05:43 +0000
+++ lava_dispatcher/client.py 2011-09-15 07:09:50 +0000
@@ -130,7 +130,7 @@
130 # Details: system PS1 is set in /etc/bash.bashrc and user PS1 is set in130 # Details: system PS1 is set in /etc/bash.bashrc and user PS1 is set in
131 # /root/.bashrc, it is131 # /root/.bashrc, it is
132 # "${debian_chroot:+($debian_chroot)}\u@\h:\w\$ "132 # "${debian_chroot:+($debian_chroot)}\u@\h:\w\$ "
133 self.proc.sendline('export PS1="$PS1 rc=$(echo \$?) "')133 self.proc.sendline('export PS1="$PS1 [rc=$(echo \$?)]: "')
134 self.proc.expect(self.tester_str)134 self.proc.expect(self.tester_str)
135135
136 def enter_uboot(self):136 def enter_uboot(self):
137137
=== modified file 'lava_dispatcher/utils.py'
--- lava_dispatcher/utils.py 2011-09-01 03:03:09 +0000
+++ lava_dispatcher/utils.py 2011-09-15 07:09:50 +0000
@@ -45,7 +45,11 @@
45 if os.path.exists(cache_loc):45 if os.path.exists(cache_loc):
46 filename = os.path.basename(cache_loc)46 filename = os.path.basename(cache_loc)
47 file_location = os.path.join(path, filename)47 file_location = os.path.join(path, filename)
48 os.link(cache_loc, file_location)48 try:
49 os.link(cache_loc, file_location)
50 except OSError, err:
51 if err.errno == 18:
52 shutil.copy(cache_loc, file_location)
49 else:53 else:
50 file_location = download(url, path)54 file_location = download(url, path)
51 try:55 try:

Subscribers

People subscribed via source and target branches