+ # probing nodes
+ def check_nodes_ping(self,timeout_seconds=120,period_seconds=10):
+ class CompleterTaskPingNode (CompleterTask):
+ def __init__ (self, hostname):
+ self.hostname=hostname
+ def run(self,silent):
+ command="ping -c 1 -w 1 %s >& /dev/null"%self.hostname
+ return utils.system (command, silent=silent)==0
+ def failure_message (self):
+ return "Cannot ping node with name %s"%self.hostname
+ timeout=timedelta (seconds=timeout_seconds)
+ graceout=timeout
+ period=timedelta (seconds=period_seconds)
+ node_infos = self.all_node_infos()
+ tasks = [ CompleterTaskPingNode (h) for (h,_) in node_infos ]
+ return Completer (tasks).run (timeout, graceout, period)
+
+ # ping node before we try to reach ssh, helpful for troubleshooting failing bootCDs
+ def ping_node (self):
+ "Ping nodes"
+ return self.check_nodes_ping ()
+