From patchwork Mon Aug 29 21:09:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Larson X-Patchwork-Id: 3772 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 EFF6823F22 for ; Mon, 29 Aug 2011 21:09:14 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id D8ACFA184AF for ; Mon, 29 Aug 2011 21:09:14 +0000 (UTC) Received: by fxd18 with SMTP id 18so7160307fxd.11 for ; Mon, 29 Aug 2011 14:09:14 -0700 (PDT) Received: by 10.223.62.73 with SMTP id w9mr915581fah.138.1314652154632; Mon, 29 Aug 2011 14:09:14 -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.152.11.8 with SMTP id m8cs111065lab; Mon, 29 Aug 2011 14:09:14 -0700 (PDT) Received: by 10.227.203.6 with SMTP id fg6mr2283386wbb.24.1314652153447; Mon, 29 Aug 2011 14:09:13 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id ge14si11737614wbb.87.2011.08.29.14.09.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 29 Aug 2011 14:09:13 -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 1Qy94y-0005Yx-Ry for ; Mon, 29 Aug 2011 21:09:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id C713AE03A6 for ; Mon, 29 Aug 2011 21:09: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: 95 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 95: Wait for the network to come up before trying to get the ip from the Message-Id: <20110829210912.26712.16729.launchpad@ackee.canonical.com> Date: Mon, 29 Aug 2011 21:09: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="13794"; Instance="initZopeless config overlay" X-Launchpad-Hash: 1684eeac0f18d69256dacb55e86eecdd01269c18 ------------------------------------------------------------ revno: 95 fixes bug(s): https://launchpad.net/bugs/836700 committer: Paul Larson branch nick: network-upload-fix-836700 timestamp: Mon 2011-08-29 08:57:19 -0500 message: Wait for the network to come up before trying to get the ip from the master image, and some other obvious fixes/cleanups modified: lava_dispatcher/actions/launch_control.py lava_dispatcher/client.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/launch_control.py' --- lava_dispatcher/actions/launch_control.py 2011-08-17 10:36:29 +0000 +++ lava_dispatcher/actions/launch_control.py 2011-08-29 13:57:19 +0000 @@ -20,18 +20,19 @@ # along # with this program; if not, see . +import json import os -import json +import pexpect import shutil import tarfile from lava_dispatcher.actions import BaseAction -from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, LAVA_SERVER_IP +from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR from lava_dispatcher.config import LAVA_IMAGE_TMPDIR from lava_dispatcher.client import NetworkError from lava_dispatcher.utils import download +from tempfile import mkdtemp import time import xmlrpclib -from subprocess import call class cmd_submit_results_on_host(BaseAction): def run(self, server, stream): @@ -43,7 +44,7 @@ bundle_list = os.listdir("/tmp/%s" % LAVA_RESULT_DIR) for bundle_name in bundle_list: bundle = "/tmp/%s/%s" % (LAVA_RESULT_DIR, bundle_name) - f = open(bundle) + f = open(bundle) content = f.read() f.close() try: @@ -106,7 +107,7 @@ os.chmod(tarball_dir, 0755) #FIXME: need to consider exception? result_path = download(result_tarball, tarball_dir) - id = client.proc.expect([MASTER_STR, pexpect.TIMEOUT, pexpect.EOF], + id = client.proc.expect([MASTER_STR, pexpect.TIMEOUT, pexpect.EOF], timeout=3) client.run_shell_command('kill %1', response=MASTER_STR) @@ -119,7 +120,7 @@ self.all_bundles.append(json.loads(content)) tar.close() shutil.rmtree(tarball_dir) - + #flush the serial log client.run_shell_command("") === modified file 'lava_dispatcher/client.py' --- lava_dispatcher/client.py 2011-08-16 00:15:08 +0000 +++ lava_dispatcher/client.py 2011-08-29 13:57:19 +0000 @@ -128,6 +128,7 @@ def get_master_ip(self): #get master image ip address + self.wait_network_up() #tty device uses minimal match, see pexpect wiki #pattern1 = ".*\n(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" pattern1 = "(\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?)" @@ -136,7 +137,7 @@ self.proc.sendline(cmd) #if running from ipython, it needs another Enter, don't know why #self.proc.sendline("") - id = self.proc.expect([pattern1, pexpect.EOF, + id = self.proc.expect([pattern1, pexpect.EOF, pexpect.TIMEOUT], timeout=5) print "\nid=%s" %id if id == 0: