From: Brian Warner Date: Sat, 7 Mar 2009 23:14:42 +0000 (-0700) Subject: expirer: make web display a bit more consistent X-Git-Tag: allmydata-tahoe-1.4.0~78 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/frontends/COPYING.TGPPL.html?a=commitdiff_plain;h=5675b4e7e0d6f71dc21756c12f0876be496e4c46;p=tahoe-lafs%2Ftahoe-lafs.git expirer: make web display a bit more consistent --- diff --git a/src/allmydata/storage/expirer.py b/src/allmydata/storage/expirer.py index 0579135a..42691b06 100644 --- a/src/allmydata/storage/expirer.py +++ b/src/allmydata/storage/expirer.py @@ -149,6 +149,8 @@ class LeaseCheckingCrawler(ShareCrawler): so_far = self.state["cycle-to-date"] self.increment(so_far["leases-per-share-histogram"], num_leases, 1) so_far["shares-examined"] += 1 + # TODO: accumulate share-sizes too, so we can display "the whole + # cycle would probably recover x GB out of y GB total" would_keep_share = [1, 1, 1] diff --git a/src/allmydata/test/test_storage.py b/src/allmydata/test/test_storage.py index 7ccd2ec7..82dfa609 100644 --- a/src/allmydata/test/test_storage.py +++ b/src/allmydata/test/test_storage.py @@ -1618,15 +1618,15 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin): self.failUnlessIn("So far, this cycle has examined " "1 shares in 1 buckets " "and has recovered: " - "0 buckets, 0 shares, 0 B ", s) + "0 shares, 0 buckets, 0 B ", s) self.failUnlessIn("If expiration were enabled, " "we would have recovered: " - "0 buckets, 0 shares, 0 B by now", s) + "0 shares, 0 buckets, 0 B by now", s) self.failUnlessIn("and the remainder of this cycle " "would probably recover: " - "0 buckets, 0 shares, 0 B ", s) + "0 shares, 0 buckets, 0 B ", s) self.failUnlessIn("and the whole cycle would probably recover: " - "0 buckets, 0 shares, 0 B ", s) + "0 shares, 0 buckets, 0 B ", s) self.failUnlessIn("if we were using each lease's default " "31-day lease lifetime", s) self.failUnlessIn("this cycle would be expected to recover: ", s) @@ -1686,7 +1686,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin): d.addCallback(lambda ign: self.render1(webstatus)) def _check_html(html): s = remove_tags(html) - self.failUnlessIn("recovered: 0 buckets, 0 shares, 0 B " + self.failUnlessIn("recovered: 0 shares, 0 buckets, 0 B " "but expiration was not enabled", s) d.addCallback(_check_html) return d @@ -1779,10 +1779,10 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin): # all. This part of the test depends upon the SIs landing right # where they do now. self.failUnlessIn("The remainder of this cycle is expected to " - "recover: 5 buckets, 5 shares", s) + "recover: 5 shares, 5 buckets", s) self.failUnlessIn("The whole cycle is expected to examine " "6 shares in 6 buckets and to recover: " - "6 buckets, 6 shares", s) + "6 shares, 6 buckets", s) d.addCallback(_check_html_in_cycle) # wait for the crawler to finish the first cycle. Two shares should @@ -1833,7 +1833,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin): def _check_html(html): s = remove_tags(html) self.failUnlessIn("Expiration Enabled: expired leases will be removed", s) - self.failUnlessIn(" recovered: 2 buckets, 2 shares, ", s) + self.failUnlessIn(" recovered: 2 shares, 2 buckets, ", s) d.addCallback(_check_html) return d diff --git a/src/allmydata/web/storage.py b/src/allmydata/web/storage.py index 686e92af..0549bc57 100644 --- a/src/allmydata/web/storage.py +++ b/src/allmydata/web/storage.py @@ -139,8 +139,8 @@ class StorageStatus(rend.Page): return "?" return "%d" % d space = abbreviate_space(sr["%s-diskbytes" % a]) - return "%s buckets, %s shares, %s" % (maybe(sr["%s-numbuckets" % a]), - maybe(sr["%s-numshares" % a]), + return "%s shares, %s buckets, %s" % (maybe(sr["%s-numshares" % a]), + maybe(sr["%s-numbuckets" % a]), space) def render_lease_current_cycle_progress(self, ctx, data):