From patchwork Fri Jul 20 22:21:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Doan X-Patchwork-Id: 10159 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 3F86B19D1D2 for ; Fri, 20 Jul 2012 22:21:14 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id D238CA182F7 for ; Fri, 20 Jul 2012 22:21:13 +0000 (UTC) Received: by ghbz12 with SMTP id z12so4820357ghb.11 for ; Fri, 20 Jul 2012 15:21:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=jtIrj3CTZeCcOLGNyJtTTnvnvfDguyw42UcppPMIk4E=; b=AKEPPRzeX/1OK/BLhAZSWyb057WAnzfUE95rsBSieWxsFMVLtif6NKK38QjoXNoQVi 0rJam+uyYgMNWZeiqjn7N5JdG5WRcNimY87Opv5BEuca/v4SxmiHO67egcml90mv+tvy wh9VOh1V7J2kRk+Ie4DSQZ3GduUJrkk6RXDhW/mntcrlcb0b8GFS9iBCOR/vpxzTyKXP xOhcKvYmCkff7gY1EgmFs2XEk/RAjSs/7erOQF/A99ZXOEfdwXWNnix5tX4wNxsaE+kC 7BYnNuzTXoLqyx+yef5I5Yzov/uv8pfaAEDI/r17CETPBLn7ktqR8Z38MCnsLAgqvEQL dy7A== Received: by 10.50.242.73 with SMTP id wo9mr5630546igc.1.1342822872928; Fri, 20 Jul 2012 15:21:12 -0700 (PDT) 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.153.7 with SMTP id i7csp33813ibw; Fri, 20 Jul 2012 15:21:12 -0700 (PDT) Received: by 10.216.68.18 with SMTP id k18mr4791458wed.74.1342822871789; Fri, 20 Jul 2012 15:21:11 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id r53si7734255wed.52.2012.07.20.15.21.10 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 20 Jul 2012 15:21:11 -0700 (PDT) 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 1SsLZO-0001N6-Ik for ; Fri, 20 Jul 2012 22:21:10 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 8328BE027C for ; Fri, 20 Jul 2012 22:21: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: 352 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 352: fix master file deletion logic Message-Id: <20120720222110.29610.37248.launchpad@ackee.canonical.com> Date: Fri, 20 Jul 2012 22:21: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="15654"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: cb0ac683172f65d746b441458c11f50823c10a86 X-Gm-Message-State: ALoCoQmF+hBYzjPGu6JIKYUKcOCqswio38WRREygjoV4oxhOMOKsZfAr3tLODsUoPZ6rU0FLPB2T ------------------------------------------------------------ revno: 352 committer: Andy Doan branch nick: lava-dispatcher timestamp: Fri 2012-07-20 17:18:48 -0500 message: fix master file deletion logic the bugs fixed by the previous commit were causing cache files to not get deleted at exit because the exception handler for that path didn't have the logic. The only way to delete files was if you got to the logic where the master image was launched. This just simplifies things by doing an 'atexit' so it won't get skipped 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-07-20 22:17:45 +0000 +++ lava_dispatcher/client/master.py 2012-07-20 22:18:48 +0000 @@ -498,6 +498,7 @@ boot_tgz, root_tgz = self._generate_tarballs(image_file) else: tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR) + atexit.register(shutil.rmtree, tarball_dir) os.chmod(tarball_dir, 0755) lava_cachedir = self.context.lava_cachedir if self.context.job_data.get('health_check', False): @@ -532,36 +533,33 @@ # deploy the boot image and rootfs to target logging.info("Booting 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 [ - LAVA_IMAGE_URL, boot_tarball]) - root_url = '/'.join(u.strip('/') for u in [ - LAVA_IMAGE_URL, root_tarball]) - with self._master_session() as session: - self._format_testpartition(session, rootfstype) - - logging.info("Waiting for network to come up") - try: - session.wait_network_up() - except: - logging.error("Unable to reach LAVA server, check network") - tb = traceback.format_exc() - self.sio.write(tb) - raise CriticalError("Unable to reach LAVA server, check network") - - try: - _deploy_linaro_rootfs(session, root_url) - _deploy_linaro_bootfs(session, boot_url) - except: - logging.error("Deployment failed") - tb = traceback.format_exc() - self.sio.write(tb) - raise CriticalError("Deployment failed") - finally: - shutil.rmtree(os.path.dirname(boot_tgz)) + 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 [ + LAVA_IMAGE_URL, boot_tarball]) + root_url = '/'.join(u.strip('/') for u in [ + LAVA_IMAGE_URL, root_tarball]) + with self._master_session() as session: + self._format_testpartition(session, rootfstype) + + logging.info("Waiting for network to come up") + try: + session.wait_network_up() + except: + logging.error("Unable to reach LAVA server, check network") + tb = traceback.format_exc() + self.sio.write(tb) + raise CriticalError("Unable to reach LAVA server, check network") + + try: + _deploy_linaro_rootfs(session, root_url) + _deploy_linaro_bootfs(session, boot_url) + except: + logging.error("Deployment failed") + tb = traceback.format_exc() + self.sio.write(tb) + raise CriticalError("Deployment failed") def deploy_linaro_android(self, boot, system, data, pkg=None, rootfstype='ext4'): LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir