From: Thierry Parmentelat Date: Wed, 23 Jan 2008 19:07:22 +0000 (+0000) Subject: *kill all the Qemu instance when stopping nodes. X-Git-Tag: 2008-02-11-last-vmware-support~100 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a7e0e38829ebfb89cd88e0c805e8dc7406c38f2c;p=tests.git *kill all the Qemu instance when stopping nodes. *Restore the network configuration in the hosts machines when the all Qemus emulation are shut down. --- diff --git a/system/TestNode.py b/system/TestNode.py index 0461a88..248f6c9 100644 --- a/system/TestNode.py +++ b/system/TestNode.py @@ -144,3 +144,7 @@ class TestNode: 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 )) diff --git a/system/TestPlc.py b/system/TestPlc.py index fee41e0..f586694 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -96,7 +96,20 @@ class TestPlc: utils.system('pgrep vmplayer | xargs -r kill ') utils.system('pgrep vmware | xargs -r kill -9') utils.system('pgrep vmplayer | xargs -r kill -9') - + + def kill_all_qemus(self): + for site_spec in self.plc_spec['sites']: + test_site = TestSite (self,site_spec) + for node_spec in site_spec['nodes']: + test_node=TestNode (self,test_site,node_spec) + model=node_spec['node_fields']['model'] + host_machine=node_spec['node_fields']['host_machine'] + hostname=node_spec['node_fields']['hostname'] + print model + if model.find("qemu") >= 0: + utils.system('ssh root@%s killall qemu'%host_machine) + test_node.stop_qemu(host_machine,hostname) + #################### step methods ### uninstall @@ -345,6 +358,7 @@ class TestPlc: def start_nodes (self, options): self.kill_all_vmwares() + self.kill_all_qemus() utils.header("Starting vmware nodes") for site_spec in self.plc_spec['sites']: TestSite(self,site_spec).start_nodes (options) @@ -352,6 +366,7 @@ class TestPlc: def stop_nodes (self, options): self.kill_all_vmwares () + self.kill_all_qemus() return True # returns the filename to use for sql dump/restore, using options.dbname if set