|
|
7711c0 |
From 1e5bf346765701c7301d3f86311b339288261558 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Fri, 22 Mar 2019 03:22:18 +0100
|
|
|
7711c0 |
Subject: [PATCH 051/163] iotests: nbd: Stop qemu-nbd before remaking image
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190322032241.8111-6-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 85093
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 05/28] iotests: nbd: Stop qemu-nbd before remaking image
|
|
|
7711c0 |
Bugzilla: 1691563
|
|
|
7711c0 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
From: Fam Zheng <famz@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
197 is one example where _make_test_img is used twice without stopping
|
|
|
7711c0 |
the NBD server in between. An error will occur like this:
|
|
|
7711c0 |
|
|
|
7711c0 |
@@ -26,9 +26,13 @@
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Partial final cluster ===
|
|
|
7711c0 |
|
|
|
7711c0 |
+qemu-img: TEST_DIR/t.IMGFMT: Failed to get "resize" lock
|
|
|
7711c0 |
+Is another process using the image?
|
|
|
7711c0 |
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
|
|
|
7711c0 |
+Failed to find an available port: Address already in use
|
|
|
7711c0 |
read 1024/1024 bytes at offset 0
|
|
|
7711c0 |
|
|
|
7711c0 |
Patch _make_test_img to stop the old qemu-nbd before starting a new one,
|
|
|
7711c0 |
which fixes this problem, and similarly 215.
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit 2f9d4083f7fdafe82138e983a24ef30b81b029d7)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
tests/qemu-iotests/common.rc | 21 +++++++++++++++------
|
|
|
7711c0 |
1 file changed, 15 insertions(+), 6 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
|
|
|
7711c0 |
index 9a65a11..1e567b0 100644
|
|
|
7711c0 |
--- a/tests/qemu-iotests/common.rc
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/common.rc
|
|
|
7711c0 |
@@ -190,6 +190,16 @@ _use_sample_img()
|
|
|
7711c0 |
fi
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
+_stop_nbd_server()
|
|
|
7711c0 |
+{
|
|
|
7711c0 |
+ if [ -f "${QEMU_TEST_DIR}/qemu-nbd.pid" ]; then
|
|
|
7711c0 |
+ local QEMU_NBD_PID
|
|
|
7711c0 |
+ read QEMU_NBD_PID < "${QEMU_TEST_DIR}/qemu-nbd.pid"
|
|
|
7711c0 |
+ kill ${QEMU_NBD_PID}
|
|
|
7711c0 |
+ rm -f "${QEMU_TEST_DIR}/qemu-nbd.pid"
|
|
|
7711c0 |
+ fi
|
|
|
7711c0 |
+}
|
|
|
7711c0 |
+
|
|
|
7711c0 |
_make_test_img()
|
|
|
7711c0 |
{
|
|
|
7711c0 |
# extra qemu-img options can be added by tests
|
|
|
7711c0 |
@@ -229,6 +239,10 @@ _make_test_img()
|
|
|
7711c0 |
extra_img_options="-o $optstr $extra_img_options"
|
|
|
7711c0 |
fi
|
|
|
7711c0 |
|
|
|
7711c0 |
+ if [ $IMGPROTO = "nbd" ]; then
|
|
|
7711c0 |
+ _stop_nbd_server
|
|
|
7711c0 |
+ fi
|
|
|
7711c0 |
+
|
|
|
7711c0 |
# XXX(hch): have global image options?
|
|
|
7711c0 |
(
|
|
|
7711c0 |
if [ $use_backing = 1 ]; then
|
|
|
7711c0 |
@@ -269,12 +283,7 @@ _cleanup_test_img()
|
|
|
7711c0 |
case "$IMGPROTO" in
|
|
|
7711c0 |
|
|
|
7711c0 |
nbd)
|
|
|
7711c0 |
- if [ -f "${QEMU_TEST_DIR}/qemu-nbd.pid" ]; then
|
|
|
7711c0 |
- local QEMU_NBD_PID
|
|
|
7711c0 |
- read QEMU_NBD_PID < "${QEMU_TEST_DIR}/qemu-nbd.pid"
|
|
|
7711c0 |
- kill ${QEMU_NBD_PID}
|
|
|
7711c0 |
- rm -f "${QEMU_TEST_DIR}/qemu-nbd.pid"
|
|
|
7711c0 |
- fi
|
|
|
7711c0 |
+ _stop_nbd_server
|
|
|
7711c0 |
rm -f "$TEST_IMG_FILE"
|
|
|
7711c0 |
;;
|
|
|
7711c0 |
vxhs)
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|