#command gets run in the plc's vm
def host_to_guest(self,command):
if self.options.plcs_use_lxc:
- return "ssh -o StrictHostKeyChecking=no %s %s"%(self.hostname(),command)
+ return "ssh -o StrictHostKeyChecking=no %s %s"%(self.vserverip,command)
else:
return "vserver %s exec %s"%(self.vservername,command)
- def vm_root_in_guest(self):
+ def vm_root_in_host(self):
if self.options.plcs_use_lxc:
return "/var/lib/lxc/%s/rootfs/"%(self.vservername)
else:
return "/vservers/%s"%(self.vservername)
+ def vm_timestamp_path (self):
+ if self.options.plcs_use_lxc:
+ return "/var/lib/lxc/%s.timestamp"%(self.vservername)
+ else:
+ return "/vservers/%s.timestamp"%(self.vservername)
+
#start/stop the vserver
def start_guest_in_host(self):
if self.options.plcs_use_lxc:
- return "lxc-start --name=%s"%(self.vservername)
+ return "lxc-start --daemon --name=%s"%(self.vservername)
else:
return "vserver %s start"%(self.vservername)
now=int(time.time())
# TODO-lxc check this one
# a first approx. is to store the timestamp close to the VM root like vs does
- stamp_path="%s.timestamp"%self.vm_root_in_guest()
+ stamp_path=self.vm_timestamp_path ()
+ stamp_dir = os.path.dirname (stamp_path)
+ utils.system(self.test_ssh.actual_command("mkdir -p %s"%stamp_dir))
return utils.system(self.test_ssh.actual_command("echo %d > %s"%(now,stamp_path)))==0
# this is called inconditionnally at the beginning of the test sequence
# just in case this is a rerun, so if the vm is not running it's fine
def vs_delete(self):
"vserver delete the test myplc"
- stamp_path="%s.timestamp"%self.vm_root_in_guest()
+ stamp_path=self.vm_timestamp_path()
self.run_in_host("rm -f %s"%stamp_path)
if self.options.plcs_use_lxc:
+ self.run_in_host("lxc-stop --name %s"%self.vservername)
self.run_in_host("lxc-destroy --name %s"%self.vservername)
return True
else:
if not os.path.isdir(dir):
os.mkdir(dir)
vservername=self.vservername
- vm_root=self.vm_root_in_guest()
+ vm_root=self.vm_root_in_host()
overall=True
prefix = 'debug_ssh_key'
for ext in [ 'pub', 'rsa' ] :
"runs PLCAPI stress test, that checks Add/Update/Delete on all types - preserves contents"
# install the stress-test in the plc image
location = "/usr/share/plc_api/plcsh_stress_test.py"
- remote="%s/%s"%(self.vm_root_in_guest(),location)
+ remote="%s/%s"%(self.vm_root_in_host(),location)
self.test_ssh.copy_abs("plcsh_stress_test.py",remote)
command = location
command += " -- --check"
file(reg_fname,"w").write("<registries>%s</registries>\n" % \
" ".join([ plc.registry_xml_line() for plc in other_plcs ]))
utils.header ("(Over)wrote %s"%reg_fname)
- return self.test_ssh.copy_abs(agg_fname,'/%s/etc/sfa/aggregates.xml'%self.vm_root_in_guest())==0 \
- and self.test_ssh.copy_abs(reg_fname,'/%s/etc/sfa/registries.xml'%self.vm_root_in_guest())==0
+ return self.test_ssh.copy_abs(agg_fname,'/%s/etc/sfa/aggregates.xml'%self.vm_root_in_host())==0 \
+ and self.test_ssh.copy_abs(reg_fname,'/%s/etc/sfa/registries.xml'%self.vm_root_in_host())==0
def sfa_import(self):
"sfa-import-plc"
test_slice.sfi_config(dir_name)
# push into the remote /root/sfi area
location = test_slice.sfi_path()
- remote="%s/%s"%(self.vm_root_in_guest(),location)
+ remote="%s/%s"%(self.vm_root_in_host(),location)
self.test_ssh.mkdir(remote,abs=True)
# need to strip last level or remote otherwise we get an extra dir level
self.test_ssh.copy_abs(dir_name, os.path.dirname(remote), recursive=True)
"creates random entries in the PLCAPI"
# install the stress-test in the plc image
location = "/usr/share/plc_api/plcsh_stress_test.py"
- remote="%s/%s"%(self.vm_root_in_guest(),location)
+ remote="%s/%s"%(self.vm_root_in_host(),location)
self.test_ssh.copy_abs("plcsh_stress_test.py",remote)
command = location
command += " -- --preserve --short-names"