* [Qemu-devel] [PATCH v2] iotests: nbd: Stop qemu-nbd before remaking image
@ 2018-07-11 6:40 Fam Zheng
2018-07-11 10:23 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Fam Zheng @ 2018-07-11 6:40 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Max Reitz, qemu-block
197 is one example where _make_test_img is used twice without stopping
the NBD server in between. An error will occur like this:
@@ -26,9 +26,13 @@
=== Partial final cluster ===
+qemu-img: TEST_DIR/t.IMGFMT: Failed to get "resize" lock
+Is another process using the image?
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
+Failed to find an available port: Address already in use
read 1024/1024 bytes at offset 0
Patch _make_test_img to stop the old qemu-nbd before starting a new one,
which fixes this problem, and similarly 215.
Signed-off-by: Fam Zheng <famz@redhat.com>
---
tests/qemu-iotests/common.rc | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index d054cb97fc..44bee16a5e 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -195,6 +195,16 @@ _use_sample_img()
fi
}
+_stop_nbd_server()
+{
+ if [ -f "${QEMU_TEST_DIR}/qemu-nbd.pid" ]; then
+ local QEMU_NBD_PID
+ read QEMU_NBD_PID < "${QEMU_TEST_DIR}/qemu-nbd.pid"
+ kill ${QEMU_NBD_PID}
+ rm -f "${QEMU_TEST_DIR}/qemu-nbd.pid"
+ fi
+}
+
_make_test_img()
{
# extra qemu-img options can be added by tests
@@ -234,6 +244,10 @@ _make_test_img()
extra_img_options="-o $optstr $extra_img_options"
fi
+ if [ $IMGPROTO = "nbd" ]; then
+ _stop_nbd_server
+ fi
+
# XXX(hch): have global image options?
(
if [ $use_backing = 1 ]; then
@@ -274,12 +288,7 @@ _cleanup_test_img()
case "$IMGPROTO" in
nbd)
- if [ -f "${QEMU_TEST_DIR}/qemu-nbd.pid" ]; then
- local QEMU_NBD_PID
- read QEMU_NBD_PID < "${QEMU_TEST_DIR}/qemu-nbd.pid"
- kill ${QEMU_NBD_PID}
- rm -f "${QEMU_TEST_DIR}/qemu-nbd.pid"
- fi
+ _stop_nbd_server
rm -f "$TEST_IMG_FILE"
;;
vxhs)
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v2] iotests: nbd: Stop qemu-nbd before remaking image
2018-07-11 6:40 [Qemu-devel] [PATCH v2] iotests: nbd: Stop qemu-nbd before remaking image Fam Zheng
@ 2018-07-11 10:23 ` Kevin Wolf
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2018-07-11 10:23 UTC (permalink / raw)
To: Fam Zheng; +Cc: qemu-devel, Max Reitz, qemu-block
Am 11.07.2018 um 08:40 hat Fam Zheng geschrieben:
> 197 is one example where _make_test_img is used twice without stopping
> the NBD server in between. An error will occur like this:
>
> @@ -26,9 +26,13 @@
>
> === Partial final cluster ===
>
> +qemu-img: TEST_DIR/t.IMGFMT: Failed to get "resize" lock
> +Is another process using the image?
> Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
> +Failed to find an available port: Address already in use
> read 1024/1024 bytes at offset 0
>
> Patch _make_test_img to stop the old qemu-nbd before starting a new one,
> which fixes this problem, and similarly 215.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-11 10:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 6:40 [Qemu-devel] [PATCH v2] iotests: nbd: Stop qemu-nbd before remaking image Fam Zheng
2018-07-11 10:23 ` Kevin Wolf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.