Example #1
0
	def format():
		if DiskHeartbeat.is_in_use():
			nodes=DiskHeartbeat().get_all_ts().keys()
			print "Warning: Heartbeat disk is in use by:", ", ".join(nodes)

			if(raw_input("Proceed ? [y/N]:").upper() != "Y"):
				print "Aborded by user."
				raise SystemExit(0)

		DiskHeartbeat.format()
		print "Device", core.cfg['HB_DISK'], "formatted."
Example #2
0
    def __init__(self):
        self.role = MasterService.RL_ALONE  # Current role of this node
        self.state = MasterService.ST_NORMAL  # Current cluster error status
        self.master = None  # Name of the active master
        self.masterLastSeen = 0  # Timestamp for master failover
        self.status = dict()  # Whole cluster status
        self.localNode = Node(DNSCache.getInstance().name)
        self.disk = DiskHeartbeat()
        self.s_slaveHb = SlaveHearbeatService(self)
        self.s_masterHb = MasterHeartbeatService(self)
        self.s_rpc = RPCService(self)

        # Watchdogs for failover
        self.l_slaveDog = task.LoopingCall(self.checkMasterHeartbeat)
        self.l_masterDog = task.LoopingCall(self.checkSlaveHeartbeats)

        # Election Stuff
        self.ballotBox = None  # All received votes
        self.currentElection = None  # Election name, none if no pending election
        self.f_tally = None  # IDelayedCall used to trigger countVotes()
        self.lastTallyDate = 0  # Timestamp for debbuging elections
        self.panicRequested = False  # True if panic is requested during election