]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
storage: also report space-free-for-root and space-free-for-nonroot, since that helps...
authorBrian Warner <warner@lothar.com>
Sat, 21 Feb 2009 04:28:56 +0000 (21:28 -0700)
committerBrian Warner <warner@lothar.com>
Sat, 21 Feb 2009 04:28:56 +0000 (21:28 -0700)
src/allmydata/storage/server.py
src/allmydata/web/storage.py
src/allmydata/web/storage_status.xhtml

index 3b30fe9628b6b825549886088d22b132e3ed7c04..b5f83f4ede933359a0c2072a1b2be212466e5961 100644 (file)
@@ -147,11 +147,13 @@ class StorageServer(service.MultiService, Referenceable):
             disk_total = s.f_bsize * s.f_blocks
             disk_used = s.f_bsize * (s.f_blocks - s.f_bfree)
             # spacetime predictors should look at the slope of disk_used.
-            disk_avail = s.f_bsize * s.f_bavail # available to non-root users
+            disk_free_for_root = s.f_bsize * s.f_bfree
+            disk_free_for_nonroot = s.f_bsize * s.f_bavail
+
             # include our local policy here: if we stop accepting shares when
             # the available space drops below 1GB, then include that fact in
             # disk_avail.
-            disk_avail -= self.reserved_space
+            disk_avail = disk_free_for_nonroot - self.reserved_space
             disk_avail = max(disk_avail, 0)
             if self.readonly_storage:
                 disk_avail = 0
@@ -161,6 +163,8 @@ class StorageServer(service.MultiService, Referenceable):
             # spacetime predictors should use disk_avail / (d(disk_used)/dt)
             stats["storage_server.disk_total"] = disk_total
             stats["storage_server.disk_used"] = disk_used
+            stats["storage_server.disk_free_for_root"] = disk_free_for_root
+            stats["storage_server.disk_free_for_nonroot"] = disk_free_for_nonroot
             stats["storage_server.disk_avail"] = disk_avail
         except AttributeError:
             # os.statvfs is available only on unix
index fcdcef02914f3422d602cc504102dcf9de17f726..a759fec9075a74ad81f04787e8a62bd580d93101 100644 (file)
@@ -57,6 +57,8 @@ class StorageStatus(rend.Page):
                    for k,v in self.storage.get_stats().items() ])
         d.setdefault("disk_total", None)
         d.setdefault("disk_used", None)
+        d.setdefault("disk_free_for_root", None)
+        d.setdefault("disk_free_for_nonroot", None)
         d.setdefault("reserved_space", None)
         d.setdefault("disk_avail", None)
         return d
index c98e6c6e50dcb02bafbcaea892d4b6092772e98c..c5683e171130160d46fdb9602caa7be77df80762 100644 (file)
         <td><span n:render="space" n:data="disk_total" /></td></tr>
     <tr><td>Disk space used:</td>
         <td>- <span n:render="space" n:data="disk_used" /></td></tr>
+    <tr><td />
+        <td>======</td></tr>
+    <tr><td>Disk space free (root):</td>
+        <td><span n:render="space" n:data="disk_free_for_root"/>
+          [see 1]</td></tr>
+    <tr><td>Disk space free (non-root):</td>
+        <td><span n:render="space" n:data="disk_free_for_nonroot" />
+          [see 2]</td></tr>
     <tr><td>Reserved space:</td>
         <td>- <span n:render="space" n:data="reserved_space" /></td></tr>
     <tr><td />
     </li>
   </ul>
 
+  <p>[1]: Some of this space may be reserved for the superuser.</p>
+  <p>[2]: This reports the space available to non-root users, including the
+  Tahoe node.</p>
+
 </div>
 
 </body>