All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, vsementsov@virtuozzo.com,
	qemu-devel@nongnu.org, mreitz@redhat.com,
	andrey.shinkevich@virtuozzo.com, den@openvz.org
Subject: [PATCH v3 1/6] iotests: Add extension names to qcow2.py dump
Date: Mon,  1 Jun 2020 16:48:08 +0300	[thread overview]
Message-ID: <1591019293-211155-2-git-send-email-andrey.shinkevich@virtuozzo.com> (raw)
In-Reply-To: <1591019293-211155-1-git-send-email-andrey.shinkevich@virtuozzo.com>

Header extension:         Feature table
magic                     0x6803f857
length                    192
data                      <binary>

The change incurs modification of the output in 031, 036 and 061 test
cases.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
---
 tests/qemu-iotests/031.out  | 22 +++++++++++-----------
 tests/qemu-iotests/036.out  |  4 ++--
 tests/qemu-iotests/061.out  | 18 +++++++++---------
 tests/qemu-iotests/qcow2.py | 23 ++++++++++++++++++++---
 4 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/tests/qemu-iotests/031.out b/tests/qemu-iotests/031.out
index 5a4beda..966c8d9 100644
--- a/tests/qemu-iotests/031.out
+++ b/tests/qemu-iotests/031.out
@@ -24,7 +24,7 @@ autoclear_features        []
 refcount_order            4
 header_length             72
 
-Header extension:
+Header extension:         Unknown
 magic                     0x12345678
 length                    31
 data                      'This is a test header extension'
@@ -52,7 +52,7 @@ autoclear_features        []
 refcount_order            4
 header_length             72
 
-Header extension:
+Header extension:         Unknown
 magic                     0x12345678
 length                    31
 data                      'This is a test header extension'
@@ -80,12 +80,12 @@ autoclear_features        []
 refcount_order            4
 header_length             72
 
-Header extension:
+Header extension:         Backing format
 magic                     0xe2792aca
 length                    11
 data                      'host_device'
 
-Header extension:
+Header extension:         Unknown
 magic                     0x12345678
 length                    31
 data                      'This is a test header extension'
@@ -115,12 +115,12 @@ autoclear_features        []
 refcount_order            4
 header_length             112
 
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
 
-Header extension:
+Header extension:         Unknown
 magic                     0x12345678
 length                    31
 data                      'This is a test header extension'
@@ -148,12 +148,12 @@ autoclear_features        []
 refcount_order            4
 header_length             112
 
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
 
-Header extension:
+Header extension:         Unknown
 magic                     0x12345678
 length                    31
 data                      'This is a test header extension'
@@ -181,17 +181,17 @@ autoclear_features        []
 refcount_order            4
 header_length             112
 
-Header extension:
+Header extension:         Backing format
 magic                     0xe2792aca
 length                    11
 data                      'host_device'
 
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
 
-Header extension:
+Header extension:         Unknown
 magic                     0x12345678
 length                    31
 data                      'This is a test header extension'
diff --git a/tests/qemu-iotests/036.out b/tests/qemu-iotests/036.out
index e409acf..81a7366 100644
--- a/tests/qemu-iotests/036.out
+++ b/tests/qemu-iotests/036.out
@@ -24,7 +24,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 incompatible_features     []
 compatible_features       []
 autoclear_features        [63]
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
@@ -36,7 +36,7 @@ No errors were found on the image.
 incompatible_features     []
 compatible_features       []
 autoclear_features        []
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out
index a51ad1b..7821b7f 100644
--- a/tests/qemu-iotests/061.out
+++ b/tests/qemu-iotests/061.out
@@ -24,7 +24,7 @@ autoclear_features        []
 refcount_order            4
 header_length             112
 
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
@@ -82,7 +82,7 @@ autoclear_features        []
 refcount_order            4
 header_length             112
 
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
@@ -138,7 +138,7 @@ autoclear_features        []
 refcount_order            4
 header_length             112
 
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
@@ -193,7 +193,7 @@ autoclear_features        [42]
 refcount_order            4
 header_length             112
 
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
@@ -262,7 +262,7 @@ autoclear_features        []
 refcount_order            4
 header_length             112
 
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
@@ -324,7 +324,7 @@ autoclear_features        []
 refcount_order            4
 header_length             112
 
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
@@ -353,7 +353,7 @@ autoclear_features        []
 refcount_order            4
 header_length             112
 
-Header extension:
+Header extension:         Feature table
 magic                     0x6803f857
 length                    336
 data                      <binary>
@@ -491,7 +491,7 @@ wrote 65536/65536 bytes at offset 2147483648
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 65536/65536 bytes at offset 3221225472
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-    (0.00/100%)
    (12.50/100%)
    (25.00/100%)
    (37.50/100%)
    (50.00/100%)
    (62.50/100%)
    (75.00/100%)
    (87.50/100%)
    (100.00/100%)
    (100.00/100%)
+    (0.00/100%)    (12.50/100%)    (25.00/100%)    (37.50/100%)    (50.00/100%)    (62.50/100%)    (75.00/100%)    (87.50/100%)    (100.00/100%)    (100.00/100%)
 No errors were found on the image.
 
 === Testing progress report with snapshot ===
@@ -506,7 +506,7 @@ wrote 65536/65536 bytes at offset 2147483648
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 65536/65536 bytes at offset 3221225472
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-    (0.00/100%)
    (6.25/100%)
    (12.50/100%)
    (18.75/100%)
    (25.00/100%)
    (31.25/100%)
    (37.50/100%)
    (43.75/100%)
    (50.00/100%)
    (56.25/100%)
    (62.50/100%)
    (68.75/100%)
    (75.00/100%)
    (81.25/100%)
    (87.50/100%)
    (93.75/100%)
    (100.00/100%)
    (100.00/100%)
+    (0.00/100%)    (6.25/100%)    (12.50/100%)    (18.75/100%)    (25.00/100%)    (31.25/100%)    (37.50/100%)    (43.75/100%)    (50.00/100%)    (56.25/100%)    (62.50/100%)    (68.75/100%)    (75.00/100%)    (81.25/100%)    (87.50/100%)    (93.75/100%)    (100.00/100%)    (100.00/100%)
 No errors were found on the image.
 
 === Testing version downgrade with external data file ===
diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
index 94a07b2..e824b09 100755
--- a/tests/qemu-iotests/qcow2.py
+++ b/tests/qemu-iotests/qcow2.py
@@ -6,19 +6,36 @@ import string
 
 class QcowHeaderExtension:
 
+    QCOW2_EXT_MAGIC_BACKING_FORMAT = 0xE2792ACA
+    QCOW2_EXT_MAGIC_FEATURE_TABLE = 0x6803f857
+    QCOW2_EXT_MAGIC_CRYPTO_HEADER = 0x0537be77
+    QCOW2_EXT_MAGIC_BITMAPS = 0x23852875
+    QCOW2_EXT_MAGIC_DATA_FILE = 0x44415441
+
     def __init__(self, magic, length, data):
         if length % 8 != 0:
             padding = 8 - (length % 8)
             data += b"\0" * padding
 
-        self.magic  = magic
+        self.magic = magic
         self.length = length
-        self.data   = data
+        self.data = data
+        self.name = self.extension_name(magic)
 
     @classmethod
     def create(cls, magic, data):
         return QcowHeaderExtension(magic, len(data), data)
 
+    def extension_name(self, magic):
+        return {
+            self.QCOW2_EXT_MAGIC_BACKING_FORMAT: 'Backing format',
+            self.QCOW2_EXT_MAGIC_FEATURE_TABLE: 'Feature table',
+            self.QCOW2_EXT_MAGIC_CRYPTO_HEADER: 'Crypto header',
+            self.QCOW2_EXT_MAGIC_BITMAPS: 'Bitmaps',
+            self.QCOW2_EXT_MAGIC_DATA_FILE: 'Data file',
+        }.get(magic, 'Unknown')
+
+
 class QcowHeader:
 
     uint32_t = 'I'
@@ -151,7 +168,7 @@ class QcowHeader:
             else:
                 data = "<binary>"
 
-            print("Header extension:")
+            print("%-25s %s" % ("Header extension:", ex.name))
             print("%-25s %#x" % ("magic", ex.magic))
             print("%-25s %d" % ("length", ex.length))
             print("%-25s %s" % ("data", data))
-- 
1.8.3.1



  reply	other threads:[~2020-06-01 13:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 13:48 [PATCH v3 0/6] iotests: Dump QCOW2 dirty bitmaps metadata Andrey Shinkevich
2020-06-01 13:48 ` Andrey Shinkevich [this message]
2020-06-02 16:05   ` [PATCH v3 1/6] iotests: Add extension names to qcow2.py dump Eric Blake
2020-06-02 16:07     ` Eric Blake
2020-06-02 19:25   ` Vladimir Sementsov-Ogievskiy
2020-06-01 13:48 ` [PATCH v3 2/6] iotests: move check for printable data to QcowHeaderExtension class Andrey Shinkevich
2020-06-02 16:14   ` Eric Blake
2020-06-02 19:32   ` Vladimir Sementsov-Ogievskiy
2020-06-01 13:48 ` [PATCH v3 3/6] iotests: dump bitmap extension data with qcow2.py Andrey Shinkevich
2020-06-02 16:16   ` Eric Blake
2020-06-02 20:10   ` Vladimir Sementsov-Ogievskiy
2020-06-01 13:48 ` [PATCH v3 4/6] iotests: Dump bitmap directory info " Andrey Shinkevich
2020-06-02 17:35   ` Eric Blake
2020-06-02 21:15   ` Vladimir Sementsov-Ogievskiy
2020-06-01 13:48 ` [PATCH v3 5/6] iotests: Dump bitmap table entries serialized in QCOW2 image Andrey Shinkevich
2020-06-02 17:38   ` Eric Blake
2020-06-02 21:26   ` Vladimir Sementsov-Ogievskiy
2020-06-01 13:48 ` [PATCH v3 6/6] iotests: Dump QCOW2 image metadata in JSON format with qcow2.py Andrey Shinkevich
2020-06-02 17:40   ` Eric Blake
2020-06-02 21:36   ` Vladimir Sementsov-Ogievskiy
2020-06-01 21:46 ` [PATCH v3 0/6] iotests: Dump QCOW2 dirty bitmaps metadata Eric Blake
2020-06-04  7:54   ` Andrey Shinkevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1591019293-211155-2-git-send-email-andrey.shinkevich@virtuozzo.com \
    --to=andrey.shinkevich@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.