def __init__(self, Environment, randseed=None): ClusterManager.__init__(self, Environment, randseed) self.update({ "Name" : "corosync(flatiron)", "StartCmd" : "service corosync start", "StopCmd" : "service corosync stop", "RereadCmd" : "service corosync reload", "StatusCmd" : "service corosync status %s", "DeadTime" : 30, "StartTime" : 15, # Max time to start up "StableTime" : 10, "BreakCommCmd" : "/usr/share/corosync/tests/net_breaker.sh BreakCommCmd %s", "FixCommCmd" : "/usr/share/corosync/tests/net_breaker.sh FixCommCmd %s", "QuorumCmd" : "corosync-quorumtool -s", "Pat:We_stopped" : "%s.*Corosync Cluster Engine exiting with status.*", "Pat:They_stopped" : "%s.*Member left:.*%s.*", "Pat:They_dead" : "corosync:.*Node %s is now: lost", "Pat:Local_starting" : "%s.*started and ready to provide service.", "Pat:Local_started" : "%s.*started and ready to provide service.", "Pat:Master_started" : "%s.*Completed service synchronization, ready to provide service.", "Pat:Slave_started" : "%s.*Completed service synchronization, ready to provide service.", "Pat:ChildKilled" : "%s corosync.*Child process %s terminated with signal 9", "Pat:ChildRespawn" : "%s corosync.*Respawning failed child process: %s", "Pat:ChildExit" : "Child process .* exited", "Pat:DC_IDLE" : ".*A processor joined or left the membership and a new membership was formed.", # Bad news Regexes. Should never occur. "BadRegexes" : ( r"ERROR:", r"CRIT:", r"Shutting down\.", r"Forcing shutdown\.", r"core dump", r"Could not bind AF_UNIX", r"Too many open files", ), "LogFileName" : Environment["LogFileName"], }) self.start_cpg = True self.cpg_agent = {} self.confdb_agent = {} self.sam_agent = {} self.votequorum_agent = {} self.config = CoroConfig () self.node_to_ip = {} self.new_config = {} self.new_config['service[1]/name'] = 'corosync_tst_sv2' self.new_config['service[1]/ver'] = '0' self.applied_config = {} for n in self.Env["nodes"]: ip = socket.gethostbyname(n) ips = ip.split('.') ips[3] = '0' ip_mask = '.'.join(ips) self.new_config['totem/interface/bindnetaddr'] = str(ip_mask) return
def __init__(self, Environment, randseed=None): ClusterManager.__init__(self, Environment, randseed) self.update({ "Name" : "corosync(needle)", "StartCmd" : "service corosync start", "StopCmd" : "service corosync stop", "RereadCmd" : "service corosync reload", "StatusCmd" : "service corosync status", "DeadTime" : 30, "StartTime" : 15, # Max time to start up "StableTime" : 10, "BreakCommCmd" : "/usr/share/corosync/tests/net_breaker.sh BreakCommCmd %s", "FixCommCmd" : "/usr/share/corosync/tests/net_breaker.sh FixCommCmd %s", "QuorumCmd" : "corosync-quorumtool -s", "Pat:We_stopped" : "%s.*Corosync Cluster Engine exiting.*", "Pat:They_stopped" : "%s.*Member left:.*%s.*", "Pat:They_dead" : "corosync:.*Node %s is now: lost", "Pat:Local_starting" : "%s.*Initializing transport", "Pat:Local_started" : "%s.*Initializing transport", "Pat:Master_started" : "%s.*Completed service synchronization, ready to provide service.", "Pat:Slave_started" : "%s.*Completed service synchronization, ready to provide service.", "Pat:ChildKilled" : "%s corosync.*Child process %s terminated with signal 9", "Pat:ChildRespawn" : "%s corosync.*Respawning failed child process: %s", "Pat:ChildExit" : "Child process .* exited", "Pat:DC_IDLE" : ".*A new membership.*was formed.", # Bad news Regexes. Should never occur. "BadRegexes" : ( r"ERROR:", r"CRIT:", r"Shutting down\.", r"Forcing shutdown\.", r"core dump", r"Could not bind AF_UNIX", r"Too many open files", r"Address already in use", ), "LogFileName" : Environment["LogFileName"], }) self.start_cpg = True self.cpg_agent = {} self.sam_agent = {} self.votequorum_agent = {} self.config = CoroConfig () self.node_to_ip = {} self.new_config = {} self.applied_config = {} for n in self.Env["nodes"]: ip = socket.gethostbyname(n) ips = ip.split('.') ips[3] = '0' ip_mask = '.'.join(ips) self.new_config['totem/interface/bindnetaddr'] = str(ip_mask) return
def StartaCM(self, node, verbose=False): if not self.ShouldBeStatus.has_key(node): self.ShouldBeStatus[node] = "down" if self.ShouldBeStatus[node] != "down": return 1 self.debug('starting corosync on : ' + node) ret = ClusterManager.StartaCM(self, node) if self.start_cpg: if self.cpg_agent.has_key(node): self.cpg_agent[node].restart() else: self.cpg_agent[node] = CpgTestAgent(node, self.Env) self.cpg_agent[node].start() if self.sam_agent.has_key(node): self.sam_agent[node].restart() # votequorum agent started as needed. if self.applied_config.has_key('quorum/provider'): if self.applied_config['quorum/provider'] is 'corosync_votequorum': if self.votequorum_agent.has_key(node): self.votequorum_agent[node].restart() else: self.votequorum_agent[node] = VoteQuorumTestAgent( node, self.Env) self.votequorum_agent[node].start() return ret
def StopaCM(self, node, verbose=False): if self.ShouldBeStatus[node] != "up": return 1 self.debug('stoping corosync on : ' + node) if self.cpg_agent.has_key(node): self.cpg_agent[node].stop() if self.sam_agent.has_key(node): self.sam_agent[node].stop() if self.votequorum_agent.has_key(node): self.votequorum_agent[node].stop() return ClusterManager.StopaCM(self, node)
"""call function""" _args = list(self._args) _args.extend(args) _kargs = self._kargs.copy() _kargs.update(kargs) return apply(self._function, _args, _kargs) # Basic Sanity Testing if __name__ == '__main__': import CTSlab env = CTSlab.LabEnvironment() env["nodes"] = [] env["nodes"].append("pcmk-1") env["nodes"].append("pcmk-2") env["nodes"].append("pcmk-3") env["nodes"].append("pcmk-4") env["CIBResource"] = 1 env["IPBase"] = "10.0.0.10" env["DoStonith"] = 1 env["stonith-type"] = "fence_xvm" env["stonith-params"] = "pcmk_arg_map=domain:uname" manager = ClusterManager(env) manager.cluster_monitor = False CibFactory = ConfigFactory(manager) cib = CibFactory.createConfig("pacemaker-1.1") print cib.contents()
def __call__(self, *args, **kargs): """call function""" _args = list(self._args) _args.extend(args) _kargs = self._kargs.copy() _kargs.update(kargs) return apply(self._function,_args,_kargs) # Basic Sanity Testing if __name__ == '__main__': import CTSlab env = CTSlab.LabEnvironment() env["nodes"] = [] env["nodes"].append("pcmk-1") env["nodes"].append("pcmk-2") env["nodes"].append("pcmk-3") env["nodes"].append("pcmk-4") env["CIBResource"] = 1 env["IPBase"] = "10.0.0.10" env["DoStonith"]=1 env["stonith-type"] = "fence_xvm" env["stonith-params"] = "pcmk_arg_map=domain:uname" manager = ClusterManager(env) manager.cluster_monitor = False CibFactory = ConfigFactory(manager) cib = CibFactory.createConfig("pacemaker-1.1") print cib.contents()
def RereadCM(self, node): self.log('reloading corosync on : ' + node) return ClusterManager.RereadCM(self, node)