xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [OSSTEST PATCH 2/6] cr-ensure-disk-space: -F option
Date: Tue, 4 Oct 2016 13:26:30 +0100	[thread overview]
Message-ID: <1475583994-30203-2-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1475583994-30203-1-git-send-email-ian.jackson@eu.citrix.com>

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 <Ian.Jackson@eu.citrix.com>
---
 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');
 }
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-10-04 12:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-04 12:26 [OSSTEST PATCH 1/6] cr-ensure-disk-space: Do not take out the lock in dry run mode Ian Jackson
2016-10-04 12:26 ` Ian Jackson [this message]
2016-10-04 12:26 ` [OSSTEST PATCH 3/6] cr-ensure-disk-space: Dry run produces better `die' message Ian Jackson
2016-10-04 12:26 ` [OSSTEST PATCH 4/6] mg-allocate: Tiny refactoring Ian Jackson
2016-10-04 12:26 ` [OSSTEST PATCH 5/6] flight preservation: Honour flight allocation during expiry Ian Jackson
2016-10-04 12:26 ` [OSSTEST PATCH 6/6] flight preservation: Provide a way to allocate flights Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475583994-30203-2-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).