self.uri = uri
self.storage_index = storage_index
self.problems = []
- self.data = {"count-corrupt-shares": 0,
- "list-corrupt-shares": [],
- }
+ self._data = {"count-corrupt-shares": 0,
+ "list-corrupt-shares": [],
+ }
self.summary = ""
self.report = []
def set_needs_rebalancing(self, needs_rebalancing):
self.needs_rebalancing_p = bool(needs_rebalancing)
def set_data(self, data):
- self.data.update(data)
+ self._data.update(data)
def set_summary(self, summary):
assert isinstance(summary, str) # should be a single string
self.summary = summary
def needs_rebalancing(self):
return self.needs_rebalancing_p
def get_data(self):
- return self.data
+ return self._data
def get_summary(self):
return self.summary
# clone the cr (check results) to form the basis of the
# prr (post-repair results)
prr = CheckResults(cr.uri, cr.storage_index)
- prr.data = copy.deepcopy(cr.data)
+ prr_data = copy.deepcopy(cr.get_data())
- servers_responding = set(prr.data['servers-responding'])
- sm = prr.data['sharemap']
+ servers_responding = set(prr_data['servers-responding'])
+ sm = prr_data['sharemap']
assert isinstance(sm, DictOfSets), sm
for shnum, servers in ur.get_sharemap().items():
for s in servers:
sm.add(shnum, s.get_serverid())
servers_responding.add(s.get_serverid())
servers_responding = sorted(servers_responding)
- prr.data['servers-responding'] = servers_responding
- prr.data['count-shares-good'] = len(sm)
+ prr_data['servers-responding'] = servers_responding
+ prr_data['count-shares-good'] = len(sm)
good_hosts = len(reduce(set.union, sm.itervalues(), set()))
- prr.data['count-good-share-hosts'] = good_hosts
+ prr_data['count-good-share-hosts'] = good_hosts
+ prr.set_data(prr_data)
verifycap = self._verifycap
is_healthy = bool(len(sm) >= verifycap.total_shares)
is_recoverable = bool(len(sm) >= verifycap.needed_shares)
def _check_and_repair(_):
return self.imm.check_and_repair(Monitor())
def _check_counts(crr, shares_good, good_share_hosts):
- p_crr = crr.get_post_repair_results().data
+ p_crr = crr.get_post_repair_results().get_data()
#print self._pretty_shares_chart(self.uri)
self.failUnlessEqual(p_crr['count-shares-good'], shares_good)
self.failUnlessEqual(p_crr['count-good-share-hosts'],
self.failIfBigger(delta_reads, MAX_DELTA_READS)
self.failIfBigger(delta_allocates, (DELTA_WRITES_PER_SHARE * 7))
self.failIf(pre.is_healthy())
- self.failUnless(post.is_healthy(), post.data)
+ self.failUnless(post.is_healthy(), post.get_data())
# Make sure we really have 10 shares.
shares = self.find_uri_shares(self.uri)
# 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.data["servers-responding"]))
+ self.failUnlessEqual(expected, set(prr.get_data()["servers-responding"]))
d.addCallback(_check)
return d