예제 #1
0
 def _remove_shareholder(self, why, shareid, where):
     ln = self.log(
         format="error while sending %(method)s to shareholder=%(shnum)d",
         method=where,
         shnum=shareid,
         level=log.UNUSUAL,
         failure=why)
     if shareid in self.landlords:
         self.landlords[shareid].abort()
         peerid = self.landlords[shareid].get_peerid()
         assert peerid
         del self.landlords[shareid]
         self.servermap[shareid].remove(peerid)
         if not self.servermap[shareid]:
             del self.servermap[shareid]
     else:
         # even more UNUSUAL
         self.log("they weren't in our list of landlords",
                  parent=ln,
                  level=log.WEIRD,
                  umid="TQGFRw")
     happiness = happinessutil.servers_of_happiness(self.servermap)
     if happiness < self.min_happiness:
         peerids = set(
             happinessutil.shares_by_server(self.servermap).keys())
         msg = happinessutil.failure_message(len(peerids),
                                             self.required_shares,
                                             self.min_happiness, happiness)
         msg = "%s: %s" % (msg, why)
         raise UploadUnhappinessError(msg)
     self.log("but we can still continue with %s shares, we'll be happy "
              "with at least %s" % (happiness, self.min_happiness),
              parent=ln)
예제 #2
0
 def _remove_shareholder(self, why, shareid, where):
     ln = self.log(format="error while sending %(method)s to shareholder=%(shnum)d",
                   method=where, shnum=shareid,
                   level=log.UNUSUAL, failure=why)
     if shareid in self.landlords:
         self.landlords[shareid].abort()
         peerid = self.landlords[shareid].get_peerid()
         assert peerid
         del self.landlords[shareid]
         self.servermap[shareid].remove(peerid)
         if not self.servermap[shareid]:
             del self.servermap[shareid]
     else:
         # even more UNUSUAL
         self.log("they weren't in our list of landlords", parent=ln,
                  level=log.WEIRD, umid="TQGFRw")
     happiness = happinessutil.servers_of_happiness(self.servermap)
     if happiness < self.servers_of_happiness:
         peerids = set(happinessutil.shares_by_server(self.servermap).keys())
         msg = happinessutil.failure_message(len(peerids),
                                             self.required_shares,
                                             self.servers_of_happiness,
                                             happiness)
         msg = "%s: %s" % (msg, why)
         raise UploadUnhappinessError(msg)
     self.log("but we can still continue with %s shares, we'll be happy "
              "with at least %s" % (happiness,
                                    self.servers_of_happiness),
              parent=ln)