2 # this models a box that hosts qemu nodes
3 # could probably also be used for boxes that host plc instances
8 def __init__(self,hostname,key=None):
12 def run (self,command):
13 if self.hostname == "localhost":
14 return utils.system(command)
17 to_run="ssh -i %s.rsa %s %s"%(self.key,self.hostname,
18 utils.backslash_shell_specials(command))
20 to_run="ssh %s %s"%(self.hostname,
21 utils.backslash_shell_specials(command))
22 return utils.system(to_run)
24 def copy (self,local_file):
25 if self.hostname == "localhost":
29 to_run="scp -i %s.rsa %s %s:"%(self.key,local_file,self.hostname)
31 to_run="scp %s %s:"%(local_file,self.hostname)
32 return utils.system(to_run)
34 def kill_all_qemus(self):
35 self.run("killall qemu")