From: Ian Jackson Subject: [OSSTEST PATCH 10/13] Reporting: sg-report-host-history: Support --max-flight Date: Mon, 29 Jun 2015 18:14:46 +0100 Message-ID: <1435598089-21647-11-git-send-email-ian.jackson@eu.citrix.com> References: <1435598089-21647-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z9cto-0008Mt-1t for xen-devel@lists.xenproject.org; Mon, 29 Jun 2015 17:31:16 +0000 In-Reply-To: <1435598089-21647-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org We can't use report_blessingscond because we handle blessings differently in sg-report-host-history (since we want the history of even adhoc etc. flights). Signed-off-by: Ian Jackson --- sg-report-host-history | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sg-report-host-history b/sg-report-host-history index d4e5dea..f33fafa 100755 --- a/sg-report-host-history +++ b/sg-report-host-history @@ -31,6 +31,7 @@ our $limit= 200; our $flightlimit; our $htmlout = "."; our @blessings; +our $maxflight; open DEBUG, ">/dev/null"; @@ -44,6 +45,8 @@ while (@ARGV && $ARGV[0] =~ m/^-/) { $$1= $2; } elsif (m/^--flight-limit\=([1-9]\d*)$/) { $flightlimit= $1; + } elsif (m/^--max-flight\=([1-9]\d*)$/) { + $maxflight= $1; } elsif (m/^--blessings?=(.*)$/) { push @blessings, split ',', $1; } elsif (m/^--html-dir=(.*)$/) { @@ -59,6 +62,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) { @ARGV or die $!; +our $maxflightcond = defined($maxflight) ? "flight <= $maxflight" : "TRUE"; our $flightcond; sub computeflightsrange () { @@ -85,6 +89,7 @@ END FROM ( SELECT flight FROM flights + WHERE $maxflightcond ORDER BY flight DESC LIMIT $flightlimit ) f @@ -116,6 +121,7 @@ sub mainquery () { WHERE $namecond AND ($valcond) AND $flightcond + AND $maxflightcond ORDER BY flight DESC LIMIT ($limit * 3 + 100) * ? END -- 1.7.10.4