From patchwork Thu Dec 17 17:06:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 7875161 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EDADA9F32E for ; Thu, 17 Dec 2015 17:09:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E1EF2042C for ; Thu, 17 Dec 2015 17:09:23 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 573C620254 for ; Thu, 17 Dec 2015 17:09:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a9c0X-0005w6-Uo; Thu, 17 Dec 2015 17:06:25 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a9c0U-0005uK-5j for xen-devel@lists.xenproject.org; Thu, 17 Dec 2015 17:06:22 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 6F/2A-03235-D8BE2765; Thu, 17 Dec 2015 17:06:21 +0000 X-Env-Sender: prvs=7867bb76c=Ian.Jackson@citrix.com X-Msg-Ref: server-14.tower-206.messagelabs.com!1450371978!11121974!3 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24689 invoked from network); 17 Dec 2015 17:06:20 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-14.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 17 Dec 2015 17:06:20 -0000 X-IronPort-AV: E=Sophos;i="5.20,442,1444694400"; d="scan'208";a="320065452" From: Ian Jackson To: Date: Thu, 17 Dec 2015 17:06:08 +0000 Message-ID: <1450371968-27997-9-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1450371968-27997-1-git-send-email-ian.jackson@eu.citrix.com> References: <1450371968-27997-1-git-send-email-ian.jackson@eu.citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Jackson , Ian Campbell Subject: [Xen-devel] [OSSTEST PATCH 9/9] mg-allocate: In planner mode, pre-check the arguments X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now, attempting to allocate a nonexistent host fails immediately with a sensible message, rather than queueing up and then reporting the message only later: mariner:testing.git> OSSTEST_CONFIG=/u/iwj/.xen-osstest/config:local-config.test-database_iwj ./mg-allocate -U 1h spong 2015-12-17 17:05:14 Z pre-checking resources (dry run)... 2015-12-17 17:05:14 Z (precheck) task 196916 static iwj@mariner: iwj@mariner manual *** no candidates for spong! *** mariner:testing.git> Signed-off-by: Ian Jackson Acked-by: Ian Campbell --- mg-allocate | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mg-allocate b/mg-allocate index 54a7af3..3730c23 100755 --- a/mg-allocate +++ b/mg-allocate @@ -238,7 +238,8 @@ sub loggot { foreach @got; } -sub execute () { +sub execute (;$) { + my ($dryrun) = @_; my @got; db_retry($dbh_tests, \@all_lock_tables, sub { @@ -259,10 +260,15 @@ sub execute () { } } + if ($dryrun) { + db_retry_abort(); + return; + } if (!$allok) { die "allocation/deallocation unsuccessful\n"; } }); + return if $dryrun; loggot(@got); logm("done."); } @@ -388,6 +394,11 @@ while (@ARGV && $ARGV[0] =~ m/^[-0-9]/) { } if ($duration) { + { + logm("pre-checking resources (dry run)..."); + local $Osstest::TestSupport::logm_prefix = $logm_prefix.' (precheck)'; + execute(1); + }; plan(); } else { execute();