All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-6.1?] iotest: Further enhance qemu-img-bitmaps
@ 2021-07-21 20:46 Eric Blake
  2021-07-21 21:53 ` Nir Soffer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Blake @ 2021-07-21 20:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, nsoffer, vsementsov, qemu-block, Max Reitz

Add a regression test to make sure we detect attempts to use 'qemu-img
bitmap' to modify an in-use local file.

Suggested-by: Nir Soffer <nsoffer@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---

Sadly, this missed my bitmaps pull request today.  If there's any
reason to respin that pull request, I'm inclined to add this in, as it
just touches the iotests; otherwise, if it slips to 6.2 it's not too
bad.

 tests/qemu-iotests/tests/qemu-img-bitmaps     | 6 ++++++
 tests/qemu-iotests/tests/qemu-img-bitmaps.out | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/tests/qemu-iotests/tests/qemu-img-bitmaps b/tests/qemu-iotests/tests/qemu-img-bitmaps
index 7a3fe8c3d37a..3b6fade11735 100755
--- a/tests/qemu-iotests/tests/qemu-img-bitmaps
+++ b/tests/qemu-iotests/tests/qemu-img-bitmaps
@@ -129,6 +129,12 @@ $QEMU_IMG map --output=json --image-opts \
 $QEMU_IMG map --output=json --image-opts \
     "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b3" | _filter_qemu_img_map

+echo
+echo "=== bitmap command fails to modify image already in use ==="
+echo
+
+$QEMU_IMG bitmap --add "$TEST_IMG" b4 2>&1 | _filter_testdir
+
 nbd_server_stop

 echo
diff --git a/tests/qemu-iotests/tests/qemu-img-bitmaps.out b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
index e851f0320ecb..c6e12dd700aa 100644
--- a/tests/qemu-iotests/tests/qemu-img-bitmaps.out
+++ b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
@@ -116,6 +116,11 @@ Format specific information:
 { "start": 2097152, "length": 1048576, "depth": 0, "present": false, "zero": false, "data": false},
 { "start": 3145728, "length": 7340032, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET}]

+=== bitmap command fails to modify image already in use ===
+
+qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock
+Is another process using the image [TEST_DIR/t.qcow2]?
+
 === Check handling of inconsistent bitmap ===

 image: TEST_DIR/t.IMGFMT
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH for-6.1?] iotest: Further enhance qemu-img-bitmaps
  2021-07-21 20:46 [PATCH for-6.1?] iotest: Further enhance qemu-img-bitmaps Eric Blake
@ 2021-07-21 21:53 ` Nir Soffer
  2021-07-22 12:22 ` Vladimir Sementsov-Ogievskiy
  2021-12-23  9:24 ` Hanna Reitz
  2 siblings, 0 replies; 4+ messages in thread
From: Nir Soffer @ 2021-07-21 21:53 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: kwolf, vsementsov, qemu-block, Max Reitz

On 7/21/21 11:46 PM, Eric Blake wrote:
> Add a regression test to make sure we detect attempts to use 'qemu-img
> bitmap' to modify an in-use local file.
> 
> Suggested-by: Nir Soffer <nsoffer@redhat.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> 
> Sadly, this missed my bitmaps pull request today.  If there's any
> reason to respin that pull request, I'm inclined to add this in, as it
> just touches the iotests; otherwise, if it slips to 6.2 it's not too
> bad.
> 
>   tests/qemu-iotests/tests/qemu-img-bitmaps     | 6 ++++++
>   tests/qemu-iotests/tests/qemu-img-bitmaps.out | 5 +++++
>   2 files changed, 11 insertions(+)
> 
> diff --git a/tests/qemu-iotests/tests/qemu-img-bitmaps b/tests/qemu-iotests/tests/qemu-img-bitmaps
> index 7a3fe8c3d37a..3b6fade11735 100755
> --- a/tests/qemu-iotests/tests/qemu-img-bitmaps
> +++ b/tests/qemu-iotests/tests/qemu-img-bitmaps
> @@ -129,6 +129,12 @@ $QEMU_IMG map --output=json --image-opts \
>   $QEMU_IMG map --output=json --image-opts \
>       "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b3" | _filter_qemu_img_map
> 
> +echo
> +echo "=== bitmap command fails to modify image already in use ==="
> +echo
> +
> +$QEMU_IMG bitmap --add "$TEST_IMG" b4 2>&1 | _filter_testdir
> +
>   nbd_server_stop
> 
>   echo
> diff --git a/tests/qemu-iotests/tests/qemu-img-bitmaps.out b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
> index e851f0320ecb..c6e12dd700aa 100644
> --- a/tests/qemu-iotests/tests/qemu-img-bitmaps.out
> +++ b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
> @@ -116,6 +116,11 @@ Format specific information:
>   { "start": 2097152, "length": 1048576, "depth": 0, "present": false, "zero": false, "data": false},
>   { "start": 3145728, "length": 7340032, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET}]
> 
> +=== bitmap command fails to modify image already in use ===
> +
> +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock
> +Is another process using the image [TEST_DIR/t.qcow2]?
> +
>   === Check handling of inconsistent bitmap ===
> 
>   image: TEST_DIR/t.IMGFMT
> 

It would be nice to test more than --add. I guess the implementation
is shared but if someone change it the test will protect us.

Reviewed-by: Nir Soffer <nsoffer@redhat.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for-6.1?] iotest: Further enhance qemu-img-bitmaps
  2021-07-21 20:46 [PATCH for-6.1?] iotest: Further enhance qemu-img-bitmaps Eric Blake
  2021-07-21 21:53 ` Nir Soffer
@ 2021-07-22 12:22 ` Vladimir Sementsov-Ogievskiy
  2021-12-23  9:24 ` Hanna Reitz
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2021-07-22 12:22 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: qemu-block, kwolf, nsoffer, Max Reitz

21.07.2021 23:46, Eric Blake wrote:
> Add a regression test to make sure we detect attempts to use 'qemu-img
> bitmap' to modify an in-use local file.
> 
> Suggested-by: Nir Soffer <nsoffer@redhat.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> 
> Sadly, this missed my bitmaps pull request today.  If there's any
> reason to respin that pull request, I'm inclined to add this in, as it
> just touches the iotests; otherwise, if it slips to 6.2 it's not too
> bad.
> 
>   tests/qemu-iotests/tests/qemu-img-bitmaps     | 6 ++++++
>   tests/qemu-iotests/tests/qemu-img-bitmaps.out | 5 +++++
>   2 files changed, 11 insertions(+)
> 
> diff --git a/tests/qemu-iotests/tests/qemu-img-bitmaps b/tests/qemu-iotests/tests/qemu-img-bitmaps
> index 7a3fe8c3d37a..3b6fade11735 100755
> --- a/tests/qemu-iotests/tests/qemu-img-bitmaps
> +++ b/tests/qemu-iotests/tests/qemu-img-bitmaps
> @@ -129,6 +129,12 @@ $QEMU_IMG map --output=json --image-opts \
>   $QEMU_IMG map --output=json --image-opts \
>       "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b3" | _filter_qemu_img_map
> 
> +echo
> +echo "=== bitmap command fails to modify image already in use ==="
> +echo
> +
> +$QEMU_IMG bitmap --add "$TEST_IMG" b4 2>&1 | _filter_testdir
> +
>   nbd_server_stop
> 
>   echo
> diff --git a/tests/qemu-iotests/tests/qemu-img-bitmaps.out b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
> index e851f0320ecb..c6e12dd700aa 100644
> --- a/tests/qemu-iotests/tests/qemu-img-bitmaps.out
> +++ b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
> @@ -116,6 +116,11 @@ Format specific information:
>   { "start": 2097152, "length": 1048576, "depth": 0, "present": false, "zero": false, "data": false},
>   { "start": 3145728, "length": 7340032, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET}]
> 
> +=== bitmap command fails to modify image already in use ===
> +
> +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock
> +Is another process using the image [TEST_DIR/t.qcow2]?
> +
>   === Check handling of inconsistent bitmap ===
> 
>   image: TEST_DIR/t.IMGFMT
> 


I'm not against, but why you decided to add such a test? Lock should work for any operation, what's the reason to check bitmaps separately? Or it was broken recently?

anyway:
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

-- 
Best regards,
Vladimir


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for-6.1?] iotest: Further enhance qemu-img-bitmaps
  2021-07-21 20:46 [PATCH for-6.1?] iotest: Further enhance qemu-img-bitmaps Eric Blake
  2021-07-21 21:53 ` Nir Soffer
  2021-07-22 12:22 ` Vladimir Sementsov-Ogievskiy
@ 2021-12-23  9:24 ` Hanna Reitz
  2 siblings, 0 replies; 4+ messages in thread
From: Hanna Reitz @ 2021-12-23  9:24 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: kwolf, nsoffer, vsementsov, qemu-block

On 21.07.21 22:46, Eric Blake wrote:
> Add a regression test to make sure we detect attempts to use 'qemu-img
> bitmap' to modify an in-use local file.
>
> Suggested-by: Nir Soffer <nsoffer@redhat.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>
> Sadly, this missed my bitmaps pull request today.  If there's any
> reason to respin that pull request, I'm inclined to add this in, as it
> just touches the iotests; otherwise, if it slips to 6.2 it's not too
> bad.

(Going through my patches folder...)

Not sure if you’re still interested in this, but if so, we should skip 
this test case if OFD locks are not available (like 153 does).

Hanna



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-23  9:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 20:46 [PATCH for-6.1?] iotest: Further enhance qemu-img-bitmaps Eric Blake
2021-07-21 21:53 ` Nir Soffer
2021-07-22 12:22 ` Vladimir Sementsov-Ogievskiy
2021-12-23  9:24 ` Hanna Reitz

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.