for step in self.options.steps:
if not TestPlc.valid_step(step):
continue
+ # some steps need to be done no regardless of the previous ones: we force them
force=False
- # is it a forced step
if step.find("force_") == 0:
step=step.replace("force_","")
force=True
+ # a cross step will run a method on TestPlc that has a signature like
+ # def cross_foo (self, all_test_plcs)
+ cross=False
+ if step.find("cross_") == 0:
+ cross=True
# try and locate a method in TestPlc
if testplc_method_dict.has_key(step):
- all_step_infos += [ (step, testplc_method_dict[step] , force)]
+ all_step_infos += [ (step, testplc_method_dict[step] , force, cross)]
# otherwise search for the 'run' method in the step_<x> module
else:
modulename='step_'+step
if not names:
raise Exception,"No run* method in module %s"%modulename
names.sort()
- all_step_infos += [ ("%s.%s"%(step,name),module_dict[name],force) for name in names ]
+ all_step_infos += [ ("%s.%s"%(step,name),module_dict[name],force,cross) for name in names ]
except :
print '********** step %s NOT FOUND -- ignored'%(step)
traceback.print_exc()
# do all steps on all plcs
TIME_FORMAT="%H-%M-%S"
TRACE_FORMAT="TRACE: beg=%(beg)s end=%(end)s status=%(status)s step=%(stepname)s plc=%(plcname)s force=%(force)s\n"
- for (stepname,method,force) in all_step_infos:
- for (spec,obj) in all_plcs:
+ for (stepname,method,force,cross) in all_step_infos:
+ for (spec,plc_obj) in all_plcs:
plcname=spec['name']
+ across_plcs = [ o for (s,o) in all_plcs if o!=plc_obj ]
# run the step
beg=strftime(TIME_FORMAT)
elif answer in ['d']: # dry_run
dry_run=self.options.dry_run
self.options.dry_run=True
- obj.options.dry_run=True
- obj.apiserver.set_dry_run(True)
- step_result=method(obj)
+ plc_obj.options.dry_run=True
+ plc_obj.apiserver.set_dry_run(True)
+ if not cross: step_result=method(plc_obj)
+ else: step_result=method(plc_obj,across_plcs)
print 'dry_run step ->',step_result
self.options.dry_run=dry_run
- obj.options.dry_run=dry_run
- obj.apiserver.set_dry_run(dry_run)
+ plc_obj.options.dry_run=dry_run
+ plc_obj.apiserver.set_dry_run(dry_run)
elif answer in ['r','y']: # run/yes
prompting=False
if skip_step:
force_msg=""
if force: force_msg=" (forced)"
utils.header("********** RUNNING step %s%s on plc %s"%(stepname,force_msg,plcname))
- step_result = method(obj)
+ if not cross: step_result = method(plc_obj)
+ else: step_result = method(plc_obj,across_plcs)
if step_result:
utils.header('********** SUCCESSFUL step %s on %s'%(stepname,plcname))
status="OK"
'kill_all_qemus', 'start_node', SEP,
# better use of time: do this now that the nodes are taking off
'plcsh_stress_test', SEP,
- 'install_sfa', 'configure_sfa', 'import_sfa', 'start_sfa', SEPSFA,
+ 'install_sfa', 'configure_sfa', 'cross_configure_sfa', 'import_sfa', 'start_sfa', SEPSFA,
'setup_sfa', 'add_sfa', 'update_sfa', 'view_sfa', SEPSFA,
'nodes_ssh_debug', 'nodes_ssh_boot', 'check_slice', 'check_initscripts', SEPSFA,
'check_slice_sfa', 'delete_sfa', 'stop_sfa', SEPSFA,
utils.system('rm %s'%tmpname)
return True
+ def aggregate_xml_line(self):
+ return '<aggregate addr="%s" hrn="%s" port="12346"/>' % \
+ (self.vserverip,self.plc_spec['sfa']['SFA_REGISTRY_ROOT_AUTH'])
+
+ def registry_xml_line(self):
+ return '<registry addr="%s" hrn="%s" port="12345"/>' % \
+ (self.vserverip,self.plc_spec['sfa']['SFA_REGISTRY_ROOT_AUTH'])
+
+
+ # a cross step that takes all other plcs in argument
+ def cross_configure_sfa(self, other_plcs):
+ # of course with a single plc, other_plcs is an empty list
+ if other_plcs:
+ filename="%s-agg.xml"%self.name()
+ agg_file=file(filename,"w")
+ agg_file.write("<aggregates>%s</aggregates>\n" % \
+ " ".join([ plc.aggregate_xml_line() for plc in other_plcs ]))
+ agg_file.close()
+ if self.test_ssh.copy_abs(filename,'/vservers/%s/etc/sfa/aggregates.xml'%self.vservername) !=0 : return False
+
+ filename="%s-reg.xml"%self.name()
+ agg_file=file(filename,"w")
+ agg_file.write("<registries>%s</registries>\n" % \
+ " ".join([ plc.registry_xml_line() for plc in other_plcs ]))
+ agg_file.close()
+ if self.test_ssh.copy_abs(filename,'/vservers/%s/etc/sfa/aggregates.xml'%self.vservername) !=0 : return False
+ return True
+
def import_sfa(self):
"sfa-import-plc"
auth=self.plc_spec['sfa']['SFA_REGISTRY_ROOT_AUTH']