From patchwork Sat Jan 29 01:09:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 516251 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0T19J1J030728 for ; Sat, 29 Jan 2011 01:09:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753551Ab1A2BJQ (ORCPT ); Fri, 28 Jan 2011 20:09:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57128 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752338Ab1A2BJQ (ORCPT ); Fri, 28 Jan 2011 20:09:16 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0T19F3A015072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 28 Jan 2011 20:09:15 -0500 Received: from freedom.redhat.com (vpn-8-138.rdu.redhat.com [10.11.8.138]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0T19DSE005253; Fri, 28 Jan 2011 20:09:14 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Jan Stancek Subject: [PATCH] remember used harness after reboot v3 Date: Fri, 28 Jan 2011 23:09:12 -0200 Message-Id: <1296263352-6712-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 29 Jan 2011 01:09:20 +0000 (UTC) diff --git a/client/bin/harness.py b/client/bin/harness.py index b4c9dfd..bcb4f96 100644 --- a/client/bin/harness.py +++ b/client/bin/harness.py @@ -5,7 +5,7 @@ The interface between the client and the server when hosted. __author__ = """Copyright Andy Whitcroft 2006""" -import os, sys +import os, sys, logging import common class harness(object): @@ -86,6 +86,8 @@ def select(which, job): if not which: which = 'standalone' + logging.debug('Selected harness: %s' % which) + harness_name = 'harness_%s' % which harness_module = common.setup_modules.import_module(harness_name, 'autotest_lib.client.bin') diff --git a/client/bin/job.py b/client/bin/job.py index 127ed94..23de98c 100644 --- a/client/bin/job.py +++ b/client/bin/job.py @@ -174,7 +174,20 @@ class base_client_job(base_job.base_job): self._next_step_index = 0 self._load_state() - self.harness = harness.select(options.harness, self) + # harness is chosen by following rules: + # 1. explicitly specified via command line + # 2. harness stored in state file (if continuing job '-c') + # 3. default harness + selected_harness = None + if options.harness: + selected_harness = options.harness + self._state.set('client', 'harness', selected_harness) + else: + stored_harness = self._state.get('client', 'harness', None) + if stored_harness: + selected_harness = stored_harness + + self.harness = harness.select(selected_harness, self) # set up the status logger def client_job_record_hook(entry):