qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] iotests/291: Two fixes
@ 2020-10-27 16:44 Max Reitz
  2020-10-27 16:44 ` [PATCH 1/2] iotests/291: Filter irrelevant parts of img-info Max Reitz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Max Reitz @ 2020-10-27 16:44 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, qemu-devel, Max Reitz

Hi,

This series fixes two things about 291, one of which is actually a
problem right now (patch 1), and one of which is more or less of a style
question currently, but will become a problem with my FUSE export series
(patch 2).

(The issues were different enough that I decided to split the fixes into
two patches.)


Max Reitz (2):
  iotests/291: Filter irrelevant parts of img-info
  iotests/291: Stop NBD server

 tests/qemu-iotests/291     | 16 +++++++++++++---
 tests/qemu-iotests/291.out | 20 --------------------
 2 files changed, 13 insertions(+), 23 deletions(-)

-- 
2.26.2



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

* [PATCH 1/2] iotests/291: Filter irrelevant parts of img-info
  2020-10-27 16:44 [PATCH 0/2] iotests/291: Two fixes Max Reitz
@ 2020-10-27 16:44 ` Max Reitz
  2020-10-27 16:44 ` [PATCH 2/2] iotests/291: Stop NBD server Max Reitz
  2020-10-27 17:20 ` [PATCH 0/2] iotests/291: Two fixes Eric Blake
  2 siblings, 0 replies; 4+ messages in thread
From: Max Reitz @ 2020-10-27 16:44 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, qemu-devel, Max Reitz

We need to let _img_info emit the format-specific information so we get
the list of bitmaps we want, but we do not need anything but the
bitmaps.  So filter out everything that is irrelevant to us.  (Ideally,
this would be a generalized function in common.filters that takes a list
of things to keep, but that would require implementing an anti-bitmap
filter, which would be hard, and which we do not need here.  So that is
why this function is just a local hack.)

This lets 291 pass with qcow2 options like refcount_bits or data_file
again.

Fixes: 14f16bf9474c860ecc127a66a86961942319f7af
       ("qemu-img: Support bitmap --merge into backing image")
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/291     | 14 +++++++++++---
 tests/qemu-iotests/291.out | 20 --------------------
 2 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/tests/qemu-iotests/291 b/tests/qemu-iotests/291
index 4f837b2056..77fa38f93d 100755
--- a/tests/qemu-iotests/291
+++ b/tests/qemu-iotests/291
@@ -42,6 +42,14 @@ _require_command QEMU_NBD
 # compat=0.10 does not support bitmaps
 _unsupported_imgopts 'compat=0.10'
 
+# Filter irrelevant format-specific information from the qemu-img info
+# output (we only want the bitmaps, basically)
+_filter_irrelevant_img_info()
+{
+    grep -v -e 'compat' -e 'compression type' -e 'data file' -e 'extended l2' \
+            -e 'lazy refcounts' -e 'refcount bits'
+}
+
 echo
 echo "=== Initial image setup ==="
 echo
@@ -79,7 +87,7 @@ echo
 
 # Only bitmaps from the active layer are copied
 $QEMU_IMG convert --bitmaps -O qcow2 "$TEST_IMG.orig" "$TEST_IMG"
-_img_info --format-specific
+_img_info --format-specific | _filter_irrelevant_img_info
 # But we can also merge in bitmaps from other layers.  This test is a bit
 # contrived to cover more code paths, in reality, you could merge directly
 # into b0 without going through tmp
@@ -89,7 +97,7 @@ $QEMU_IMG bitmap --add --merge b0 -b "$TEST_IMG.base" -F $IMGFMT \
 $QEMU_IMG bitmap --merge tmp -f $IMGFMT "$TEST_IMG" b0
 $QEMU_IMG bitmap --remove --image-opts \
     driver=$IMGFMT,file.driver=file,file.filename="$TEST_IMG" tmp
-_img_info --format-specific
+_img_info --format-specific | _filter_irrelevant_img_info
 
 echo
 echo "=== Merge from top layer into backing image ==="
@@ -98,7 +106,7 @@ echo
 $QEMU_IMG rebase -u -F qcow2 -b "$TEST_IMG.base" "$TEST_IMG"
 $QEMU_IMG bitmap --add --merge b2 -b "$TEST_IMG" -F $IMGFMT \
      -f $IMGFMT "$TEST_IMG.base" b3
-_img_info --format-specific --backing-chain
+_img_info --format-specific --backing-chain | _filter_irrelevant_img_info
 
 echo
 echo "=== Check bitmap contents ==="
diff --git a/tests/qemu-iotests/291.out b/tests/qemu-iotests/291.out
index 3990f7aacc..23411c0ff4 100644
--- a/tests/qemu-iotests/291.out
+++ b/tests/qemu-iotests/291.out
@@ -26,9 +26,6 @@ file format: IMGFMT
 virtual size: 10 MiB (10485760 bytes)
 cluster_size: 65536
 Format specific information:
-    compat: 1.1
-    compression type: zlib
-    lazy refcounts: false
     bitmaps:
         [0]:
             flags:
@@ -39,17 +36,12 @@ Format specific information:
                 [0]: auto
             name: b2
             granularity: 65536
-    refcount bits: 16
     corrupt: false
-    extended l2: false
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 virtual size: 10 MiB (10485760 bytes)
 cluster_size: 65536
 Format specific information:
-    compat: 1.1
-    compression type: zlib
-    lazy refcounts: false
     bitmaps:
         [0]:
             flags:
@@ -64,9 +56,7 @@ Format specific information:
             flags:
             name: b0
             granularity: 65536
-    refcount bits: 16
     corrupt: false
-    extended l2: false
 
 === Merge from top layer into backing image ===
 
@@ -77,9 +67,6 @@ cluster_size: 65536
 backing file: TEST_DIR/t.IMGFMT.base
 backing file format: IMGFMT
 Format specific information:
-    compat: 1.1
-    compression type: zlib
-    lazy refcounts: false
     bitmaps:
         [0]:
             flags:
@@ -94,18 +81,13 @@ Format specific information:
             flags:
             name: b0
             granularity: 65536
-    refcount bits: 16
     corrupt: false
-    extended l2: false
 
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 virtual size: 10 MiB (10485760 bytes)
 cluster_size: 65536
 Format specific information:
-    compat: 1.1
-    compression type: zlib
-    lazy refcounts: false
     bitmaps:
         [0]:
             flags:
@@ -117,9 +99,7 @@ Format specific information:
                 [0]: auto
             name: b3
             granularity: 65536
-    refcount bits: 16
     corrupt: false
-    extended l2: false
 
 === Check bitmap contents ===
 
-- 
2.26.2



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

* [PATCH 2/2] iotests/291: Stop NBD server
  2020-10-27 16:44 [PATCH 0/2] iotests/291: Two fixes Max Reitz
  2020-10-27 16:44 ` [PATCH 1/2] iotests/291: Filter irrelevant parts of img-info Max Reitz
@ 2020-10-27 16:44 ` Max Reitz
  2020-10-27 17:20 ` [PATCH 0/2] iotests/291: Two fixes Eric Blake
  2 siblings, 0 replies; 4+ messages in thread
From: Max Reitz @ 2020-10-27 16:44 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, qemu-devel, Max Reitz

nbd_server_start_unix_socket() includes an implicit nbd_server_stop(),
but we still need an explicit one at the end of the test (where there
follows no next nbd_server_start_unix_socket()), or qemu-nbd will linger
until the test exits.

This will become important when enabling this test to run on FUSE
exports, because then the export (which is the image used by qemu-nbd)
will go away before qemu-nbd exits, which will lead to qemu-nbd
complaining that it cannot flush the bitmaps in the image.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/291 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qemu-iotests/291 b/tests/qemu-iotests/291
index 77fa38f93d..b7320bc7ad 100755
--- a/tests/qemu-iotests/291
+++ b/tests/qemu-iotests/291
@@ -128,6 +128,8 @@ nbd_server_start_unix_socket -r -f qcow2 -B b3 "$TEST_IMG"
 $QEMU_IMG map --output=json --image-opts \
     "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b3" | _filter_qemu_img_map
 
+nbd_server_stop
+
 # success, all done
 echo '*** done'
 rm -f $seq.full
-- 
2.26.2



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

* Re: [PATCH 0/2] iotests/291: Two fixes
  2020-10-27 16:44 [PATCH 0/2] iotests/291: Two fixes Max Reitz
  2020-10-27 16:44 ` [PATCH 1/2] iotests/291: Filter irrelevant parts of img-info Max Reitz
  2020-10-27 16:44 ` [PATCH 2/2] iotests/291: Stop NBD server Max Reitz
@ 2020-10-27 17:20 ` Eric Blake
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2020-10-27 17:20 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On 10/27/20 11:44 AM, Max Reitz wrote:
> Hi,
> 
> This series fixes two things about 291, one of which is actually a
> problem right now (patch 1), and one of which is more or less of a style
> question currently, but will become a problem with my FUSE export series
> (patch 2).
> 
> (The issues were different enough that I decided to split the fixes into
> two patches.)
> 
> 
> Max Reitz (2):
>   iotests/291: Filter irrelevant parts of img-info
>   iotests/291: Stop NBD server

Series:
Reviewed-by: Eric Blake <eblake@redhat.com>

I'm happy to include this on my NBD pull request for soft freeze.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



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

end of thread, other threads:[~2020-10-27 17:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-27 16:44 [PATCH 0/2] iotests/291: Two fixes Max Reitz
2020-10-27 16:44 ` [PATCH 1/2] iotests/291: Filter irrelevant parts of img-info Max Reitz
2020-10-27 16:44 ` [PATCH 2/2] iotests/291: Stop NBD server Max Reitz
2020-10-27 17:20 ` [PATCH 0/2] iotests/291: Two fixes Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).