]> xenbits.xensource.com Git - qemu-upstream-unstable.git/commitdiff
iotests: Only kill NBD server if it runs
authorMax Reitz <mreitz@redhat.com>
Tue, 2 Dec 2014 17:32:48 +0000 (18:32 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Sun, 22 Feb 2015 18:04:13 +0000 (12:04 -0600)
There may be NBD tests which do not create a sample image and simply
test whether wrong usage of the protocol is rejected as expected. In
this case, there will be no NBD server and trying to kill it during
clean-up will fail.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit f798068c565918ead63218d083ff814b7635be72)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
tests/qemu-iotests/common.rc

index 9c49deb3dd2138c0b3b27a1b073a99e58d90d3bd..f2554ec0af1161b4c73ca4bd3f7321199c4605d7 100644 (file)
@@ -175,7 +175,9 @@ _cleanup_test_img()
     case "$IMGPROTO" in
 
         nbd)
-            kill $QEMU_NBD_PID
+            if [ -n "$QEMU_NBD_PID" ]; then
+                kill $QEMU_NBD_PID
+            fi
             rm -f "$TEST_IMG_FILE"
             ;;
         file)