From patchwork Sun Jan 15 23:39:13 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: 6225 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 C2E9723E16 for ; Sun, 15 Jan 2012 23:39:16 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id ACC76A18397 for ; Sun, 15 Jan 2012 23:39:16 +0000 (UTC) Received: by bkbzt4 with SMTP id zt4so16762bkb.11 for ; Sun, 15 Jan 2012 15:39:16 -0800 (PST) Received: by 10.205.126.137 with SMTP id gw9mr3783197bkc.135.1326670755841; Sun, 15 Jan 2012 15:39:15 -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.205.82.144 with SMTP id ac16cs78394bkc; Sun, 15 Jan 2012 15:39:15 -0800 (PST) Received: by 10.180.20.18 with SMTP id j18mr15564897wie.20.1326670754365; Sun, 15 Jan 2012 15:39:14 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id e58si8921786wed.53.2012.01.15.15.39.14 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 15 Jan 2012 15:39:14 -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 1RmZfO-000802-1a for ; Sun, 15 Jan 2012 23:39:14 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 001F8E0837 for ; Sun, 15 Jan 2012 23:39:14 +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: 192 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 192: delete temporary images when boot_master_image fails during deployment Message-Id: <20120115233913.28618.6238.launchpad@ackee.canonical.com> Date: Sun, 15 Jan 2012 23:39:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14664"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: b51b7b79d31c65905add54df50502decd17afdff Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dispatcher/delete-images-when-boot_master_image-fails/+merge/88447 proposed by: Michael Hudson-Doyle (mwhudson) review: Approve - Zygmunt Krynicki (zkrynicki) ------------------------------------------------------------ revno: 192 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Mon 2012-01-16 12:37:30 +1300 message: delete temporary images when boot_master_image fails during deployment modified: 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/client/master.py' --- lava_dispatcher/client/master.py 2012-01-13 03:52:53 +0000 +++ lava_dispatcher/client/master.py 2012-01-15 23:37:30 +0000 @@ -259,8 +259,8 @@ self.sio.write(tb) raise CriticalError("Deployment tarballs preparation failed") logging.info("Booting master image") - self.boot_master_image() try: + self.boot_master_image() boot_tarball = boot_tgz.replace(LAVA_IMAGE_TMPDIR, '') root_tarball = root_tgz.replace(LAVA_IMAGE_TMPDIR, '') boot_url = '/'.join(u.strip('/') for u in [ @@ -296,53 +296,53 @@ logging.info(" system: %s" % system) logging.info(" data: %s" % data) logging.info("Boot master image") - self.boot_master_image() - - with self._master_session() as session: - logging.info("Waiting for network to come up...") - try: - session.wait_network_up() - except: - tb = traceback.format_exc() - self.sio.write(tb) - raise CriticalError("Unable to reach LAVA server, check network") - - try: - boot_tbz2, system_tbz2, data_tbz2, pkg_tbz2 = \ - self._download_tarballs(boot, system, data, pkg, use_cache) - except: - tb = traceback.format_exc() - self.sio.write(tb) - raise CriticalError("Unable to download artifacts for deployment") - - boot_tarball = boot_tbz2.replace(LAVA_IMAGE_TMPDIR, '') - system_tarball = system_tbz2.replace(LAVA_IMAGE_TMPDIR, '') - #data_tarball = data_tbz2.replace(LAVA_IMAGE_TMPDIR, '') - - boot_url = '/'.join(u.strip('/') for u in [ - LAVA_IMAGE_URL, boot_tarball]) - system_url = '/'.join(u.strip('/') for u in [ - LAVA_IMAGE_URL, system_tarball]) - #data_url = '/'.join(u.strip('/') for u in [ - # LAVA_IMAGE_URL, data_tarball]) - if pkg_tbz2: - pkg_tarball = pkg_tbz2.replace(LAVA_IMAGE_TMPDIR, '') - pkg_url = '/'.join(u.strip('/') for u in [ - LAVA_IMAGE_URL, pkg_tarball]) - else: - pkg_url = None - - try: - _deploy_linaro_android_testboot(session, boot_url, pkg_url) - _deploy_linaro_android_testrootfs(session, system_url, rootfstype) - _purge_linaro_android_sdcard(session) - except: - tb = traceback.format_exc() - self.sio.write(tb) - raise CriticalError("Android deployment failed") - finally: - shutil.rmtree(self.tarball_dir) - logging.info("Android image deployment exiting") + try: + self.boot_master_image() + with self._master_session() as session: + logging.info("Waiting for network to come up...") + try: + session.wait_network_up() + except: + tb = traceback.format_exc() + self.sio.write(tb) + raise CriticalError("Unable to reach LAVA server, check network") + + try: + boot_tbz2, system_tbz2, data_tbz2, pkg_tbz2 = \ + self._download_tarballs(boot, system, data, pkg, use_cache) + except: + tb = traceback.format_exc() + self.sio.write(tb) + raise CriticalError("Unable to download artifacts for deployment") + + boot_tarball = boot_tbz2.replace(LAVA_IMAGE_TMPDIR, '') + system_tarball = system_tbz2.replace(LAVA_IMAGE_TMPDIR, '') + #data_tarball = data_tbz2.replace(LAVA_IMAGE_TMPDIR, '') + + boot_url = '/'.join(u.strip('/') for u in [ + LAVA_IMAGE_URL, boot_tarball]) + system_url = '/'.join(u.strip('/') for u in [ + LAVA_IMAGE_URL, system_tarball]) + #data_url = '/'.join(u.strip('/') for u in [ + # LAVA_IMAGE_URL, data_tarball]) + if pkg_tbz2: + pkg_tarball = pkg_tbz2.replace(LAVA_IMAGE_TMPDIR, '') + pkg_url = '/'.join(u.strip('/') for u in [ + LAVA_IMAGE_URL, pkg_tarball]) + else: + pkg_url = None + + try: + _deploy_linaro_android_testboot(session, boot_url, pkg_url) + _deploy_linaro_android_testrootfs(session, system_url, rootfstype) + _purge_linaro_android_sdcard(session) + except: + tb = traceback.format_exc() + self.sio.write(tb) + raise CriticalError("Android deployment failed") + finally: + shutil.rmtree(self.tarball_dir) + logging.info("Android image deployment exiting") def _download_tarballs(self, boot_url, system_url, data_url, pkg_url=None, use_cache=True):