-
- utils.header("checking for %s -- slice %s on nodes %r"%(msg,self.name(),tocheck))
- utils.header("max timeout is %d minutes, silent for %d minutes (period is %s)"%\
- (timeout_minutes,silent_minutes,period))
- while tocheck:
- for hostname in tocheck:
- (site_spec,node_spec) = self.test_plc.locate_hostname(hostname)
- test_ssh = TestSsh (hostname,key=private_key,username=self.name())
- full_command = test_ssh.actual_command(command)
- retcod = utils.system (full_command, silent=datetime.datetime.now() < graceout)
- if getattr(options,'dry_run',None): return True
- if expected: success = retcod==0
- else: success = retcod!=0
-
- if success:
- utils.header("OK %s - slice=%s@%s"%(msg,self.name(),hostname))
- tocheck.remove(hostname)
- else:
- # real nodes will have been checked once in case they're up - skip if not
- if TestNode.is_real_model(node_spec['node_fields']['model']):
- utils.header("WARNING : Checking slice %s on real node %s skipped"%(self.name(),hostname))
- tocheck.remove(hostname)
- # nm restart after first failure, if requested
- if options.forcenm and hostname not in restarted:
- utils.header ("forcenm option : restarting nm on %s"%hostname)
- restart_test_ssh=TestSsh(hostname,key="keys/key_admin.rsa")
- access=restart_test_ssh.actual_command('service nm restart')
- if (access==0):
- utils.header('nm restarted on %s'%hostname)
- else:
- utils.header('Failed to restart nm on %s'%(hostname))
- restarted.append(hostname)
- if not tocheck:
- # we're done
- return True
- if datetime.datetime.now() > timeout:
- for hostname in tocheck:
- utils.header("FAILED %s slice=%s@%s"%(msg,self.name(),hostname))
- return False
- # wait for the period
- time.sleep (period)
- # for an empty slice
- return True
+ utils.header("checking for %s -- slice %s"%(msg,self.name()))
+
+ tasks=[]
+ slicename=self.name()
+ dry_run = getattr(options,'dry_run',False)
+ for nodename in self.slice_spec['nodenames']:
+ (site_spec,node_spec) = self.test_plc.locate_node(nodename)
+ tasks.append( CompleterTaskSliceSsh(self.test_plc,node_spec['node_fields']['hostname'],
+ slicename,private_key,command,expected,dry_run))
+ return tasks
+# return Completer (tasks).run (timeout, graceout, period)