From patchwork Fri Dec 7 20:06:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Terceiro X-Patchwork-Id: 13422 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 8A62F23E1A for ; Fri, 7 Dec 2012 20:06:16 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 0EE6EA188F6 for ; Fri, 7 Dec 2012 20:06:15 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so2263478ieb.11 for ; Fri, 07 Dec 2012 12:06:15 -0800 (PST) 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=xZWm8SltuY997qZw4o4YN9Oo/8hQCg6YMEgFlvXlsH8=; b=JTVoknuh6chMmvd2VCpEZ7ZxwEFqc9w4IyNkpAVPBXWnFq14+bcPJGI6fFuPzV5Elp C4xp7FAHPa6R0afDlkPljAib7ez8I55E5ctpKCvMWWzig7pUZU5vmHTu0KO3fQt7jMnj Vod+XiNBAhTgwd4A8WnbgzlFNJ6xa57EulkPj3oEXx3I+rqigWgMcf6oJOpfsLOkD8Mw SRB5yhqORI6NOaR9MsOtQ2O6J1mHkilq4AfnUdPGfDTWUM1Xf/VLeDQd7+6tke/4c2qs vJL35JYckZHEC3hukDBylsjBxyQT3RFQv09GAZsuuUzvpOzLuLrLAO1NBYzWnyCQQ3ow 6e8g== Received: by 10.43.46.2 with SMTP id um2mr5400240icb.18.1354910775257; Fri, 07 Dec 2012 12:06: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.50.67.148 with SMTP id n20csp496309igt; Fri, 7 Dec 2012 12:06:14 -0800 (PST) Received: by 10.180.103.106 with SMTP id fv10mr316648wib.19.1354910773887; Fri, 07 Dec 2012 12:06:13 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id y13si9294293web.80.2012.12.07.12.06.12 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Dec 2012 12:06:13 -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 1Th4BY-0002Qt-PN for ; Fri, 07 Dec 2012 20:06:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id AF383E0135 for ; Fri, 7 Dec 2012 20:06:12 +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: 490 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 490: Device version support for master images Message-Id: <20121207200612.21268.2207.launchpad@ackee.canonical.com> Date: Fri, 07 Dec 2012 20:06:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16341"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 600a935c37924e04519f8e124271279cf5c349f5 X-Gm-Message-State: ALoCoQldBWQGdg62w0R0Ye0QsHVUeFAXRGTd/Zd/9sPm1AquT9/ZFXq5xUcBQsLdjTRK7LTfRzBM Merge authors: Antonio Terceiro (terceiro) Related merge proposals: https://code.launchpad.net/~terceiro/lava-dispatcher/master-device-version/+merge/138463 proposed by: Antonio Terceiro (terceiro) ------------------------------------------------------------ revno: 490 [merge] fixes bug: https://launchpad.net/bugs/1073842 committer: Antonio Terceiro branch nick: trunk timestamp: Fri 2012-12-07 17:05:03 -0300 message: Device version support for master images modified: lava_dispatcher/device/master.py lava_dispatcher/job.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/device/master.py' --- lava_dispatcher/device/master.py 2012-12-05 19:10:40 +0000 +++ lava_dispatcher/device/master.py 2012-12-06 14:14:14 +0000 @@ -81,6 +81,7 @@ } self.master_ip = None + self.device_version = None if config.pre_connect_command: logging_system(config.pre_connect_command) @@ -88,6 +89,9 @@ self.proc = self._connect_carefully(config.connection_command) atexit.register(self._close_logging_spawn) + def get_device_version(self): + return self.device_version + def power_on(self): self._boot_linaro_image() return self.proc @@ -400,6 +404,7 @@ runner = MasterCommandRunner(self) try: self.master_ip = runner.get_master_ip() + self.device_version = runner.get_device_version() except NetworkError as e: msg = "Failed to get network up: " % e logging.warning(msg) @@ -518,6 +523,27 @@ logging.debug("Master image IP is %s" % ip) return ip + def get_device_version(self): + pattern = 'device_version=(\d+-\d+/\d+-\d+)' + self.run("echo \"device_version=" + "$(lava-master-image-info --master-image-hwpack " + "| sed 's/[^0-9-]//g; s/^-\+//')" + "/" + "$(lava-master-image-info --master-image-rootfs " + "| sed 's/[^0-9-]//g; s/^-\+//')" + "\"", + [pattern, pexpect.EOF, pexpect.TIMEOUT], + timeout = 5) + + device_version = None + if self.match_id == 0: + device_version = self.match.group(1) + logging.debug('Master image version (hwpack/rootfs) is %s' % device_version) + else: + logging.warning('Could not determine image version!') + + return device_version + def has_partition_with_label(self, label): if not label: return False === modified file 'lava_dispatcher/job.py' --- lava_dispatcher/job.py 2012-11-24 20:58:07 +0000 +++ lava_dispatcher/job.py 2012-12-07 19:59:19 +0000 @@ -148,7 +148,6 @@ metadata = { 'target.hostname': self.target, - 'target.device_version': self.context.get_device_version(), } if 'device_type' in self.job_data: @@ -232,6 +231,10 @@ self.context.test_data.job_status = 'fail' raise finally: + device_version = self.context.get_device_version() or 'error' + self.context.test_data.add_metadata({ + 'target.device_version': device_version + }) if submit_results: params = submit_results.get('parameters', {}) action = lava_commands[submit_results['command']](