[Server-devel] [PATCH] backup-available.py: a more sensible "disk full" refusal

martin.langhoff at gmail.com martin.langhoff at gmail.com
Tue Jul 22 02:36:13 EDT 2008


From: Martin Langhoff <martin at laptop.org>

Replace a buggy test (was checking free blocks and file entries
for the _root_ user) with a more sensible test: refuse to backup
if we are over 90% usage on the partition.

ds-cleanup.py should manage the quota - this is a trick to stem
the tide if disk usage is going overboard.
---
 server/backup-available.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/server/backup-available.py b/server/backup-available.py
index 71c944e..b7a2dab 100644
--- a/server/backup-available.py
+++ b/server/backup-available.py
@@ -20,7 +20,9 @@ def handler(req):
 
     # we need at least a few blocks...
     libstat = os.statvfs(basehomedir);
-    if (libstat[3] < 100 or libstat[6] < 100):
+    usedblockspc = 1 - float(libstat[4])/libstat[2]
+    usedfnodespc = 1 - float(libstat[7])/libstat[5]
+    if (usedblockspc > 0.9 or usedfnodespc > 0.9):
         return apache.HTTP_SERVICE_UNAVAILABLE
 
     # Limit concurrent rsync clients
-- 
1.5.6.dirty



More information about the Server-devel mailing list