本文整理汇总了Python中agent.Agent.kill方法的典型用法代码示例。如果您正苦于以下问题:Python Agent.kill方法的具体用法?Python Agent.kill怎么用?Python Agent.kill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agent.Agent
的用法示例。
在下文中一共展示了Agent.kill方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ctl_kill
# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import kill [as 别名]
def ctl_kill(hostname):
"""Ask master to kill the specified node."""
def success(result):
print "Node", hostname, "successfully killed."
print "Node", hostname, "will be removed from cluster without care."
if(raw_input("Are you sure ? [y/N]:").upper() != "Y"):
print "Aborded by user."
raise SystemExit(0)
agent=Agent()
d=agent.kill(hostname)
d.addCallback(success)
return d
示例2: cxm_fence
# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import kill [as 别名]
def cxm_fence(cluster, options, node_name):
"""Fence node from cluster."""
def fence(result):
cluster.get_local_node().fence(node_name)
if not core.cfg['QUIET']:
print "Node", node_name, "successfully fenced."
# Flag use to kill node if it belong to the cluster
in_cluster=True
if not core.cfg['QUIET']: print "Fencing", node_name ,"..."
try:
node=cluster.get_node(node_name)
vms=node.get_vms_names()
if(len(vms)>0):
print "** WARNING : Some VM are running on this node :"
print "** -> " + ", ".join(vms)
except xencluster.NotInClusterError:
if not core.cfg['QUIET']: print "Node not found in cluster."
in_cluster=False
# No confirm if quiet is on.
if not core.cfg['QUIET']:
if(raw_input("Are you really sure ? [y/N]:").upper() != "Y"):
print "Aborded by user."
return
if in_cluster:
# Remove node from cluster (kill) before fencing it to avoid failover
agent=Agent()
d=agent.kill(node_name)
# Fence only in case of kill success, that way, you can't fence master
d.addCallback(fence)
return d
else:
fence(None)