DeepResultsBase also has a get_corrupt_shares(), and it is populated
from CheckResults.get_corrupt_shares(). It has been updated too, along
with get_remaining_corrupt_shares().
Remove temporary get_new_corrupt_shares() and
get_new_incompatible_shares().
def get_share_counter_wrong(self):
return self._count_wrong_shares
def get_share_counter_wrong(self):
return self._count_wrong_shares
- def get_new_corrupt_shares(self):
- return self._list_corrupt_shares
def get_corrupt_shares(self):
def get_corrupt_shares(self):
- return [(s.get_serverid(), SI, shnum)
- for (s, SI, shnum) in self._list_corrupt_shares]
+ return self._list_corrupt_shares
- def get_new_incompatible_shares(self):
- return self._list_incompatible_shares
def get_incompatible_shares(self):
def get_incompatible_shares(self):
- return [(s.get_serverid(), SI, shnum)
- for (s, SI, shnum) in self._list_incompatible_shares]
+ return self._list_incompatible_shares
def get_servers_responding(self):
return self._servers_responding
def get_servers_responding(self):
return self._servers_responding
servers_responding=list(servers_responding),
sharemap=sm,
count_wrong_shares=0, # no such thing as wrong, for immutable
servers_responding=list(servers_responding),
sharemap=sm,
count_wrong_shares=0, # no such thing as wrong, for immutable
- list_corrupt_shares=cr.get_new_corrupt_shares(),
+ list_corrupt_shares=cr.get_corrupt_shares(),
count_corrupt_shares=len(cr.get_corrupt_shares()),
count_corrupt_shares=len(cr.get_corrupt_shares()),
- list_incompatible_shares=cr.get_new_incompatible_shares(),
+ list_incompatible_shares=cr.get_incompatible_shares(),
count_incompatible_shares=len(cr.get_incompatible_shares()),
summary="",
report=[],
count_incompatible_shares=len(cr.get_incompatible_shares()),
summary="",
report=[],
def get_corrupt_shares():
"""Return a list of 'share locators', one for each share that was
found to be corrupt (integrity failure). Each share locator is a list
def get_corrupt_shares():
"""Return a list of 'share locators', one for each share that was
found to be corrupt (integrity failure). Each share locator is a list
- of (serverid, storage_index, sharenum)."""
+ of (IServer, storage_index, sharenum)."""
def get_incompatible_shares():
"""Return a list of 'share locators', one for each share that was
found to be of an unknown format. Each share locator is a list of
def get_incompatible_shares():
"""Return a list of 'share locators', one for each share that was
found to be of an unknown format. Each share locator is a list of
- (serverid, storage_index, sharenum)."""
+ (IServer, storage_index, sharenum)."""
def get_servers_responding():
"""Return a list of IServer objects, one for each server which
def get_servers_responding():
"""Return a list of IServer objects, one for each server which
"""
def get_corrupt_shares():
"""
def get_corrupt_shares():
- """Return a set of (serverid, storage_index, sharenum) for all shares
- that were found to be corrupt. Both serverid and storage_index are
- binary.
- """
+ """Return a set of (IServer, storage_index, sharenum) for all shares
+ that were found to be corrupt. storage_index is binary."""
def get_all_results():
"""Return a dictionary mapping pathname (a tuple of strings, ready to
be slash-joined) to an ICheckResults instance, one for each object
def get_all_results():
"""Return a dictionary mapping pathname (a tuple of strings, ready to
be slash-joined) to an ICheckResults instance, one for each object
IDirectoryNode.deep_stats()."""
def get_corrupt_shares():
IDirectoryNode.deep_stats()."""
def get_corrupt_shares():
- """Return a set of (serverid, storage_index, sharenum) for all shares
- that were found to be corrupt before any repair was attempted. Both
- serverid and storage_index are binary.
+ """Return a set of (IServer, storage_index, sharenum) for all shares
+ that were found to be corrupt before any repair was attempted.
+ storage_index is binary.
"""
def get_remaining_corrupt_shares():
"""
def get_remaining_corrupt_shares():
- """Return a set of (serverid, storage_index, sharenum) for all shares
- that were found to be corrupt after any repair was completed. Both
- serverid and storage_index are binary. These are shares that need
- manual inspection and probably deletion.
+ """Return a set of (IServer, storage_index, sharenum) for all shares
+ that were found to be corrupt after any repair was completed.
+ storage_index is binary. These are shares that need manual inspection
+ and probably deletion.
"""
def get_all_results():
"""Return a dictionary mapping pathname (a tuple of strings, ready to
"""
def get_all_results():
"""Return a dictionary mapping pathname (a tuple of strings, ready to
s = self.remove_tags(html)
self.failUnlessIn("File Check Results for SI=2k6avp", s) # abbreviated
self.failUnlessIn("Not Recoverable! : rather dead", s)
s = self.remove_tags(html)
self.failUnlessIn("File Check Results for SI=2k6avp", s) # abbreviated
self.failUnlessIn("Not Recoverable! : rather dead", s)
- self.failUnlessIn("Corrupt shares: Share ID Nickname Node ID sh#2 peer-0 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", s)
+ self.failUnlessIn("Corrupt shares: Share ID Nickname Node ID sh#2 peer-0 00000000", s)
html = self.render2(w)
s = self.remove_tags(html)
html = self.render2(w)
s = self.remove_tags(html)
["v0-00000000-long", "v0-ffffffff-long"]},
'count-recoverable-versions': 1,
'list-corrupt-shares':
["v0-00000000-long", "v0-ffffffff-long"]},
'count-recoverable-versions': 1,
'list-corrupt-shares':
- [["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
- "2k6avpjga3dho3zsjo6nnkt7n4", 2]],
+ [["v0-00000000-long", "2k6avpjga3dho3zsjo6nnkt7n4", 2]],
'count-good-share-hosts': 11,
'count-wrong-shares': 0,
'count-shares-good': 10,
'count-good-share-hosts': 11,
'count-wrong-shares': 0,
'count-shares-good': 10,
from allmydata.web.common import getxmlfile, get_arg, get_root, WebError
from allmydata.web.operations import ReloadMixin
from allmydata.interfaces import ICheckAndRepairResults, ICheckResults
from allmydata.web.common import getxmlfile, get_arg, get_root, WebError
from allmydata.web.operations import ReloadMixin
from allmydata.interfaces import ICheckAndRepairResults, ICheckResults
-from allmydata.util import base32, idlib, dictutil
+from allmydata.util import base32, dictutil
def json_check_counts(r):
d = {"count-shares-good": r.get_share_counter_good(),
def json_check_counts(r):
d = {"count-shares-good": r.get_share_counter_good(),
"count-shares-expected": r.get_encoding_expected(),
"count-good-share-hosts": r.get_host_counter_good_shares(),
"count-corrupt-shares": len(r.get_corrupt_shares()),
"count-shares-expected": r.get_encoding_expected(),
"count-good-share-hosts": r.get_host_counter_good_shares(),
"count-corrupt-shares": len(r.get_corrupt_shares()),
- "list-corrupt-shares": [ (idlib.nodeid_b2a(serverid),
- base32.b2a(si), shnum)
- for (serverid, si, shnum)
+ "list-corrupt-shares": [ (s.get_longname(), base32.b2a(si), shnum)
+ for (s, si, shnum)
in r.get_corrupt_shares() ],
"servers-responding": [s.get_longname()
for s in r.get_servers_responding()],
in r.get_corrupt_shares() ],
"servers-responding": [s.get_longname()
for s in r.get_servers_responding()],
if cr.get_corrupt_shares():
badsharemap = []
if cr.get_corrupt_shares():
badsharemap = []
- for (serverid, si, shnum) in cr.get_corrupt_shares():
- nickname = sb.get_nickname_for_serverid(serverid)
- badsharemap.append(T.tr[T.td["sh#%d" % shnum],
- T.td[T.div(class_="nickname")[nickname],
- T.div(class_="nodeid")[T.tt[base32.b2a(serverid)]]],
- ])
+ for (s, si, shnum) in cr.get_corrupt_shares():
+ d = T.tr[T.td["sh#%d" % shnum],
+ T.td[T.div(class_="nickname")[s.get_nickname()],
+ T.div(class_="nodeid")[T.tt[s.get_name()]]],
+ ]
+ badsharemap.append(d)
add("Corrupt shares", T.table()[
T.tr[T.th["Share ID"],
T.th(class_="nickname-and-peerid")[T.div["Nickname"], T.div(class_="nodeid")["Node ID"]]],
add("Corrupt shares", T.table()[
T.tr[T.th["Share ID"],
T.th(class_="nickname-and-peerid")[T.div["Nickname"], T.div(class_="nodeid")["Node ID"]]],
data["count-objects-healthy"] = c["count-objects-healthy"]
data["count-objects-unhealthy"] = c["count-objects-unhealthy"]
data["count-corrupt-shares"] = c["count-corrupt-shares"]
data["count-objects-healthy"] = c["count-objects-healthy"]
data["count-objects-unhealthy"] = c["count-objects-unhealthy"]
data["count-corrupt-shares"] = c["count-corrupt-shares"]
- data["list-corrupt-shares"] = [ (idlib.nodeid_b2a(serverid),
+ data["list-corrupt-shares"] = [ (s.get_longname(),
base32.b2a(storage_index),
shnum)
base32.b2a(storage_index),
shnum)
- for (serverid, storage_index, shnum)
+ for (s, storage_index, shnum)
in res.get_corrupt_shares() ]
data["list-unhealthy-files"] = [ (path_t, json_check_results(r))
for (path_t, r)
in res.get_corrupt_shares() ]
data["list-unhealthy-files"] = [ (path_t, json_check_results(r))
for (path_t, r)
return ""
def data_servers_with_corrupt_shares(self, ctx, data):
return ""
def data_servers_with_corrupt_shares(self, ctx, data):
- servers = [serverid
- for (serverid, storage_index, sharenum)
+ servers = [s
+ for (s, storage_index, sharenum)
in self.monitor.get_status().get_corrupt_shares()]
in self.monitor.get_status().get_corrupt_shares()]
+ servers.sort(key=lambda s: s.get_longname())
- def render_server_problem(self, ctx, data):
- serverid = data
- data = [idlib.shortnodeid_b2a(serverid)]
- sb = self.client.get_storage_broker()
- nickname = sb.get_nickname_for_serverid(serverid)
+ def render_server_problem(self, ctx, server):
+ data = [server.get_name()]
+ nickname = server.get_nickname()
if nickname:
data.append(" (%s)" % self._html(nickname))
return ctx.tag[data]
if nickname:
data.append(" (%s)" % self._html(nickname))
return ctx.tag[data]
def data_corrupt_shares(self, ctx, data):
return self.monitor.get_status().get_corrupt_shares()
def render_share_problem(self, ctx, data):
def data_corrupt_shares(self, ctx, data):
return self.monitor.get_status().get_corrupt_shares()
def render_share_problem(self, ctx, data):
- serverid, storage_index, sharenum = data
- sb = self.client.get_storage_broker()
- nickname = sb.get_nickname_for_serverid(serverid)
- ctx.fillSlots("serverid", idlib.shortnodeid_b2a(serverid))
+ server, storage_index, sharenum = data
+ nickname = server.get_nickname()
+ ctx.fillSlots("serverid", server.get_name())
if nickname:
ctx.fillSlots("nickname", self._html(nickname))
ctx.fillSlots("si", self._render_si_link(ctx, storage_index))
if nickname:
ctx.fillSlots("nickname", self._html(nickname))
ctx.fillSlots("si", self._render_si_link(ctx, storage_index))
data["count-corrupt-shares-pre-repair"] = c["count-corrupt-shares-pre-repair"]
data["count-corrupt-shares-post-repair"] = c["count-corrupt-shares-pre-repair"]
data["count-corrupt-shares-pre-repair"] = c["count-corrupt-shares-pre-repair"]
data["count-corrupt-shares-post-repair"] = c["count-corrupt-shares-pre-repair"]
- data["list-corrupt-shares"] = [ (idlib.nodeid_b2a(serverid),
+ data["list-corrupt-shares"] = [ (s.get_longname(),
base32.b2a(storage_index),
shnum)
base32.b2a(storage_index),
shnum)
- for (serverid, storage_index, shnum)
+ for (s, storage_index, shnum)
in res.get_corrupt_shares() ]
in res.get_corrupt_shares() ]
- remaining_corrupt = [ (idlib.nodeid_b2a(serverid),
- base32.b2a(storage_index),
+ remaining_corrupt = [ (s.get_longname(), base32.b2a(storage_index),
- for (serverid, storage_index, shnum)
+ for (s, storage_index, shnum)
in res.get_remaining_corrupt_shares() ]
data["list-remaining-corrupt-shares"] = remaining_corrupt
in res.get_remaining_corrupt_shares() ]
data["list-remaining-corrupt-shares"] = remaining_corrupt