storage: also report space-free-for-root and space-free-for-nonroot, since that helps users understand the space-left-for-tahoe number better

This commit is contained in:
Brian Warner 2009-02-20 21:28:56 -07:00
parent b3cd4952bd
commit d2d297f12f
3 changed files with 20 additions and 2 deletions

View 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

View 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

View File

@ -15,6 +15,14 @@
<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 />
@ -39,6 +47,10 @@
</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>