From patchwork Tue Oct 4 12:26:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 9361685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C3210608A6 for ; Tue, 4 Oct 2016 12:29:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B262528930 for ; Tue, 4 Oct 2016 12:29:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A70C428870; Tue, 4 Oct 2016 12:29:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 363F32885E for ; Tue, 4 Oct 2016 12:29:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brOoB-0001Yb-VW; Tue, 04 Oct 2016 12:26:55 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brOoA-0001WM-M6 for xen-devel@lists.xenproject.org; Tue, 04 Oct 2016 12:26:54 +0000 Received: from [193.109.254.147] by server-3.bemta-6.messagelabs.com id 26/34-04595-E00A3F75; Tue, 04 Oct 2016 12:26:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeJIrShJLcpLzFFi42JxWrrBXpdvwed wgwkrWS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxXTy6wFXzkrLi27QNbA+Ml9i5GTg4JAX+J n7tOMYHYbAK6Ek1b/rJ1MXJwiAioSNzeawBiMguESux4YQlSISxgI/GqfxMLSJgFqOLFOwOQM K+Ap8SshwdZIAbKSZw//pMZxOYU8JJYsGw6WFwIqKbvfzc7SKuQgJrE3PXxEK2CEidnPgErYR aQkDj44gUzxBhuidunpzJPYOSbhaRsFpKyBYxMqxg1ilOLylKLdI0N9ZKKMtMzSnITM3N0DQ3 M9HJTi4sT01NzEpOK9ZLzczcxAoOJAQh2MDYtCjzEKMnBpCTKW/n6U7gQX1J+SmVGYnFGfFFp TmrxIUYZDg4lCd4t8z6HCwkWpaanVqRl5gDDGiYtwcGjJMKrNx8ozVtckJhbnJkOkTrFqCglz vsGpE8AJJFRmgfXBoulS4yyUsK8jECHCPEUpBblZpagyr9iFOdgVBLm1QAZz5OZVwI3/RXQYi agxYFbPoAsLklESEk1MB4onek5I0a2u32f4RuLowtX8J/6bHCIfV+a7A1217NG7XYnOcP+1+e oXomV/PbCVHKKJ8vpM94nV2fcKV9o8U5gkfRn5XhViZok/YO/XfOt5LIfnD4tbXy1oML8/9UT h+ckG+1ld3FJ3vWSJyT8z4fW5n0fM1y9Fy3tF7v73Mfdu2fZ+YADsUosxRmJhlrMRcWJAAvao v6gAgAA X-Env-Sender: prvs=07840bd4e=Ian.Jackson@citrix.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1475584010!53686280!3 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48100 invoked from network); 4 Oct 2016 12:26:53 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-13.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 4 Oct 2016 12:26:53 -0000 X-IronPort-AV: E=Sophos;i="5.31,295,1473120000"; d="scan'208";a="390553530" From: Ian Jackson To: Date: Tue, 4 Oct 2016 13:26:30 +0100 Message-ID: <1475583994-30203-2-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1475583994-30203-1-git-send-email-ian.jackson@eu.citrix.com> References: <1475583994-30203-1-git-send-email-ian.jackson@eu.citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Jackson Subject: [Xen-devel] [OSSTEST PATCH 2/6] cr-ensure-disk-space: -F option X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP May be repeated (cuddled with itself) or given a number. Forces deletion, even if there is enough space. Normally clean up one less flight than specified, since cr-ensure-disk-space reruns its check after acquiring the lock. Signed-off-by: Ian Jackson --- cr-ensure-disk-space | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cr-ensure-disk-space b/cr-ensure-disk-space index bfdbcc5..c65423a 100755 --- a/cr-ensure-disk-space +++ b/cr-ensure-disk-space @@ -26,6 +26,7 @@ use Osstest::Management qw(:logs); use Fcntl qw(:flock); our $dryrun= 0; +our $force; open DEBUG, ">/dev/null" or die $!; @@ -34,6 +35,10 @@ while (@ARGV && $ARGV[0] =~ m/^\-/) { last if $_ eq '--'; if (m/^-n$/) { $dryrun= 1; + } elsif (m/^-(F+)$/) { + $force += length $1; + } elsif (m/^-F(\d+)$/) { + $force += $1; } elsif (m/^-D$/) { open DEBUG, ">&2" or die $!; } else { @@ -58,6 +63,11 @@ sub check_space () { $!=0; $?=0; close P or die "$! $?"; my $space= $1; printf "space: %8d, wanted: %8d ", $space, logcfg('MinSpaceMby'); + if ($force) { + $force--; + printf "FORCING "; + return 0; + } return $space >= logcfg('MinSpaceMby'); }