示例#1
0
    def all_objects(self, req, tag):
        results = {}
        if self.monitor.get_status():
            results = self.monitor.get_status().get_all_results()
        objects = []

        for path in sorted(results.keys()):
            result = results[path]
            storage_index = result.get_storage_index()
            obj = {
                "path":
                self._join_pathstring(path),
                "healthy_pre_repair":
                str(result.get_pre_repair_results().is_healthy()),
                "recoverable_pre_repair":
                str(result.get_pre_repair_results().is_recoverable()),
                "healthy_post_repair":
                str(result.get_post_repair_results().is_healthy()),
                "storage_index":
                self._render_si_link(req, storage_index),
                "summary":
                self._html(result.get_pre_repair_results().get_summary()),
            }
            objects.append(obj)

        return SlotsSequenceElement(tag, objects)
示例#2
0
 def post_repair_corrupt_shares(self, req, tag):
     # TODO: this was not implemented before porting to
     # twisted.web.template; leaving it as such.
     #
     # https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3371
     corrupt = [{"share": "unimplemented"}]
     return SlotsSequenceElement(tag, corrupt)
示例#3
0
 def subscribers(self, req, tag):
     subscribers = [{
         "nickname": s.nickname,
         "tubid": s.tubid,
         "connected": s.remote_address,
         "since": render_time(s.when),
         "version": s.version,
         "service_name": s.service_name,
     } for s in self.introducer_service.get_subscribers()]
     return SlotsSequenceElement(tag, subscribers)
示例#4
0
 def services(self, req, tag):
     services = self.introducer_service.get_announcements()
     services.sort(key=lambda ad: (ad.service_name, ad.nickname))
     services = [{
         "serverid": ad.serverid,
         "nickname": ad.nickname,
         "connection-hints":
             u"connection hints: " + u" ".join(ad.connection_hints),
         "connected": u"?",
         "announced": render_time(ad.when),
         "version": ad.version,
         "service_name": ad.service_name,
     } for ad in services]
     return SlotsSequenceElement(tag, services)
示例#5
0
    def post_repair_problems(self, req, tag):
        all_objects = self.monitor.get_status().get_all_results()
        problems = []

        for path in sorted(all_objects.keys()):
            r = all_objects[path]
            assert ICheckAndRepairResults.providedBy(r)
            cr = r.get_post_repair_results()
            if not cr.is_healthy():
                problem = self._join_pathstring(path), ": ", self._html(
                    cr.get_summary())
                problems.append({"problem": problem})

        return SlotsSequenceElement(tag, problems)
示例#6
0
    def corrupt_shares(self, req, tag):
        shares = self.monitor.get_status().get_corrupt_shares()
        problems = []

        for share in shares:
            server, storage_index, sharenum = share
            nickname = server.get_nickname()
            problem = {
                "serverid": server.get_name(),
                "nickname": self._html(nickname),
                "si": self._render_si_link(req, storage_index),
                "shnum": str(sharenum),
            }
            problems.append(problem)

        return SlotsSequenceElement(tag, problems)
示例#7
0
    def servers_with_corrupt_shares(self, req, tag):
        servers = [
            s for (s, storage_index,
                   sharenum) in self.monitor.get_status().get_corrupt_shares()
        ]
        servers.sort(key=lambda s: s.get_longname())

        problems = []

        for server in servers:
            name = [server.get_name()]
            nickname = server.get_nickname()
            if nickname:
                name.append(" (%s)" % self._html(nickname))
            problems.append({"problem": name})

        return SlotsSequenceElement(tag, problems)
示例#8
0
    def problems(self, req, tag):
        all_objects = self.monitor.get_status().get_all_results()
        problems = []

        for path in sorted(all_objects.keys()):
            cr = all_objects[path]
            assert ICheckResults.providedBy(cr)
            if not cr.is_healthy():
                summary_text = ""
                summary = cr.get_summary()
                if summary:
                    summary_text = ": " + summary
                summary_text += " [SI: %s]" % cr.get_storage_index_string()
                problems.append({
                    # Not sure self._join_pathstring(path) is the
                    # right thing to use here.
                    "problem":
                    self._join_pathstring(path) + self._html(summary_text),
                })

        return SlotsSequenceElement(tag, problems)
示例#9
0
 def introducers_table(self, req, tag):
     rows = [ self._describe_connection_status(cs)
              for cs in self._get_introducers() ]
     return SlotsSequenceElement(tag, rows)
示例#10
0
 def services_table(self, req, tag):
     rows = [ self._describe_server_and_connection(server)
              for server in self._services() ]
     return SlotsSequenceElement(tag, rows)