'init_node','bootcd', 'configure_qemu', 'export_qemu',
'kill_all_qemus', 'reinstall_node','start_node', SEP,
'nodes_booted', 'nodes_ssh', 'check_slice',
- 'check_initscripts', 'check_tcp',SEP,
+ 'check_initscripts', 'check_tcp', 'plcsh_stress_test', SEP,
'force_gather_logs', 'force_kill_qemus', 'force_record_tracker','force_free_tracker' ]
- other_steps = [ 'stop_all_vservers','fresh_install', 'cache_rpm', 'stop', SEP,
- 'clean_initscripts', 'clean_sites', 'clean_nodes',
+ other_steps = [ 'stop_all_vservers','fresh_install', 'cache_rpm', 'stop', 'vs_start', SEP,
+ 'clean_initscripts', 'clean_all_sites',
+ 'clean_sites', 'clean_nodes',
'clean_slices', 'clean_keys', SEP,
'show_boxes', 'list_all_qemus', 'list_qemus', SEP,
'db_dump' , 'db_restore', ' cleanup_tracker',
def actual_command_in_guest (self,command):
return self.test_ssh.actual_command(self.host_to_guest(command))
+ def start_guest (self):
+ return utils.system(self.test_ssh.actual_command(self.start_guest_in_host()))
+
def run_in_guest (self,command):
return utils.system(self.actual_command_in_guest(command))
def host_to_guest(self,command):
return "vserver %s exec %s"%(self.vservername,command)
+ #command gets run in the vserver
+ def start_guest_in_host(self):
+ return "vserver %s start"%(self.vservername)
+
# xxx quick n dirty
def run_in_guest_piped (self,local,remote):
return utils.system(local+" | "+self.test_ssh.actual_command(self.host_to_guest(remote),keep_stdin=True))
def start(self):
self.run_in_guest('service plc start')
return True
-
+
def stop(self):
self.run_in_guest('service plc stop')
return True
+ def vs_start (self):
+ self.start_guest()
+ return True
+
# could use a TestKey class
def store_keys(self):
for key_spec in self.plc_spec['keys']:
test_site.create_users()
return True
+ def clean_all_sites (self):
+ print 'auth_root',self.auth_root()
+ site_ids = [s['site_id'] for s in self.apiserver.GetSites(self.auth_root(), {}, ['site_id'])]
+ for site_id in site_ids:
+ print 'Deleting site_id',site_id
+ self.apiserver.DeleteSite(self.auth_root(),site_id)
+
def nodes (self):
return self.do_nodes()
def clean_nodes (self):
for (nodegroupname,group_nodes) in groups_dict.iteritems():
print 'nodegroups:','dealing with nodegroup',nodegroupname,'on nodes',group_nodes
# first, check if the nodetagtype is here
- tag_types = self.apiserver.GetNodeTagTypes(auth,{'tagname':nodegroupname})
+ tag_types = self.apiserver.GetTagTypes(auth,{'tagname':nodegroupname})
if tag_types:
tag_type_id = tag_types[0]['node_tag_type_id']
- print 'node-tag-type',nodegroupname,'already exists'
else:
tag_type_id = self.apiserver.AddNodeTagType(auth,
{'tagname':nodegroupname,
'min_role_id':10})
# create nodegroup
nodegroups = self.apiserver.GetNodeGroups (auth, {'groupname':nodegroupname})
- if nodegroups:
- print 'nodegroup',nodegroupname,'already exists'
- else:
- self.apiserver.AddNodeGroup(auth,
- {'groupname': nodegroupname,
- 'node_tag_type_id': tag_type_id,
- 'tagvalue': 'yes'})
+ if not nodegroups:
+ self.apiserver.AddNodeGroup(auth, nodegroupname, tag_type_id, 'yes')
# set node tag on all nodes, value='yes'
overall = True
for nodename in group_nodes:
print 'Mismatch node tag on node',nodename,'got',expect_yes
overall=False
except:
- print 'Cannot find tag',nodegroupname,'on node',nodename
- overall = False
+ if not self.options.dry_run:
+ print 'Cannot find tag',nodegroupname,'on node',nodename
+ overall = False
return overall
def all_hostnames (self) :
return hostnames
# gracetime : during the first <gracetime> minutes nothing gets printed
- def do_nodes_booted (self, minutes, gracetime,period=30):
+ def do_nodes_booted (self, minutes, gracetime,period=15):
if self.options.dry_run:
print 'dry_run'
return True
def nodes_booted(self):
return self.do_nodes_booted(minutes=20,gracetime=15)
- def do_nodes_ssh(self,minutes,gracetime,period=30):
+ def do_nodes_ssh(self,minutes,gracetime,period=15):
# compute timeout
timeout = datetime.datetime.now()+datetime.timedelta(minutes=minutes)
graceout = datetime.datetime.now()+datetime.timedelta(minutes=gracetime)
if not c_test_sliver.run_tcp_client(s_test_sliver.test_node.name(),port):
overall=False
return overall
-
+
+ def plcsh_stress_test (self):
+ # install the stress-test in the plc image
+ location = "/usr/share/plc_api/plcsh-stress-test.py"
+ remote="/vservers/%s/%s"%(self.vservername,location)
+ self.test_ssh.copy_abs("plcsh-stress-test.py",remote)
+ command = location
+ command += " -- --check"
+ if self.options.small_test:
+ command += " --tiny"
+ return ( self.run_in_guest(command) == 0)
def gather_logs (self):
# (1) get the plc's /var/log and store it locally in logs/myplc.var-log.<plcname>/*