From: Daira Hopwood Date: Thu, 5 Sep 2013 16:58:58 +0000 (+0100) Subject: Tue Mar 13 02:57:36 GMT 2012 Brian Warner X-Git-Url: https://git.rkrishnan.org/specifications/%5B/%5D%20/%22doc.html/reliability?a=commitdiff_plain;h=9508c09880eeaeed7860be0bfba61a6657d92ff2;p=tahoe-lafs%2Ftahoe-lafs.git Tue Mar 13 02:57:36 GMT 2012 Brian Warner * Add nickname/nodeid to storage-status web page. Closes #1204. Also add tahoe.css to the page, to make it look slightly prettier. --- diff --git a/src/allmydata/test/test_storage.py b/src/allmydata/test/test_storage.py index cbfb988d..08c513cd 100644 --- a/src/allmydata/test/test_storage.py +++ b/src/allmydata/test/test_storage.py @@ -3973,13 +3973,16 @@ class WebStatus(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin): def test_status(self): basedir = "storage/WebStatus/status" fileutil.make_dirs(basedir) - ss = StorageServer(basedir, "\x00" * 20) + nodeid = "\x00" * 20 + ss = StorageServer(basedir, nodeid) ss.setServiceParent(self.s) - w = StorageStatus(ss) + w = StorageStatus(ss, "nickname") d = self.render1(w) def _check_html(html): self.failUnlessIn("

Storage Server Status

", html) s = remove_tags(html) + self.failUnlessIn("Server Nickname: nickname", s) + self.failUnlessIn("Server Nodeid: %s" % base32.b2a(nodeid), s) self.failUnlessIn("Accepting new shares: Yes", s) self.failUnlessIn("Reserved space: - 0 B (0)", s) d.addCallback(_check_html) diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index 6481289d..69ee6460 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -159,7 +159,7 @@ class Root(rend.Page): s = client.getServiceNamed("storage") except KeyError: s = None - self.child_storage = storage.StorageStatus(s) + self.child_storage = storage.StorageStatus(s, self.client.nickname) self.child_uri = URIHandler(client) self.child_cap = URIHandler(client) diff --git a/src/allmydata/web/storage.py b/src/allmydata/web/storage.py index f224c289..24d769bb 100644 --- a/src/allmydata/web/storage.py +++ b/src/allmydata/web/storage.py @@ -3,7 +3,7 @@ import time, simplejson from nevow import rend, tags as T, inevow from allmydata.web.common import getxmlfile, abbreviate_time, get_arg from allmydata.util.abbreviate import abbreviate_space -from allmydata.util import time_format +from allmydata.util import time_format, idlib def remove_prefix(s, prefix): if not s.startswith(prefix): @@ -14,9 +14,10 @@ class StorageStatus(rend.Page): docFactory = getxmlfile("storage_status.xhtml") # the default 'data' argument is the StorageServer instance - def __init__(self, storage): + def __init__(self, storage, nickname=""): rend.Page.__init__(self, storage) self.storage = storage + self.nickname = nickname def renderHTTP(self, ctx): req = inevow.IRequest(ctx) @@ -34,6 +35,11 @@ class StorageStatus(rend.Page): } return simplejson.dumps(d, indent=1) + "\n" + def data_nickname(self, ctx, storage): + return self.nickname + def data_nodeid(self, ctx, storage): + return idlib.nodeid_b2a(self.storage.my_nodeid) + def render_storage_running(self, ctx, storage): if storage: return ctx.tag diff --git a/src/allmydata/web/storage_status.xhtml b/src/allmydata/web/storage_status.xhtml index 64029c55..19860a49 100644 --- a/src/allmydata/web/storage_status.xhtml +++ b/src/allmydata/web/storage_status.xhtml @@ -1,6 +1,7 @@ Tahoe-LAFS - Storage Server Status + @@ -53,12 +54,11 @@ -
    -
  • Accepting new shares: -
  • -
-
    +
  • Server Nickname:
  • +
  • Server Nodeid:
  • +
  • Accepting new shares: +
  • Total buckets: (the number of files and directories for which this server is holding