quick fix for qemu start/stop on remote testboxes
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Mon, 7 Apr 2008 21:10:54 +0000 (21:10 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Mon, 7 Apr 2008 21:10:54 +0000 (21:10 +0000)
system/TestBox.py
system/TestPlc.py
system/template-qemu/qemu-kill-node
system/template-qemu/qemu-start-node

index 978344c..773a914 100644 (file)
@@ -34,8 +34,9 @@ class TestBox:
     def mkdir (self,dirname):
         return self.test_ssh.mkdir(dirname)
 
-    def kill_all_qemus(self):
-        self.run_in_buildname("template-qemu/qemu-kill-node")
+    # we need at least one nodename, as template-qemu is not synced on remote testboxes
+    def kill_all_qemus(self,nodename):
+        self.run_in_buildname("qemu-%s/qemu-kill-node"%nodename)
         return True
 
     def list_all_qemus(self):
index 112b993..df4d431 100644 (file)
@@ -181,7 +181,7 @@ class TestPlc:
                 test_node = TestNode (self, test_site, node_spec)
                 if not test_node.is_real():
                     tuples.append( (test_node.host_box(),test_node) )
-        # transform into a dict { 'host_box' -> [ hostnames .. ] }
+        # transform into a dict { 'host_box' -> [ test_node .. ] }
         result = {}
         for (box,node) in tuples:
             if not result.has_key(box):
@@ -198,9 +198,11 @@ class TestPlc:
 
     # make this a valid step
     def kill_all_qemus(self):
+        # this is the brute force version, kill all qemus on that host box
         for (box,nodes) in self.gather_hostBoxes().iteritems():
-            # this is the brute force version, kill all qemus on that host box
-            TestBox(box,self.options.buildname).kill_all_qemus()
+            # pass the first nodename, as we don't push template-qemu on testboxes
+            nodename=nodes[0].name()
+            TestBox(box,self.options.buildname).kill_all_qemus(nodename)
         return True
 
     # make this a valid step
index 830d33d..a4a00d0 100755 (executable)
@@ -4,11 +4,16 @@ COMMAND=$(basename $0)
 cd $(dirname $0)
 cd ..
 
+# somehow qemu-system-x86_64 show up in pgrep as qemu-system-x86
+COMMANDS_TO_KILL="qemu qemu-system-x86_64 qemu-system-x86"
+
 function usage () {
     echo "Usage: $COMMAND -l"
     echo "  lists current qemu processes"
     echo "usage: $COMMAND hostname"
     echo "  kill qemu instance for that node"
+    echo "usage: $COMMAND"
+    echo "  kill all instances of [$COMMANDS_TO_KILL]"
     exit 1
 }
 
@@ -20,7 +25,9 @@ function list_pids () {
            cat $nodedir/qemu.pid 2> /dev/null
        done
     else
-       pgrep qemu
+       for command in $COMMANDS_TO_KILL; do
+           pgrep -x $command
+       done
     fi
 }
 
@@ -44,8 +51,10 @@ function kill_pids () {
            kill_from_file $nodedir/qemu.pid
        done
     else
-       echo Killing all processes mathing qemu
-       pkill qemu
+       echo "Killing all processes mathing $COMMANDS_TO_KILL"
+       for command in $COMMANDS_TO_KILL ; do
+           pkill -x $command
+       done
     fi
 }
 
index c0606f0..29f465c 100755 (executable)
@@ -22,6 +22,7 @@ fi
 . $CONFIG
 
 # the launcher, depending on local/target archs
+# make sure to check qemu-kill-node for consistency
 archs="$(uname -i)+$TARGET_ARCH"
 case $archs in
     i386+i386)         QEMU=qemu;;