'check_tcp' ]
other_steps = [ 'fresh_install', 'stop',
'clean_sites', 'clean_nodes', 'clean_slices', 'clean_keys',
- 'kill_qemus', 'stop_nodes' , 'db_dump' , 'db_restore',
+ 'list_all_qemus', 'kill_qemus', 'stop_nodes' ,
+ 'db_dump' , 'db_restore',
'standby_1 through 20',
]
default_build_url = "http://svn.planet-lab.org/svn/build/trunk"
TestBox(box).kill_all_qemus()
return True
+ # make this a valid step
+ def list_all_qemus(self,options):
+ for (box,nodes) in self.gather_hostBoxes().iteritems():
+ # push the script
+ TestBox(box).copy("qemu_kill.sh")
+ # this is the brute force version, kill all qemus on that host box
+ TestBox(box).run("./qemu_kill.sh -l")
+ return True
+
# kill only the right qemus
def kill_qemus(self,options):
for (box,nodes) in self.gather_hostBoxes().iteritems():
+ # push the script
+ TestBox(box).copy("qemu_kill.sh")
# the fine-grain version
for node in nodes:
node.kill_qemu()
COMMAND=$(basename $0)
hostname=$1; shift
-pids="$(ps $(pgrep qemu) | grep $hostname | awk '{print $1;}')"
+
+# -l option
+if [ "$hostname" = "-l" ] ; then
+ echo $COMMAND - listing qemu processes on $(hostname)
+ pids="$(pgrep -x qemu) $(pgrep -x start-qemu-node)"
+ [ -n "$(echo $pids)" ] && ps $pids
+ exit 0
+fi
+
+# locate only the actual qemu
+qemu_pids="$(pgrep -x start-qemu-node) $(pgrep -x qemu)"
+
+if [ -z "$(echo $qemu_pids)" ] ; then
+ echo $COMMAND - no qemu found on $(hostname)
+ exit 0
+fi
+
+pids="$(ps $qemu_pids | grep $hostname | awk '{print $1;}')"
if [ -z "$pids" ] ; then
echo $COMMAND: no qemu instance for $hostname found on $(hostname)
-else
- echo Killing $pids
- kill $pids
- sleep 2
- if [ -n "$(ps $pids)" ] ; then
- echo Killing -9 $pids
- kill -9 $pids
- fi
- echo Done
+ exit 0
fi
+
+echo Killing $pids
+kill $pids
+(sleep 1;
+ if ps $pids &> /dev/null ; then
+ echo still alive - killing -9 $pids
+ kill -9 $pids
+ fi ) &
+echo Done
+exit 0