From: Brian Warner Date: Fri, 25 May 2012 19:58:18 +0000 (-0700) Subject: CheckResults.get_servers_responding() now returns IServers X-Git-Url: https://git.rkrishnan.org/pf/content/en/service/somewhere?a=commitdiff_plain;h=da9ac5529493593195fc6598c85c64b764c7f20f;p=tahoe-lafs%2Ftahoe-lafs.git CheckResults.get_servers_responding() now returns IServers Remove temporary get_new_servers_responding(). --- diff --git a/src/allmydata/check_results.py b/src/allmydata/check_results.py index e9de13ca..636603e5 100644 --- a/src/allmydata/check_results.py +++ b/src/allmydata/check_results.py @@ -103,10 +103,8 @@ class CheckResults: 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 def get_servers_responding(self): - return [s.get_serverid() for s in self._servers_responding] + return self._servers_responding def get_host_counter_good_shares(self): return self._count_good_share_hosts diff --git a/src/allmydata/immutable/filenode.py b/src/allmydata/immutable/filenode.py index e248dc9b..a1a0c698 100644 --- a/src/allmydata/immutable/filenode.py +++ b/src/allmydata/immutable/filenode.py @@ -126,7 +126,7 @@ class CiphertextFileNode: # prr (post-repair results) verifycap = self._verifycap - servers_responding = set(cr.get_new_servers_responding()) + servers_responding = set(cr.get_servers_responding()) sm = DictOfSets() assert isinstance(cr.get_sharemap(), DictOfSets) for shnum, servers in cr.get_sharemap().items(): diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index f4fa2a9d..86c94cd8 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -2167,12 +2167,12 @@ class ICheckResults(Interface): (serverid, storage_index, sharenum).""" def get_servers_responding(): - """Return a list of (binary) storage server identifiers, one for each - server which responded to the share query (even if they said they - didn't have shares, and even if they said they did have shares but - then didn't send them when asked, or dropped the connection, or - returned a Failure, and even if they said they did have shares and - sent incorrect ones when asked)""" + """Return a list of IServer objects, one for each server which + responded to the share query (even if they said they didn't have + shares, and even if they said they did have shares but then didn't + send them when asked, or dropped the connection, or returned a + Failure, and even if they said they did have shares and sent + incorrect ones when asked)""" def get_host_counter_good_shares(): """Return the number of distinct storage servers with good shares. If diff --git a/src/allmydata/test/test_deepcheck.py b/src/allmydata/test/test_deepcheck.py index 2ce8382e..045f5c0e 100644 --- a/src/allmydata/test/test_deepcheck.py +++ b/src/allmydata/test/test_deepcheck.py @@ -289,7 +289,8 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase): num_servers, where) self.failUnlessEqual(cr.get_corrupt_shares(), [], where) if not incomplete: - self.failUnlessEqual(sorted(cr.get_servers_responding()), + self.failUnlessEqual(sorted([s.get_serverid() + for s in cr.get_servers_responding()]), sorted(self.g.get_all_serverids()), where) all_serverids = set() diff --git a/src/allmydata/test/test_repairer.py b/src/allmydata/test/test_repairer.py index 0e007423..0a6eb8c3 100644 --- a/src/allmydata/test/test_repairer.py +++ b/src/allmydata/test/test_repairer.py @@ -716,7 +716,9 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin, # not respond to the pre-repair filecheck prr = rr.get_post_repair_results() expected = set(self.g.get_all_serverids()) - self.failUnlessEqual(expected, set(prr.get_servers_responding())) + self.failUnlessEqual(expected, + set([s.get_serverid() + for s in prr.get_servers_responding()])) d.addCallback(_check) return d diff --git a/src/allmydata/web/check_results.py b/src/allmydata/web/check_results.py index f1f3b3c8..8c294628 100644 --- a/src/allmydata/web/check_results.py +++ b/src/allmydata/web/check_results.py @@ -18,8 +18,8 @@ def json_check_counts(r): base32.b2a(si), shnum) for (serverid, si, shnum) in r.get_corrupt_shares() ], - "servers-responding": [idlib.nodeid_b2a(serverid) - for serverid in r.get_servers_responding()], + "servers-responding": [s.get_longname() + for s in r.get_servers_responding()], "sharemap": dict([(shareid, sorted([s.get_longname() for s in servers])) for (shareid, servers)