From: Brian Warner Date: Sat, 21 Feb 2009 04:28:56 +0000 (-0700) Subject: storage: also report space-free-for-root and space-free-for-nonroot, since that helps... X-Git-Tag: allmydata-tahoe-1.4.0~164 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/frontends/%22news.html/?a=commitdiff_plain;h=d2d297f12f29f60a6aa92feca750abb29ca2eba3;p=tahoe-lafs%2Ftahoe-lafs.git storage: also report space-free-for-root and space-free-for-nonroot, since that helps users understand the space-left-for-tahoe number better --- diff --git a/src/allmydata/storage/server.py b/src/allmydata/storage/server.py index 3b30fe96..b5f83f4e 100644 --- a/src/allmydata/storage/server.py +++ b/src/allmydata/storage/server.py @@ -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 diff --git a/src/allmydata/web/storage.py b/src/allmydata/web/storage.py index fcdcef02..a759fec9 100644 --- a/src/allmydata/web/storage.py +++ b/src/allmydata/web/storage.py @@ -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 diff --git a/src/allmydata/web/storage_status.xhtml b/src/allmydata/web/storage_status.xhtml index c98e6c6e..c5683e17 100644 --- a/src/allmydata/web/storage_status.xhtml +++ b/src/allmydata/web/storage_status.xhtml @@ -15,6 +15,14 @@ Disk space used: - + + ====== + Disk space free (root): + + [see 1] + Disk space free (non-root): + + [see 2] Reserved space: - @@ -39,6 +47,10 @@ +

[1]: Some of this space may be reserved for the superuser.

+

[2]: This reports the space available to non-root users, including the + Tahoe node.

+