Skip to contentSkip to conversation

cr-ensure-disk-space: Fix reference to iteration_proceed

PATCH New Ian Jackson 1 participant 3 messages Jul 25, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 cr-ensure-disk-space: Fix reference to iteration_proceed

8738d60622c1 "cr-ensure-disk-space: Break out check_space" renamed iteration_continue to iteration_proceed but did not change the call site.

---
 cr-ensure-disk-space | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cr-ensure-disk-space +1 -1
index 2d299dd..bb98835 100755
@@ -152,7 +152,7 @@ db_retry($dbh_tests,[], sub {
     @flights = ();
     for (;;) {
 	last if check_space();
-	iteration_continue();
+	iteration_proceed();
     }
 });
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH 2/3 cr-ensure-disk-space: Break out quit_ok

We are going to want another call site.

No functional change.

---
 cr-ensure-disk-space | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
cr-ensure-disk-space +8 -2
index bb98835..6a9781a 100755
@@ -61,6 +61,13 @@ sub check_space () {
     return $space >= logcfg('MinSpaceMby');
 }
 
+sub quit_ok () {
+    printf "ok.\n";
+    exit 0;
+}
+
+$|=1;
+
 exit 0 if check_space;
 
 my $lock = "$c{GlobalLockDir}/publish-lock";
@@ -156,5 +163,4 @@ db_retry($dbh_tests,[], sub {
     }
 });
 
-printf "ok.\n";
-exit 0;
+quit_ok();
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

PATCH 3/3 cr-ensure-disk-space: Correct stdout output

In reply to Ian Jackson

d221996eea64 "cr-ensure-disk-space: Run check_space before taking lock" introduced an additional call to check_space but check_space prints the start of a message (with no newline) expecting iteration_proceed to print the rest.

Move $|=1 up appropriately and add a couple of messages in the right place. This involves calling quit_ok rather than exit 0.

---
 cr-ensure-disk-space | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
cr-ensure-disk-space +4 -2
index 6a9781a..ff6b01b 100755
@@ -68,13 +68,15 @@ sub quit_ok () {
 
 $|=1;
 
-exit 0 if check_space;
+check_space if check_space;
+
+print "taking lock...";
 
 my $lock = "$c{GlobalLockDir}/publish-lock";
 open LOCK, "> $lock" or die "$lock $!";
 flock LOCK, LOCK_EX or die $!;
 
-$|=1;
+print "proceeding...\n";
 
 my $chkq= db_prepare("SELECT * FROM flights WHERE flight=?");
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel