1Test 1
2{"execute": "block-dirty-bitmap-add", "arguments": {"disabled": false, "granularity": 16384, "name": "bitmap-0", "node": "drive0", "persistent": false}}
3{"return": {}}
4wrote 262144/262144 bytes at offset 0
5256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
6
7qemu-img info dump:
8
9image: TEST_IMG
10file format: IMGFMT
11virtual size: 1 MiB (1048576 bytes)
12cluster_size: 65536
13Format specific information:
14    compat: 1.1
15    lazy refcounts: false
16    refcount bits: 16
17    corrupt: false
18
19No bitmap in JSON format output
20
21Test 2
22{"execute": "block-dirty-bitmap-add", "arguments": {"disabled": true, "granularity": 32768, "name": "bitmap-1", "node": "drive0", "persistent": true}}
23{"return": {}}
24wrote 262144/262144 bytes at offset 262144
25256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
26
27qemu-img info dump:
28
29image: TEST_IMG
30file format: IMGFMT
31virtual size: 1 MiB (1048576 bytes)
32cluster_size: 65536
33Format specific information:
34    compat: 1.1
35    lazy refcounts: false
36    bitmaps:
37        [0]:
38            flags:
39            name: bitmap-1
40            granularity: 32768
41    refcount bits: 16
42    corrupt: false
43
44The same bitmaps in JSON format:
45[
46  {
47    "flags": [],
48    "granularity": 32768,
49    "name": "bitmap-1"
50  }
51]
52
53Test 3
54{"execute": "block-dirty-bitmap-add", "arguments": {"disabled": false, "granularity": 65536, "name": "bitmap-2", "node": "drive0", "persistent": true}}
55{"return": {}}
56wrote 262144/262144 bytes at offset 524288
57256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
58
59qemu-img info dump:
60
61image: TEST_IMG
62file format: IMGFMT
63virtual size: 1 MiB (1048576 bytes)
64cluster_size: 65536
65Format specific information:
66    compat: 1.1
67    lazy refcounts: false
68    bitmaps:
69        [0]:
70            flags:
71            name: bitmap-1
72            granularity: 32768
73        [1]:
74            flags:
75                [0]: auto
76            name: bitmap-2
77            granularity: 65536
78    refcount bits: 16
79    corrupt: false
80
81The same bitmaps in JSON format:
82[
83  {
84    "flags": [],
85    "granularity": 32768,
86    "name": "bitmap-1"
87  },
88  {
89    "flags": [
90      "auto"
91    ],
92    "granularity": 65536,
93    "name": "bitmap-2"
94  }
95]
96
97Test 4
98Checking "in-use" flag...
99qemu-img info dump:
100
101image: TEST_IMG
102file format: IMGFMT
103virtual size: 1 MiB (1048576 bytes)
104cluster_size: 65536
105Format specific information:
106    compat: 1.1
107    lazy refcounts: false
108    bitmaps:
109        [0]:
110            flags:
111                [0]: in-use
112            name: bitmap-1
113            granularity: 32768
114        [1]:
115            flags:
116                [0]: in-use
117                [1]: auto
118            name: bitmap-2
119            granularity: 65536
120    refcount bits: 16
121    corrupt: false
122
123The same bitmaps in JSON format:
124[
125  {
126    "flags": [
127      "in-use"
128    ],
129    "granularity": 32768,
130    "name": "bitmap-1"
131  },
132  {
133    "flags": [
134      "in-use",
135      "auto"
136    ],
137    "granularity": 65536,
138    "name": "bitmap-2"
139  }
140]
141
142Test 5
143{"execute": "block-dirty-bitmap-add", "arguments": {"disabled": false, "granularity": 16384, "name": "bitmap-0", "node": "drive0", "persistent": true}}
144{"return": {}}
145Write an unknown bitmap flag '0x4' into a new QCOW2 image at offset 327695
146qemu-img: Could not open 'TEST_IMG': Bitmap 'bitmap-0' doesn't satisfy the constraints
147
148Unset the unknown bitmap flag '0x4' in the bitmap directory entry:
149
150image: TEST_IMG
151file format: IMGFMT
152virtual size: 1 MiB (1048576 bytes)
153cluster_size: 65536
154Format specific information:
155    compat: 1.1
156    lazy refcounts: false
157    bitmaps:
158        [0]:
159            flags:
160                [0]: auto
161            name: bitmap-0
162            granularity: 16384
163    refcount bits: 16
164    corrupt: false
165
166Test complete
167