assert IDisplayableServer.providedBy(server), server
self._sharemap = sharemap
self._count_wrong_shares = count_wrong_shares
- for (serverid, SI, shnum) in list_corrupt_shares:
- assert isinstance(serverid, str), serverid
+ for (server, SI, shnum) in list_corrupt_shares:
+ assert IDisplayableServer.providedBy(server), server
self._list_corrupt_shares = list_corrupt_shares
self._count_corrupt_shares = count_corrupt_shares
- for (serverid, SI, shnum) in list_incompatible_shares:
- assert isinstance(serverid, str), serverid
+ for (server, SI, shnum) in list_incompatible_shares:
+ assert IDisplayableServer.providedBy(server), server
self._list_incompatible_shares = list_incompatible_shares
self._count_incompatible_shares = count_incompatible_shares
def get_share_counter_wrong(self):
return self._count_wrong_shares
- def get_corrupt_shares(self):
+ def get_new_corrupt_shares(self):
return self._list_corrupt_shares
+ def get_corrupt_shares(self):
+ return [(s.get_serverid(), SI, shnum)
+ for (s, SI, shnum) in self._list_corrupt_shares]
- def get_incompatible_shares(self):
+ def get_new_incompatible_shares(self):
return self._list_incompatible_shares
+ def get_incompatible_shares(self):
+ return [(s.get_serverid(), SI, shnum)
+ for (s, SI, shnum) in self._list_incompatible_shares]
def get_new_servers_responding(self):
return self._servers_responding
for shnum, servers in self._sharemap.items():
sharemap[shnum] = sorted([s.get_serverid() for s in servers])
responding = [s.get_serverid() for s in self._servers_responding]
+ corrupt = [(s.get_serverid(), SI, shnum)
+ for (s, SI, shnum) in self._list_corrupt_shares]
+ incompatible = [(s.get_serverid(), SI, shnum)
+ for (s, SI, shnum) in self._list_incompatible_shares]
d = {"count-shares-needed": self._count_shares_needed,
"count-shares-expected": self._count_shares_expected,
"count-shares-good": self._count_shares_good,
"servers-responding": responding,
"sharemap": sharemap,
"count-wrong-shares": self._count_wrong_shares,
- "list-corrupt-shares": self._list_corrupt_shares,
+ "list-corrupt-shares": corrupt,
"count-corrupt-shares": self._count_corrupt_shares,
- "list-incompatible-shares": self._list_incompatible_shares,
+ "list-incompatible-shares": incompatible,
"count-incompatible-shares": self._count_incompatible_shares,
}
return d
verifiedshares = dictutil.DictOfSets() # {sharenum: set(server)}
servers = {} # {server: set(sharenums)}
- corruptshare_locators = [] # (serverid, storageindex, sharenum)
- incompatibleshare_locators = [] # (serverid, storageindex, sharenum)
- servers_responding = set() # serverid
+ corruptshare_locators = [] # (server, storageindex, sharenum)
+ incompatibleshare_locators = [] # (server, storageindex, sharenum)
+ servers_responding = set() # server
for verified, server, corrupt, incompatible, responded in results:
- server_id = server.get_serverid()
servers.setdefault(server, set()).update(verified)
for sharenum in verified:
verifiedshares.setdefault(sharenum, set()).add(server)
for sharenum in corrupt:
- corruptshare_locators.append((server_id, SI, sharenum))
+ corruptshare_locators.append((server, SI, sharenum))
for sharenum in incompatible:
- incompatibleshare_locators.append((server_id, SI, sharenum))
+ incompatibleshare_locators.append((server, SI, sharenum))
if responded:
servers_responding.add(server)
servers_responding=list(servers_responding),
sharemap=sm,
count_wrong_shares=0, # no such thing as wrong, for immutable
- list_corrupt_shares=cr.get_corrupt_shares(),
+ list_corrupt_shares=cr.get_new_corrupt_shares(),
count_corrupt_shares=len(cr.get_corrupt_shares()),
- list_incompatible_shares=cr.get_incompatible_shares(),
+ list_incompatible_shares=cr.get_new_incompatible_shares(),
count_incompatible_shares=len(cr.get_incompatible_shares()),
summary="",
report=[],
summary.append("Corrupt Shares:")
for (server, shnum, f) in sorted(self.bad_shares):
serverid = server.get_serverid()
- locator = (serverid, self._storage_index, shnum)
+ locator = (server, self._storage_index, shnum)
corrupt_share_locators.append(locator)
s = "%s-sh%d" % (server.get_name(), shnum)
if f.check(CorruptShareError):
sb = c.storage_broker
serverid_1 = "\x00"*20
serverid_f = "\xff"*20
+ server_1 = sb.get_stub_server(serverid_1)
+ server_f = sb.get_stub_server(serverid_f)
u = uri.CHKFileURI("\x00"*16, "\x00"*32, 3, 10, 1234)
data = { "count_shares_needed": 3,
"count_shares_expected": 9,
"count_recoverable_versions": 1,
"count_unrecoverable_versions": 0,
"servers_responding": [],
- "sharemap": {"shareid1": [sb.get_stub_server(serverid_1),
- sb.get_stub_server(serverid_f)]},
+ "sharemap": {"shareid1": [server_1, server_f]},
"count_wrong_shares": 0,
"list_corrupt_shares": [],
"count_corrupt_shares": 0,
self.failUnlessIn("Not Healthy! : ungroovy", s)
data["count_corrupt_shares"] = 1
- data["list_corrupt_shares"] = [(serverid_1, u.get_storage_index(), 2)]
+ data["list_corrupt_shares"] = [(server_1, u.get_storage_index(), 2)]
cr = check_results.CheckResults(u, u.get_storage_index(),
healthy=False, recoverable=False,
needs_rebalancing=False,