From patchwork Wed Feb 8 16:44:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 6710 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B0CDC23DEE for ; Wed, 8 Feb 2012 17:21:33 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 59996A1841C for ; Wed, 8 Feb 2012 17:21:33 +0000 (UTC) Received: by iabz7 with SMTP id z7so1514994iab.11 for ; Wed, 08 Feb 2012 09:21:32 -0800 (PST) Received: by 10.50.203.33 with SMTP id kn1mr24883212igc.1.1328721692744; Wed, 08 Feb 2012 09:21:32 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.12.131 with SMTP id x3cs13602ibx; Wed, 8 Feb 2012 09:21:31 -0800 (PST) Received: by 10.216.137.129 with SMTP id y1mr7073569wei.59.1328721690632; Wed, 08 Feb 2012 09:21:30 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id v30si1496622weq.69.2012.02.08.09.21.29 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Feb 2012 09:21:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1RvBCz-0002G6-G3 for ; Wed, 08 Feb 2012 17:21:29 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 68595E1685 for ; Wed, 8 Feb 2012 16:44:10 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 225 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 225: allow deployment from an image file as well as a rootfs/hwpack combination Message-Id: <20120208164410.26000.93492.launchpad@ackee.canonical.com> Date: Wed, 08 Feb 2012 16:44:10 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14747"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 897479502e032b823f7d55a802bdcffca7c99224 X-Gm-Message-State: ALoCoQl66f1cR4brdqRzdD1bGgIlGH5krcxmCEt5MPCNLdqVb5DdwMiK5/yFA2tC9usytjtLtDBT Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dispatcher/deploy-from-image-bug-922320/+merge/90816 proposed by: Michael Hudson-Doyle (mwhudson) review: Approve - Paul Larson (pwlars) ------------------------------------------------------------ revno: 225 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Wed 2012-02-08 08:42:05 -0800 message: allow deployment from an image file as well as a rootfs/hwpack combination modified: lava_dispatcher/actions/deploy.py lava_dispatcher/client/master.py --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'lava_dispatcher/actions/deploy.py' --- lava_dispatcher/actions/deploy.py 2011-12-19 01:40:25 +0000 +++ lava_dispatcher/actions/deploy.py 2012-01-31 01:20:47 +0000 @@ -21,6 +21,6 @@ class cmd_deploy_linaro_image(BaseAction): - def run(self, hwpack, rootfs, kernel_matrix=None, use_cache=True, rootfstype='ext3'): + def run(self, hwpack=None, rootfs=None, image=None, kernel_matrix=None, use_cache=True, rootfstype='ext3'): self.client.deploy_linaro( - hwpack, rootfs, kernel_matrix=None, use_cache=True, rootfstype=rootfstype) + hwpack=hwpack, rootfs=rootfs, image=image, kernel_matrix=kernel_matrix, use_cache=use_cache, rootfstype=rootfstype) === modified file 'lava_dispatcher/client/master.py' --- lava_dispatcher/client/master.py 2012-02-07 19:16:17 +0000 +++ lava_dispatcher/client/master.py 2012-02-08 16:42:05 +0000 @@ -261,12 +261,31 @@ def master_str(self): return self.device_option("MASTER_STR") - def deploy_linaro(self, hwpack, rootfs, kernel_matrix=None, use_cache=True, rootfstype='ext3'): + def deploy_linaro(self, hwpack=None, rootfs=None, image=None, + kernel_matrix=None, use_cache=True, rootfstype='ext3'): LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir LAVA_IMAGE_URL = self.context.lava_image_url try: - boot_tgz, root_tgz = self._generate_tarballs( - hwpack, rootfs, kernel_matrix, use_cache) + if image is None: + if hwpack is None or rootfs is None: + raise CriticalError( + "must specify both hwpack and rootfs when not specifying image") + else: + image_file = generate_image(self, hwpack, rootfs, kernel_matrix, use_cache) + else: + if hwpack is not None or rootfs is not None or kernel_matrix is not None: + raise CriticalError( + "cannot specify hwpack or rootfs when specifying image") + tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR) + os.chmod(tarball_dir, 0755) + if use_cache: + lava_cachedir = self.context.lava_cachedir + image_file = download_with_cache(image, tarball_dir, lava_cachedir) + else: + image_file = download(image, tarball_dir) + boot_tgz, root_tgz = self._generate_tarballs(image_file) + except CriticalError: + raise except: logging.error("Deployment tarballs preparation failed") tb = traceback.format_exc() @@ -428,13 +447,12 @@ session.run('umount /dev/disk/by-label/testboot') session.run('mkfs.vfat /dev/disk/by-label/testboot -n testboot') - def _generate_tarballs(self, hwpack_url, rootfs_url, kernel_matrix, use_cache=True): + def _generate_tarballs(self, image_file): """Generate tarballs from a hwpack and rootfs url :param hwpack_url: url of the Linaro hwpack to download :param rootfs_url: url of the Linaro image to download """ - image_file = generate_image(self, hwpack_url, rootfs_url, kernel_matrix, use_cache) tarball_dir = os.path.dirname(image_file) boot_tgz = os.path.join(tarball_dir, "boot.tgz") root_tgz = os.path.join(tarball_dir, "root.tgz")