2 # this models a box that hosts qemu nodes
3 # could probably also be used for boxes that host plc instances
10 def __init__(self,hostname,buildname,key=None):
11 self.hostname_value=hostname
12 self.buildname=buildname
16 return self.hostname_value
19 return utils.is_local (self.hostname())
22 if os.path.isdir("nodeslogs"):
23 tar_command="tar cvf nodeslogs.tar nodeslogs/ && rm -rf nodeslogs"
24 self.run_in_buildname (tar_command)
28 def run_in_buildname (self,command):
30 return utils.system(command)
33 ssh_comand += "-i %s.rsa "%(self.key)
34 ssh_command += "%s/%s"%(self.buildname,utils.backslash_shell_specials(command))
35 return utils.system(ssh_command)
37 # should use rsync instead
38 def copy (self,local_file,recursive=False):
42 if recursive: command += "-r "
44 command += "-i %s.rsa "
45 command +="%s %s:%s/%s"%(local_file,self.hostname(),self.buildname,
46 os.path.basename(local_file) or ".")
47 return utils.system(command)
52 return utils.system("rm -rf %s"%self.buildname)
57 return utils.system("mkdir %s"%self.buildname)
59 def kill_all_qemus(self):
60 self.run_in_buildname("killall qemu")