import utils
from TestSsh import TestSsh
+# xxx this should probably inherit TestSsh
class TestBox:
def __init__(self,hostname,buildname,key=None):
return True
return False
- def run_in_buildname (self,command):
+ def run_in_buildname (self,command,background=False):
utils.header("Running command %s on testbox %s"%(command,self.hostname()))
- return self.test_ssh.run_in_buildname (command)
+ return self.test_ssh.run_in_buildname (command,background)
# should use rsync instead
def copy (self,local_file,recursive=False):
def clean_dir (self,dirname):
return self.test_ssh.clean_dir(dirname)
- def mkdir (self,direname):
- return self.test_ssh.mkdir(direname)
+ def mkdir (self,dirname):
+ return self.test_ssh.mkdir(dirname)
def kill_all_qemus(self):
self.run_in_buildname("template-qemu/kill-qemu-node")
utils.header("Starting qemu node %s on %s"%(self.name(),test_box.hostname()))
test_box.run_in_buildname("qemu-%s/env-qemu start >> nodeslogs/%s.log"%(self.name(),self.name()))
- test_box.run_in_buildname("qemu-%s/start-qemu-node 2>&1 >> nodeslogs/%s.log &"%(self.name(),self.name()))
+ # kick it off in background, as it would otherwise hang
+ test_box.run_in_buildname("qemu-%s/start-qemu-node 2>&1 >> nodeslogs/%s.log &"%(self.name(),self.name()),True)
def list_qemu (self):
utils.header("Listing qemu for host %s on box %s"%(self.name(),self.test_box().hostname()))
ssh_command += "%s %s" %(self.hostname,TestSsh.backslash_shell_specials(command))
return ssh_command
- def run(self, command):
- return utils.system(self.actual_command(command))
+ def run(self, command,background=False):
+ local_command = self.actual_command(command)
+ if background:
+ local_command += " &"
+ return utils.system(local_command)
def clean_dir (self,dirname):
if self.is_local():
self.mkdir()
self.buildname_created=True
- def run_in_buildname (self,command):
+ def run_in_buildname (self,command, background=False):
if self.is_local():
return utils.system(command)
self.create_buildname_once()
- return self.run("cd %s ; %s"%(self.buildname,command))
+ return self.run("cd %s ; %s"%(self.buildname,command),background)
def copy (self,local_file,recursive=False):
if self.is_local():
if [[ -n "$hostnames" ]] ; then
for hostname in $hostnames; do
nodedir=qemu-$hostname
- cat $nodedir/qemu.pid $nodedir/shell.pid 2> /dev/null
+ cat $nodedir/qemu.pid 2> /dev/null
done
else
pgrep qemu
for hostname in $hostnames; do
nodedir=qemu-$hostname
kill_from_file $nodedir/qemu.pid
- kill_from_file $nodedir/shell.pid
done
else
echo Killing all processes mathing qemu
#Command for running the Qemu Emulator
ARGS="-boot d -net nic,macaddr=${MACADDR} -net $TAP, -cdrom ${NODE_ISO} -hda ${HDA} -m ${RAM} -nographic -pidfile qemu.pid"
-echo $$ > shell.pid
echo "Running $QEMU $ARGS < /dev/null"
exec $QEMU $ARGS < /dev/null