def stop_balancer(self):
logging.info("Stopping the balancer and waiting a max of %i sec" % self.balancer_wait_secs)
wait_cnt = 0
self.timer.start(self.timer_name)
self.set_balancer(False)
while wait_cnt < self.balancer_wait_secs:
if self.check_balancer_running():
wait_cnt += self.balancer_sleep
logging.info("Balancer is still running, sleeping for %i sec(s)" % self.balancer_sleep)
sleep(self.balancer_sleep)
else:
self.timer.stop(self.timer_name)
logging.info("Balancer stopped after %.2f seconds" % self.timer.duration(self.timer_name))
return
logging.fatal("Could not stop balancer %s!" % self.db.uri)
raise DBOperationError("Could not stop balancer %s" % self.db.uri)
评论列表
文章目录