qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] bf654b: iotests: add test for QCOW2 header du


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] bf654b: iotests: add test for QCOW2 header dump
Date: Sat, 22 Aug 2020 14:00:23 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: bf654b37e19eb43abca5b5b2a6eac21732b368ca
      
https://github.com/qemu/qemu/commit/bf654b37e19eb43abca5b5b2a6eac21732b368ca
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    A tests/qemu-iotests/303
    A tests/qemu-iotests/303.out
    M tests/qemu-iotests/group

  Log Message:
  -----------
  iotests: add test for QCOW2 header dump

The simple script creates a QCOW2 image and fills it with some data.
Two bitmaps are created as well. Then the script reads the image header
with extensions from the disk by running the script qcow2.py and dumps
the information to the output. Other entities, such as snapshots, may
be added to the test later.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-2-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 4539b3645bd5090873e2b01ea2d26899ac4c8682
      
https://github.com/qemu/qemu/commit/4539b3645bd5090873e2b01ea2d26899ac4c8682
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/qcow2_format.py

  Log Message:
  -----------
  qcow2_format.py: make printable data an extension class member

Let us differ binary data type from string one for the extension data
variable and keep the string as the QcowHeaderExtension class member.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-3-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 991a02ca7f886fb7935d8d64e50ffe72af281e7c
      
https://github.com/qemu/qemu/commit/991a02ca7f886fb7935d8d64e50ffe72af281e7c
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/qcow2_format.py

  Log Message:
  -----------
  qcow2_format.py: change Qcow2BitmapExt initialization method

There are two ways to initialize a class derived from Qcow2Struct:
1. Pass a block of binary data to the constructor.
2. Pass the file descriptor to allow reading the file from constructor.
Let's change the Qcow2BitmapExt initialization method from 1 to 2 to
support a scattered reading in the initialization chain.
The implementation comes with the patch that follows.

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-4-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 82cb8223248df5276467618638d1262d0b311c33
      
https://github.com/qemu/qemu/commit/82cb8223248df5276467618638d1262d0b311c33
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/qcow2_format.py

  Log Message:
  -----------
  qcow2_format.py: dump bitmap flags in human readable way.

Introduce the class BitmapFlags that parses a bitmap flags mask.

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-5-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 1117393195ece1a47b9735b40e06e915717df1cf
      
https://github.com/qemu/qemu/commit/1117393195ece1a47b9735b40e06e915717df1cf
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/303.out
    M tests/qemu-iotests/qcow2_format.py

  Log Message:
  -----------
  qcow2_format.py: Dump bitmap directory information

Read and dump entries from the bitmap directory of QCOW2 image.

Header extension:
magic                     0x23852875 (Bitmaps)
...
Bitmap name               bitmap-1
bitmap_table_offset       0xf0000
bitmap_table_size         1
flags                     0x2 (['auto'])
type                      1
granularity_bits          16
name_size                 8
extra_data_size           0

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-6-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: e3f5aad7be0733357875dd45af6e5c59195e590a
      
https://github.com/qemu/qemu/commit/e3f5aad7be0733357875dd45af6e5c59195e590a
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/qcow2_format.py

  Log Message:
  -----------
  qcow2_format.py: pass cluster size to substructures

The cluster size of an image is the QcowHeader class member and may be
obtained by dependent extension structures such as Qcow2BitmapExt for
further bitmap table details print.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-7-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 9427784124828e49bc95cfbcc13eb317dfc32773
      
https://github.com/qemu/qemu/commit/9427784124828e49bc95cfbcc13eb317dfc32773
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/303.out
    M tests/qemu-iotests/qcow2_format.py

  Log Message:
  -----------
  qcow2_format.py: Dump bitmap table serialized entries

Add bitmap table information to the QCOW2 metadata dump.

Bitmap name               bitmap-1
...
Bitmap table   type            size         offset
0              serialized      65536        10092544
1              all-zeroes      0            0
2              all-zeroes      0            0

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-8-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 2c6d9ca48c7133ceba45577e8ca567a524aeb3f0
      
https://github.com/qemu/qemu/commit/2c6d9ca48c7133ceba45577e8ca567a524aeb3f0
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/qcow2.py
    M tests/qemu-iotests/qcow2_format.py

  Log Message:
  -----------
  qcow2.py: Introduce '-j' key to dump in JSON format

Add the command key to the qcow2.py arguments list to dump QCOW2
metadata in JSON format. Here is the suggested way to do that. The
implementation of the dump in JSON format is in the patch that follows.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1596742557-320265-9-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: b4e927799cf4a75e4432ab9e94d8f74e906a149b
      
https://github.com/qemu/qemu/commit/b4e927799cf4a75e4432ab9e94d8f74e906a149b
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/qcow2_format.py

  Log Message:
  -----------
  qcow2_format.py: collect fields to dump in JSON format

As __dict__ is being extended with class members we do not want to
print, add the to_json() method to classes that returns a json-dumpable
object with desired fields and their values. Extend it in subclass when
necessary to print the final dictionary in the JSON output which
follows.

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Message-Id: 
<1596742557-320265-10-git-send-email-andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 4edcca57412d2b54537b4fc2b10ebfa1b920192c
      
https://github.com/qemu/qemu/commit/4edcca57412d2b54537b4fc2b10ebfa1b920192c
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/qcow2_format.py

  Log Message:
  -----------
  qcow2_format.py: support dumping metadata in JSON format

Implementation of dumping QCOW2 image metadata.
The sample output:
{
    "Header_extensions": [
        {
            "name": "Feature table",
            "magic": 1745090647,
            "length": 192,
            "data_str": "<binary>"
        },
        {
            "name": "Bitmaps",
            "magic": 595929205,
            "length": 24,
            "data": {
                "nb_bitmaps": 2,
                "reserved32": 0,
                "bitmap_directory_size": 64,
                "bitmap_directory_offset": 1048576,
                "bitmap_directory": [
                    {
                        "name": "bitmap-1",
                        "bitmap_table_offset": 589824,
                        "bitmap_table_size": 1,
                        "flags": 2,
                        "type": 1,
                        "granularity_bits": 15,
                        "name_size": 8,
                        "extra_data_size": 0,
                        "bitmap_table": [
                            {
                                "type": "serialized",
                                "offset": 655360
                            },
                            ...

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: 
<1596742557-320265-11-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 76bbbb2d8bcd635f787ddf448bad9c68f3299dee
      
https://github.com/qemu/qemu/commit/76bbbb2d8bcd635f787ddf448bad9c68f3299dee
  Author: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/303
    M tests/qemu-iotests/303.out

  Log Message:
  -----------
  iotests: dump QCOW2 header in JSON in #303

Extend the test case #303 by dumping QCOW2 image metadata in JSON
format.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: 
<1596742557-320265-12-git-send-email-andrey.shinkevich@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 31e4c354b38cd42a051ad030eb7779d5e7ee32fe
      
https://github.com/qemu/qemu/commit/31e4c354b38cd42a051ad030eb7779d5e7ee32fe
  Author: Max Reitz <mreitz@redhat.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M migration/block-dirty-bitmap.c
    M migration/migration.c
    M migration/migration.h
    M monitor/hmp-cmds.c
    M qapi/migration.json

  Log Message:
  -----------
  migration: Add block-bitmap-mapping parameter

This migration parameter allows mapping block node names and bitmap
names to aliases for the purpose of block dirty bitmap migration.

This way, management tools can use different node and bitmap names on
the source and destination and pass the mapping of how bitmaps are to be
transferred to qemu (on the source, the destination, or even both with
arbitrary aliases in the migration stream).

While touching this code, fix a bug where bitmap names longer than 255
bytes would fail an assertion in qemu_put_counted_string().

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200820150725.68687-2-mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 4bf63c80357031be4eb8fff8a751f40e73ef1c10
      
https://github.com/qemu/qemu/commit/4bf63c80357031be4eb8fff8a751f40e73ef1c10
  Author: Max Reitz <mreitz@redhat.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  iotests.py: Let wait_migration() return on failure

Let wait_migration() return on failure (with the return value indicating
whether the migration was completed or has failed), so we can use it for
migrations that are expected to fail, too.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200820150725.68687-3-mreitz@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: cb5c6cd2dc984812f560fbe41f57a6bfc34d8708
      
https://github.com/qemu/qemu/commit/cb5c6cd2dc984812f560fbe41f57a6bfc34d8708
  Author: Max Reitz <mreitz@redhat.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    A tests/qemu-iotests/300
    A tests/qemu-iotests/300.out
    M tests/qemu-iotests/group

  Log Message:
  -----------
  iotests: Test node/bitmap aliases during migration

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200820150725.68687-4-mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Eric Blake <eblake@redhat.com>
[eblake: fold in python cleanups recommended by Vladimir]
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 66e01f1cdc9663660201cced4df8ec0a28937919
      
https://github.com/qemu/qemu/commit/66e01f1cdc9663660201cced4df8ec0a28937919
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-08-22 (Sat, 22 Aug 2020)

  Changed paths:
    M migration/block-dirty-bitmap.c
    M migration/migration.c
    M migration/migration.h
    M monitor/hmp-cmds.c
    M qapi/migration.json
    A tests/qemu-iotests/300
    A tests/qemu-iotests/300.out
    A tests/qemu-iotests/303
    A tests/qemu-iotests/303.out
    M tests/qemu-iotests/group
    M tests/qemu-iotests/iotests.py
    M tests/qemu-iotests/qcow2.py
    M tests/qemu-iotests/qcow2_format.py

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-21' 
into staging

bitmaps patches for 2020-08-21

- Andrey Shinkevich: Enhance qcow2.py for iotest inspection of qcow2 images
- Max Reitz: Add block-bitmap-mapping migration parameter

# gpg: Signature made Fri 21 Aug 2020 15:05:07 BST
# gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) 
<ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-bitmaps-2020-08-21:
  iotests: Test node/bitmap aliases during migration
  iotests.py: Let wait_migration() return on failure
  migration: Add block-bitmap-mapping parameter
  iotests: dump QCOW2 header in JSON in #303
  qcow2_format.py: support dumping metadata in JSON format
  qcow2_format.py: collect fields to dump in JSON format
  qcow2.py: Introduce '-j' key to dump in JSON format
  qcow2_format.py: Dump bitmap table serialized entries
  qcow2_format.py: pass cluster size to substructures
  qcow2_format.py: Dump bitmap directory information
  qcow2_format.py: dump bitmap flags in human readable way.
  qcow2_format.py: change Qcow2BitmapExt initialization method
  qcow2_format.py: make printable data an extension class member
  iotests: add test for QCOW2 header dump

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/ca489cd037e4...66e01f1cdc96



reply via email to

[Prev in Thread] Current Thread [Next in Thread]