- def start_vmware (self,options):
- hostname=self.node_spec['node_fields']['hostname']
- path=options.path
- display=options.display
- utils.header('Starting vmplayer for node %s on %s'%(hostname,display))
- utils.system('cd %s/vmplayer-%s ; DISPLAY=%s vmplayer node.vmx < /dev/null >/dev/null 2>/dev/null &'%(path,hostname,display))
-
- def start_qemu (self, options):
- host_machine=self.node_spec['node_fields']['host_machine']
- hostname=self.node_spec['node_fields']['hostname']
- path=options.path
- display=options.display
- dest_dir="qemu-%s"%(hostname)
- utils.header('Starting qemu for node %s '%(hostname))
- utils.system("ssh root@%s ~/%s/env-qemu start "%(host_machine, dest_dir ))
- utils.system("ssh root@%s DISPLAY=%s ~/%s/start-qemu-node %s & "%( host_machine, display, dest_dir, dest_dir))
-
- def stop_qemu(self,host_machine, hostname):
- utils.header('Stoping qemu emulation of %s on the host machine %s and Restoring the initial network'
- %(hostname,host_machine))
- utils.system("ssh root@%s ~/qemu-%s/env-qemu stop "%(host_machine, hostname ))
+ def start_qemu (self):
+ options = self.test_plc.options
+ test_box = self.test_box()
+ utils.header("Starting qemu node %s on %s"%(self.name(),test_box.hostname()))
+
+ test_box.run_in_buildname("%s/qemu-bridge-init start >> %s/qemu.log"%(self.nodedir(),self.nodedir()))
+ # kick it off in background, as it would otherwise hang
+ test_box.run_in_buildname("%s/qemu-start-node 2>&1 >> %s/qemu.log"%(self.nodedir(),self.nodedir()),True)
+
+ def list_qemu (self):
+ utils.header("Listing qemu for host %s on box %s"%(self.name(),self.test_box().hostname()))
+ command="%s/qemu-kill-node -l %s"%(self.nodedir(),self.name())
+ self.test_box().run_in_buildname(command)
+ return True
+
+ def kill_qemu (self):
+ #Prepare the log file before killing the nodes
+ test_box = self.test_box()
+ # kill the right processes
+ utils.header("Stopping qemu for host %s on box %s"%(self.name(),self.test_box().hostname()))
+ command="%s/qemu-kill-node %s"%(self.nodedir(),self.name())
+ self.test_box().run_in_buildname(command)
+ return True
+
+ def gather_qemu_logs (self):
+ if not self.is_qemu():
+ return True
+ remote_log="%s/qemu.log"%self.nodedir()
+ local_log="logs/node.qemu.%s.log"%self.name()
+ self.test_box().test_ssh.fetch(remote_log,local_log)
+
+ def clear_known_hosts (self):
+ TestSsh(self.name()).clear_known_hosts()
+ return True
+
+ def create_test_ssh(self):
+ # get the plc's keys for entering the node
+ vservername=self.test_plc.vservername
+ # assuming we've run testplc.fetch_keys()
+ key = "keys/%(vservername)s.rsa"%locals()
+ return TestSsh(self.name(), buildname=self.buildname(), key=key)
+
+ def check_sanity (self):
+ extensions = [ 'py','pl','sh' ]
+ path='tests/qaapi/qa/tests/node/'
+ scripts=utils.locate_sanity_scripts ('node '+self.name(), path,extensions)
+ overall = True
+ for script in scripts:
+ if not self.check_sanity_script (script):
+ overall = False
+ return overall
+
+ def check_sanity_script (self,local_script):
+ # push the script on the node's root context
+ ssh_handle=self.create_test_ssh()
+ ssh_handle.copy_home(local_script)
+ script_name=os.path.basename(local_script)
+ if ssh_handle.run("./"+script_name) != 0:
+ print "WARNING: sanity check script %s FAILED"%script_name
+ # xxx - temporary : always return true for now
+ #return False
+ return True