1 | The following changes since commit 23919ddfd56135cad3cb468a8f54d5a595f024f4: | 1 | The following changes since commit d5c75ec500d96f1d93447f990cd5a4ef5ba27fae: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190827' into staging (2019-08-27 15:52:36 +0100) | 3 | Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2020-05-08-1' into staging (2020-05-12 17:00:10 +0100) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://github.com/XanClic/qemu.git tags/pull-block-2019-08-27 | 7 | https://github.com/XanClic/qemu.git tags/pull-block-2020-05-13 |
8 | 8 | ||
9 | for you to fetch changes up to bb043c056cffcc2f3ce88bfdaf2e76e455c09e2c: | 9 | for you to fetch changes up to fc9aefc8c0d3c6392656ea661ce72c1583b70bbd: |
10 | 10 | ||
11 | iotests: Unify cache mode quoting (2019-08-27 19:48:44 +0200) | 11 | block/block-copy: fix use-after-free of task pointer (2020-05-13 14:20:31 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block patches: | 14 | Block patches: |
15 | - qemu-io now accepts a file to read a write pattern from | 15 | - zstd compression for qcow2 |
16 | - Ensure that raw files have their first block allocated so we can probe | 16 | - Fix use-after-free |
17 | the O_DIRECT alignment if necessary | ||
18 | - Various fixes | ||
19 | 17 | ||
20 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
21 | Denis Plotnikov (1): | 19 | Denis Plotnikov (4): |
22 | qemu-io: add pattern file for write command | 20 | qcow2: introduce compression type feature |
23 | 21 | qcow2: rework the cluster compression routine | |
24 | Max Reitz (7): | 22 | qcow2: add zstd cluster compression |
25 | iotests: Fix _filter_img_create() | 23 | iotests: 287: add qcow2 compression type test |
26 | vmdk: Use bdrv_dirname() for relative extent paths | ||
27 | iotests: Keep testing broken relative extent paths | ||
28 | vmdk: Reject invalid compressed writes | ||
29 | iotests: Disable broken streamOptimized tests | ||
30 | iotests: Disable 110 for vmdk.twoGbMaxExtentSparse | ||
31 | iotests: Disable 126 for flat vmdk subformats | ||
32 | |||
33 | Nir Soffer (3): | ||
34 | block: posix: Always allocate the first block | ||
35 | iotests: Test allocate_first_block() with O_DIRECT | ||
36 | iotests: Unify cache mode quoting | ||
37 | |||
38 | Stefan Hajnoczi (1): | ||
39 | file-posix: fix request_alignment typo | ||
40 | |||
41 | Thomas Huth (2): | ||
42 | iotests: Check for enabled drivers before testing them | ||
43 | tests/check-block: Skip iotests when sanitizers are enabled | ||
44 | 24 | ||
45 | Vladimir Sementsov-Ogievskiy (1): | 25 | Vladimir Sementsov-Ogievskiy (1): |
46 | block: fix permission update in bdrv_replace_node | 26 | block/block-copy: fix use-after-free of task pointer |
47 | 27 | ||
48 | block.c | 5 +- | 28 | docs/interop/qcow2.txt | 1 + |
49 | block/file-posix.c | 53 +++++++++- | 29 | configure | 2 +- |
50 | block/vmdk.c | 64 ++++++++---- | 30 | qapi/block-core.json | 23 ++- |
51 | qemu-io-cmds.c | 99 +++++++++++++++++-- | 31 | block/qcow2.h | 20 ++- |
52 | tests/check-block.sh | 5 + | 32 | include/block/block_int.h | 1 + |
53 | tests/qemu-iotests/002 | 1 + | 33 | block/block-copy.c | 2 +- |
54 | tests/qemu-iotests/003 | 1 + | 34 | block/qcow2-threads.c | 240 +++++++++++++++++++++++++++++-- |
55 | tests/qemu-iotests/005 | 3 +- | 35 | block/qcow2.c | 120 ++++++++++++++++ |
56 | tests/qemu-iotests/009 | 1 + | 36 | tests/qemu-iotests/031.out | 14 +- |
57 | tests/qemu-iotests/010 | 1 + | 37 | tests/qemu-iotests/036.out | 4 +- |
58 | tests/qemu-iotests/011 | 1 + | 38 | tests/qemu-iotests/049.out | 102 ++++++------- |
59 | tests/qemu-iotests/017 | 3 +- | 39 | tests/qemu-iotests/060.out | 1 + |
60 | tests/qemu-iotests/018 | 3 +- | 40 | tests/qemu-iotests/061.out | 34 +++-- |
61 | tests/qemu-iotests/019 | 3 +- | 41 | tests/qemu-iotests/065 | 28 ++-- |
62 | tests/qemu-iotests/020 | 3 +- | 42 | tests/qemu-iotests/080 | 2 +- |
63 | tests/qemu-iotests/026 | 4 +- | 43 | tests/qemu-iotests/082.out | 48 ++++++- |
64 | tests/qemu-iotests/027 | 1 + | 44 | tests/qemu-iotests/085.out | 38 ++--- |
65 | tests/qemu-iotests/032 | 1 + | 45 | tests/qemu-iotests/144.out | 4 +- |
66 | tests/qemu-iotests/033 | 1 + | 46 | tests/qemu-iotests/182.out | 2 +- |
67 | tests/qemu-iotests/034 | 3 +- | 47 | tests/qemu-iotests/185.out | 8 +- |
68 | tests/qemu-iotests/037 | 3 +- | 48 | tests/qemu-iotests/198.out | 2 + |
69 | tests/qemu-iotests/039 | 4 +- | 49 | tests/qemu-iotests/206.out | 5 + |
70 | tests/qemu-iotests/052 | 2 +- | 50 | tests/qemu-iotests/242.out | 5 + |
71 | tests/qemu-iotests/059 | 34 ++++++- | 51 | tests/qemu-iotests/255.out | 8 +- |
72 | tests/qemu-iotests/059.out | 26 +++-- | 52 | tests/qemu-iotests/274.out | 49 ++++--- |
73 | tests/qemu-iotests/063 | 3 +- | 53 | tests/qemu-iotests/280.out | 2 +- |
74 | tests/qemu-iotests/071 | 1 + | 54 | tests/qemu-iotests/287 | 152 ++++++++++++++++++++ |
75 | tests/qemu-iotests/072 | 1 + | 55 | tests/qemu-iotests/287.out | 67 +++++++++ |
76 | tests/qemu-iotests/081 | 4 +- | 56 | tests/qemu-iotests/common.filter | 3 +- |
77 | tests/qemu-iotests/091 | 4 +- | 57 | tests/qemu-iotests/group | 1 + |
78 | tests/qemu-iotests/099 | 1 + | 58 | 30 files changed, 825 insertions(+), 163 deletions(-) |
79 | tests/qemu-iotests/105 | 3 +- | 59 | create mode 100755 tests/qemu-iotests/287 |
80 | tests/qemu-iotests/110 | 3 +- | 60 | create mode 100644 tests/qemu-iotests/287.out |
81 | tests/qemu-iotests/120 | 1 + | ||
82 | tests/qemu-iotests/126 | 2 + | ||
83 | tests/qemu-iotests/{150.out => 150.out.qcow2} | 0 | ||
84 | tests/qemu-iotests/150.out.raw | 12 +++ | ||
85 | tests/qemu-iotests/162 | 4 +- | ||
86 | tests/qemu-iotests/175 | 47 +++++++-- | ||
87 | tests/qemu-iotests/175.out | 16 ++- | ||
88 | tests/qemu-iotests/178.out.qcow2 | 4 +- | ||
89 | tests/qemu-iotests/184 | 1 + | ||
90 | tests/qemu-iotests/186 | 1 + | ||
91 | tests/qemu-iotests/197 | 1 + | ||
92 | tests/qemu-iotests/215 | 1 + | ||
93 | tests/qemu-iotests/221.out | 12 ++- | ||
94 | tests/qemu-iotests/251 | 1 + | ||
95 | tests/qemu-iotests/253.out | 12 ++- | ||
96 | tests/qemu-iotests/common.filter | 4 +- | ||
97 | tests/qemu-iotests/common.rc | 14 +++ | ||
98 | 50 files changed, 391 insertions(+), 87 deletions(-) | ||
99 | rename tests/qemu-iotests/{150.out => 150.out.qcow2} (100%) | ||
100 | create mode 100644 tests/qemu-iotests/150.out.raw | ||
101 | 61 | ||
102 | -- | 62 | -- |
103 | 2.21.0 | 63 | 2.26.2 |
104 | 64 | ||
105 | 65 | diff view generated by jsdifflib |
1 | fe646693acc changed qemu-img create's output so that it no longer prints | 1 | From: Denis Plotnikov <dplotnikov@virtuozzo.com> |
---|---|---|---|
2 | single quotes around parameter values. The subformat and adapter_type | ||
3 | filters in _filter_img_create() have never been adapted to that change. | ||
4 | 2 | ||
5 | Fixes: fe646693acc13ac48b98435d14149ab04dc597bc | 3 | The patch adds some preparation parts for incompatible compression type |
6 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 4 | feature to qcow2 allowing the use different compression methods for |
7 | Reviewed-by: John Snow <jsnow@redhat.com> | 5 | image clusters (de)compressing. |
8 | Message-id: 20190815153638.4600-2-mreitz@redhat.com | 6 | |
9 | Reviewed-by: John Snow <jsnow@redhat.com> | 7 | It is implied that the compression type is set on the image creation and |
8 | can be changed only later by image conversion, thus compression type | ||
9 | defines the only compression algorithm used for the image, and thus, | ||
10 | for all image clusters. | ||
11 | |||
12 | The goal of the feature is to add support of other compression methods | ||
13 | to qcow2. For example, ZSTD which is more effective on compression than ZLIB. | ||
14 | |||
15 | The default compression is ZLIB. Images created with ZLIB compression type | ||
16 | are backward compatible with older qemu versions. | ||
17 | |||
18 | Adding of the compression type breaks a number of tests because now the | ||
19 | compression type is reported on image creation and there are some changes | ||
20 | in the qcow2 header in size and offsets. | ||
21 | |||
22 | The tests are fixed in the following ways: | ||
23 | * filter out compression_type for many tests | ||
24 | * fix header size, feature table size and backing file offset | ||
25 | affected tests: 031, 036, 061, 080 | ||
26 | header_size +=8: 1 byte compression type | ||
27 | 7 bytes padding | ||
28 | feature_table += 48: incompatible feature compression type | ||
29 | backing_file_offset += 56 (8 + 48 -> header_change + feature_table_change) | ||
30 | * add "compression type" for test output matching when it isn't filtered | ||
31 | affected tests: 049, 060, 061, 065, 082, 085, 144, 182, 185, 198, 206, | ||
32 | 242, 255, 274, 280 | ||
33 | |||
34 | Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com> | ||
35 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
36 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
37 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
38 | QAPI part: | ||
39 | Acked-by: Markus Armbruster <armbru@redhat.com> | ||
40 | Message-Id: <20200507082521.29210-2-dplotnikov@virtuozzo.com> | ||
10 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 41 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
11 | --- | 42 | --- |
12 | tests/qemu-iotests/059.out | 16 ++++++++-------- | 43 | qapi/block-core.json | 22 +++++- |
13 | tests/qemu-iotests/common.filter | 4 ++-- | 44 | block/qcow2.h | 20 +++++- |
14 | 2 files changed, 10 insertions(+), 10 deletions(-) | 45 | include/block/block_int.h | 1 + |
46 | block/qcow2.c | 113 +++++++++++++++++++++++++++++++ | ||
47 | tests/qemu-iotests/031.out | 14 ++-- | ||
48 | tests/qemu-iotests/036.out | 4 +- | ||
49 | tests/qemu-iotests/049.out | 102 ++++++++++++++-------------- | ||
50 | tests/qemu-iotests/060.out | 1 + | ||
51 | tests/qemu-iotests/061.out | 34 ++++++---- | ||
52 | tests/qemu-iotests/065 | 28 +++++--- | ||
53 | tests/qemu-iotests/080 | 2 +- | ||
54 | tests/qemu-iotests/082.out | 48 +++++++++++-- | ||
55 | tests/qemu-iotests/085.out | 38 +++++------ | ||
56 | tests/qemu-iotests/144.out | 4 +- | ||
57 | tests/qemu-iotests/182.out | 2 +- | ||
58 | tests/qemu-iotests/185.out | 8 +-- | ||
59 | tests/qemu-iotests/198.out | 2 + | ||
60 | tests/qemu-iotests/206.out | 5 ++ | ||
61 | tests/qemu-iotests/242.out | 5 ++ | ||
62 | tests/qemu-iotests/255.out | 8 +-- | ||
63 | tests/qemu-iotests/274.out | 49 +++++++------- | ||
64 | tests/qemu-iotests/280.out | 2 +- | ||
65 | tests/qemu-iotests/common.filter | 3 +- | ||
66 | 23 files changed, 365 insertions(+), 150 deletions(-) | ||
15 | 67 | ||
16 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | 68 | diff --git a/qapi/block-core.json b/qapi/block-core.json |
17 | index XXXXXXX..XXXXXXX 100644 | 69 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/tests/qemu-iotests/059.out | 70 | --- a/qapi/block-core.json |
19 | +++ b/tests/qemu-iotests/059.out | 71 | +++ b/qapi/block-core.json |
20 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | 72 | @@ -XXX,XX +XXX,XX @@ |
21 | qemu-io: can't open device TEST_DIR/t.vmdk: L1 size too big | 73 | # |
22 | 74 | # @bitmaps: A list of qcow2 bitmap details (since 4.0) | |
23 | === Testing monolithicFlat creation and opening === | 75 | # |
24 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat | 76 | +# @compression-type: the image cluster compression method (since 5.1) |
25 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 | 77 | +# |
78 | # Since: 1.7 | ||
79 | ## | ||
80 | { 'struct': 'ImageInfoSpecificQCow2', | ||
81 | @@ -XXX,XX +XXX,XX @@ | ||
82 | '*corrupt': 'bool', | ||
83 | 'refcount-bits': 'int', | ||
84 | '*encrypt': 'ImageInfoSpecificQCow2Encryption', | ||
85 | - '*bitmaps': ['Qcow2BitmapInfo'] | ||
86 | + '*bitmaps': ['Qcow2BitmapInfo'], | ||
87 | + 'compression-type': 'Qcow2CompressionType' | ||
88 | } } | ||
89 | |||
90 | ## | ||
91 | @@ -XXX,XX +XXX,XX @@ | ||
92 | 'data': [ 'v2', 'v3' ] } | ||
93 | |||
94 | |||
95 | +## | ||
96 | +# @Qcow2CompressionType: | ||
97 | +# | ||
98 | +# Compression type used in qcow2 image file | ||
99 | +# | ||
100 | +# @zlib: zlib compression, see <http://zlib.net/> | ||
101 | +# | ||
102 | +# Since: 5.1 | ||
103 | +## | ||
104 | +{ 'enum': 'Qcow2CompressionType', | ||
105 | + 'data': [ 'zlib' ] } | ||
106 | + | ||
107 | ## | ||
108 | # @BlockdevCreateOptionsQcow2: | ||
109 | # | ||
110 | @@ -XXX,XX +XXX,XX @@ | ||
111 | # allowed values: off, falloc, full, metadata) | ||
112 | # @lazy-refcounts: True if refcounts may be updated lazily (default: off) | ||
113 | # @refcount-bits: Width of reference counts in bits (default: 16) | ||
114 | +# @compression-type: The image cluster compression method | ||
115 | +# (default: zlib, since 5.1) | ||
116 | # | ||
117 | # Since: 2.12 | ||
118 | ## | ||
119 | @@ -XXX,XX +XXX,XX @@ | ||
120 | '*cluster-size': 'size', | ||
121 | '*preallocation': 'PreallocMode', | ||
122 | '*lazy-refcounts': 'bool', | ||
123 | - '*refcount-bits': 'int' } } | ||
124 | + '*refcount-bits': 'int', | ||
125 | + '*compression-type':'Qcow2CompressionType' } } | ||
126 | |||
127 | ## | ||
128 | # @BlockdevCreateOptionsQed: | ||
129 | diff --git a/block/qcow2.h b/block/qcow2.h | ||
130 | index XXXXXXX..XXXXXXX 100644 | ||
131 | --- a/block/qcow2.h | ||
132 | +++ b/block/qcow2.h | ||
133 | @@ -XXX,XX +XXX,XX @@ typedef struct QCowHeader { | ||
134 | |||
135 | uint32_t refcount_order; | ||
136 | uint32_t header_length; | ||
137 | + | ||
138 | + /* Additional fields */ | ||
139 | + uint8_t compression_type; | ||
140 | + | ||
141 | + /* header must be a multiple of 8 */ | ||
142 | + uint8_t padding[7]; | ||
143 | } QEMU_PACKED QCowHeader; | ||
144 | |||
145 | +QEMU_BUILD_BUG_ON(!QEMU_IS_ALIGNED(sizeof(QCowHeader), 8)); | ||
146 | + | ||
147 | typedef struct QEMU_PACKED QCowSnapshotHeader { | ||
148 | /* header is 8 byte aligned */ | ||
149 | uint64_t l1_table_offset; | ||
150 | @@ -XXX,XX +XXX,XX @@ enum { | ||
151 | QCOW2_INCOMPAT_DIRTY_BITNR = 0, | ||
152 | QCOW2_INCOMPAT_CORRUPT_BITNR = 1, | ||
153 | QCOW2_INCOMPAT_DATA_FILE_BITNR = 2, | ||
154 | + QCOW2_INCOMPAT_COMPRESSION_BITNR = 3, | ||
155 | QCOW2_INCOMPAT_DIRTY = 1 << QCOW2_INCOMPAT_DIRTY_BITNR, | ||
156 | QCOW2_INCOMPAT_CORRUPT = 1 << QCOW2_INCOMPAT_CORRUPT_BITNR, | ||
157 | QCOW2_INCOMPAT_DATA_FILE = 1 << QCOW2_INCOMPAT_DATA_FILE_BITNR, | ||
158 | + QCOW2_INCOMPAT_COMPRESSION = 1 << QCOW2_INCOMPAT_COMPRESSION_BITNR, | ||
159 | |||
160 | QCOW2_INCOMPAT_MASK = QCOW2_INCOMPAT_DIRTY | ||
161 | | QCOW2_INCOMPAT_CORRUPT | ||
162 | - | QCOW2_INCOMPAT_DATA_FILE, | ||
163 | + | QCOW2_INCOMPAT_DATA_FILE | ||
164 | + | QCOW2_INCOMPAT_COMPRESSION, | ||
165 | }; | ||
166 | |||
167 | /* Compatible feature bits */ | ||
168 | @@ -XXX,XX +XXX,XX @@ typedef struct BDRVQcow2State { | ||
169 | |||
170 | bool metadata_preallocation_checked; | ||
171 | bool metadata_preallocation; | ||
172 | + /* | ||
173 | + * Compression type used for the image. Default: 0 - ZLIB | ||
174 | + * The image compression type is set on image creation. | ||
175 | + * For now, the only way to change the compression type | ||
176 | + * is to convert the image with the desired compression type set. | ||
177 | + */ | ||
178 | + Qcow2CompressionType compression_type; | ||
179 | } BDRVQcow2State; | ||
180 | |||
181 | typedef struct Qcow2COWRegion { | ||
182 | diff --git a/include/block/block_int.h b/include/block/block_int.h | ||
183 | index XXXXXXX..XXXXXXX 100644 | ||
184 | --- a/include/block/block_int.h | ||
185 | +++ b/include/block/block_int.h | ||
186 | @@ -XXX,XX +XXX,XX @@ | ||
187 | #define BLOCK_OPT_REFCOUNT_BITS "refcount_bits" | ||
188 | #define BLOCK_OPT_DATA_FILE "data_file" | ||
189 | #define BLOCK_OPT_DATA_FILE_RAW "data_file_raw" | ||
190 | +#define BLOCK_OPT_COMPRESSION_TYPE "compression_type" | ||
191 | |||
192 | #define BLOCK_PROBE_BUF_SIZE 512 | ||
193 | |||
194 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
195 | index XXXXXXX..XXXXXXX 100644 | ||
196 | --- a/block/qcow2.c | ||
197 | +++ b/block/qcow2.c | ||
198 | @@ -XXX,XX +XXX,XX @@ static int qcow2_update_options(BlockDriverState *bs, QDict *options, | ||
199 | return ret; | ||
200 | } | ||
201 | |||
202 | +static int validate_compression_type(BDRVQcow2State *s, Error **errp) | ||
203 | +{ | ||
204 | + switch (s->compression_type) { | ||
205 | + case QCOW2_COMPRESSION_TYPE_ZLIB: | ||
206 | + break; | ||
207 | + | ||
208 | + default: | ||
209 | + error_setg(errp, "qcow2: unknown compression type: %u", | ||
210 | + s->compression_type); | ||
211 | + return -ENOTSUP; | ||
212 | + } | ||
213 | + | ||
214 | + /* | ||
215 | + * if the compression type differs from QCOW2_COMPRESSION_TYPE_ZLIB | ||
216 | + * the incompatible feature flag must be set | ||
217 | + */ | ||
218 | + if (s->compression_type == QCOW2_COMPRESSION_TYPE_ZLIB) { | ||
219 | + if (s->incompatible_features & QCOW2_INCOMPAT_COMPRESSION) { | ||
220 | + error_setg(errp, "qcow2: Compression type incompatible feature " | ||
221 | + "bit must not be set"); | ||
222 | + return -EINVAL; | ||
223 | + } | ||
224 | + } else { | ||
225 | + if (!(s->incompatible_features & QCOW2_INCOMPAT_COMPRESSION)) { | ||
226 | + error_setg(errp, "qcow2: Compression type incompatible feature " | ||
227 | + "bit must be set"); | ||
228 | + return -EINVAL; | ||
229 | + } | ||
230 | + } | ||
231 | + | ||
232 | + return 0; | ||
233 | +} | ||
234 | + | ||
235 | /* Called with s->lock held. */ | ||
236 | static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, | ||
237 | int flags, Error **errp) | ||
238 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, | ||
239 | s->compatible_features = header.compatible_features; | ||
240 | s->autoclear_features = header.autoclear_features; | ||
241 | |||
242 | + /* | ||
243 | + * Handle compression type | ||
244 | + * Older qcow2 images don't contain the compression type header. | ||
245 | + * Distinguish them by the header length and use | ||
246 | + * the only valid (default) compression type in that case | ||
247 | + */ | ||
248 | + if (header.header_length > offsetof(QCowHeader, compression_type)) { | ||
249 | + s->compression_type = header.compression_type; | ||
250 | + } else { | ||
251 | + s->compression_type = QCOW2_COMPRESSION_TYPE_ZLIB; | ||
252 | + } | ||
253 | + | ||
254 | + ret = validate_compression_type(s, errp); | ||
255 | + if (ret) { | ||
256 | + goto fail; | ||
257 | + } | ||
258 | + | ||
259 | if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) { | ||
260 | void *feature_table = NULL; | ||
261 | qcow2_read_extensions(bs, header.header_length, ext_end, | ||
262 | @@ -XXX,XX +XXX,XX @@ int qcow2_update_header(BlockDriverState *bs) | ||
263 | total_size = bs->total_sectors * BDRV_SECTOR_SIZE; | ||
264 | refcount_table_clusters = s->refcount_table_size >> (s->cluster_bits - 3); | ||
265 | |||
266 | + ret = validate_compression_type(s, NULL); | ||
267 | + if (ret) { | ||
268 | + goto fail; | ||
269 | + } | ||
270 | + | ||
271 | *header = (QCowHeader) { | ||
272 | /* Version 2 fields */ | ||
273 | .magic = cpu_to_be32(QCOW_MAGIC), | ||
274 | @@ -XXX,XX +XXX,XX @@ int qcow2_update_header(BlockDriverState *bs) | ||
275 | .autoclear_features = cpu_to_be64(s->autoclear_features), | ||
276 | .refcount_order = cpu_to_be32(s->refcount_order), | ||
277 | .header_length = cpu_to_be32(header_length), | ||
278 | + .compression_type = s->compression_type, | ||
279 | }; | ||
280 | |||
281 | /* For older versions, write a shorter header */ | ||
282 | @@ -XXX,XX +XXX,XX @@ int qcow2_update_header(BlockDriverState *bs) | ||
283 | .bit = QCOW2_INCOMPAT_DATA_FILE_BITNR, | ||
284 | .name = "external data file", | ||
285 | }, | ||
286 | + { | ||
287 | + .type = QCOW2_FEAT_TYPE_INCOMPATIBLE, | ||
288 | + .bit = QCOW2_INCOMPAT_COMPRESSION_BITNR, | ||
289 | + .name = "compression type", | ||
290 | + }, | ||
291 | { | ||
292 | .type = QCOW2_FEAT_TYPE_COMPATIBLE, | ||
293 | .bit = QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR, | ||
294 | @@ -XXX,XX +XXX,XX @@ qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp) | ||
295 | uint64_t* refcount_table; | ||
296 | Error *local_err = NULL; | ||
297 | int ret; | ||
298 | + uint8_t compression_type = QCOW2_COMPRESSION_TYPE_ZLIB; | ||
299 | |||
300 | assert(create_options->driver == BLOCKDEV_DRIVER_QCOW2); | ||
301 | qcow2_opts = &create_options->u.qcow2; | ||
302 | @@ -XXX,XX +XXX,XX @@ qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp) | ||
303 | } | ||
304 | } | ||
305 | |||
306 | + if (qcow2_opts->has_compression_type && | ||
307 | + qcow2_opts->compression_type != QCOW2_COMPRESSION_TYPE_ZLIB) { | ||
308 | + | ||
309 | + ret = -EINVAL; | ||
310 | + | ||
311 | + if (version < 3) { | ||
312 | + error_setg(errp, "Non-zlib compression type is only supported with " | ||
313 | + "compatibility level 1.1 and above (use version=v3 or " | ||
314 | + "greater)"); | ||
315 | + goto out; | ||
316 | + } | ||
317 | + | ||
318 | + switch (qcow2_opts->compression_type) { | ||
319 | + default: | ||
320 | + error_setg(errp, "Unknown compression type"); | ||
321 | + goto out; | ||
322 | + } | ||
323 | + | ||
324 | + compression_type = qcow2_opts->compression_type; | ||
325 | + } | ||
326 | + | ||
327 | /* Create BlockBackend to write to the image */ | ||
328 | blk = blk_new_with_bs(bs, BLK_PERM_WRITE | BLK_PERM_RESIZE, BLK_PERM_ALL, | ||
329 | errp); | ||
330 | @@ -XXX,XX +XXX,XX @@ qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp) | ||
331 | .refcount_table_offset = cpu_to_be64(cluster_size), | ||
332 | .refcount_table_clusters = cpu_to_be32(1), | ||
333 | .refcount_order = cpu_to_be32(refcount_order), | ||
334 | + /* don't deal with endianness since compression_type is 1 byte long */ | ||
335 | + .compression_type = compression_type, | ||
336 | .header_length = cpu_to_be32(sizeof(*header)), | ||
337 | }; | ||
338 | |||
339 | @@ -XXX,XX +XXX,XX @@ qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp) | ||
340 | header->autoclear_features |= | ||
341 | cpu_to_be64(QCOW2_AUTOCLEAR_DATA_FILE_RAW); | ||
342 | } | ||
343 | + if (compression_type != QCOW2_COMPRESSION_TYPE_ZLIB) { | ||
344 | + header->incompatible_features |= | ||
345 | + cpu_to_be64(QCOW2_INCOMPAT_COMPRESSION); | ||
346 | + } | ||
347 | |||
348 | ret = blk_pwrite(blk, 0, header, cluster_size, 0); | ||
349 | g_free(header); | ||
350 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_create_opts(BlockDriver *drv, | ||
351 | { BLOCK_OPT_ENCRYPT, BLOCK_OPT_ENCRYPT_FORMAT }, | ||
352 | { BLOCK_OPT_COMPAT_LEVEL, "version" }, | ||
353 | { BLOCK_OPT_DATA_FILE_RAW, "data-file-raw" }, | ||
354 | + { BLOCK_OPT_COMPRESSION_TYPE, "compression-type" }, | ||
355 | { NULL, NULL }, | ||
356 | }; | ||
357 | |||
358 | @@ -XXX,XX +XXX,XX @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs, | ||
359 | .data_file = g_strdup(s->image_data_file), | ||
360 | .has_data_file_raw = has_data_file(bs), | ||
361 | .data_file_raw = data_file_is_raw(bs), | ||
362 | + .compression_type = s->compression_type, | ||
363 | }; | ||
364 | } else { | ||
365 | /* if this assertion fails, this probably means a new version was | ||
366 | @@ -XXX,XX +XXX,XX @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts, | ||
367 | "images"); | ||
368 | return -EINVAL; | ||
369 | } | ||
370 | + } else if (!strcmp(desc->name, BLOCK_OPT_COMPRESSION_TYPE)) { | ||
371 | + const char *ct_name = | ||
372 | + qemu_opt_get(opts, BLOCK_OPT_COMPRESSION_TYPE); | ||
373 | + int compression_type = | ||
374 | + qapi_enum_parse(&Qcow2CompressionType_lookup, ct_name, -1, | ||
375 | + NULL); | ||
376 | + if (compression_type == -1) { | ||
377 | + error_setg(errp, "Unknown compression type: %s", ct_name); | ||
378 | + return -ENOTSUP; | ||
379 | + } | ||
380 | + | ||
381 | + if (compression_type != s->compression_type) { | ||
382 | + error_setg(errp, "Changing the compression type " | ||
383 | + "is not supported"); | ||
384 | + return -ENOTSUP; | ||
385 | + } | ||
386 | } else { | ||
387 | /* if this point is reached, this probably means a new option was | ||
388 | * added without having it covered here */ | ||
389 | @@ -XXX,XX +XXX,XX @@ static QemuOptsList qcow2_create_opts = { | ||
390 | .help = "Width of a reference count entry in bits", | ||
391 | .def_value_str = "16" | ||
392 | }, | ||
393 | + { | ||
394 | + .name = BLOCK_OPT_COMPRESSION_TYPE, | ||
395 | + .type = QEMU_OPT_STRING, | ||
396 | + .help = "Compression method used for image cluster compression", | ||
397 | + .def_value_str = "zlib" | ||
398 | + }, | ||
399 | { /* end of list */ } | ||
400 | } | ||
401 | }; | ||
402 | diff --git a/tests/qemu-iotests/031.out b/tests/qemu-iotests/031.out | ||
403 | index XXXXXXX..XXXXXXX 100644 | ||
404 | --- a/tests/qemu-iotests/031.out | ||
405 | +++ b/tests/qemu-iotests/031.out | ||
406 | @@ -XXX,XX +XXX,XX @@ incompatible_features [] | ||
407 | compatible_features [] | ||
408 | autoclear_features [] | ||
409 | refcount_order 4 | ||
410 | -header_length 104 | ||
411 | +header_length 112 | ||
412 | |||
413 | Header extension: | ||
414 | magic 0x6803f857 | ||
415 | -length 288 | ||
416 | +length 336 | ||
417 | data <binary> | ||
418 | |||
419 | Header extension: | ||
420 | @@ -XXX,XX +XXX,XX @@ incompatible_features [] | ||
421 | compatible_features [] | ||
422 | autoclear_features [] | ||
423 | refcount_order 4 | ||
424 | -header_length 104 | ||
425 | +header_length 112 | ||
426 | |||
427 | Header extension: | ||
428 | magic 0x6803f857 | ||
429 | -length 288 | ||
430 | +length 336 | ||
431 | data <binary> | ||
432 | |||
433 | Header extension: | ||
434 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
435 | |||
436 | magic 0x514649fb | ||
437 | version 3 | ||
438 | -backing_file_offset 0x1d8 | ||
439 | +backing_file_offset 0x210 | ||
440 | backing_file_size 0x17 | ||
441 | cluster_bits 16 | ||
442 | size 67108864 | ||
443 | @@ -XXX,XX +XXX,XX @@ incompatible_features [] | ||
444 | compatible_features [] | ||
445 | autoclear_features [] | ||
446 | refcount_order 4 | ||
447 | -header_length 104 | ||
448 | +header_length 112 | ||
449 | |||
450 | Header extension: | ||
451 | magic 0xe2792aca | ||
452 | @@ -XXX,XX +XXX,XX @@ data 'host_device' | ||
453 | |||
454 | Header extension: | ||
455 | magic 0x6803f857 | ||
456 | -length 288 | ||
457 | +length 336 | ||
458 | data <binary> | ||
459 | |||
460 | Header extension: | ||
461 | diff --git a/tests/qemu-iotests/036.out b/tests/qemu-iotests/036.out | ||
462 | index XXXXXXX..XXXXXXX 100644 | ||
463 | --- a/tests/qemu-iotests/036.out | ||
464 | +++ b/tests/qemu-iotests/036.out | ||
465 | @@ -XXX,XX +XXX,XX @@ compatible_features [] | ||
466 | autoclear_features [63] | ||
467 | Header extension: | ||
468 | magic 0x6803f857 | ||
469 | -length 288 | ||
470 | +length 336 | ||
471 | data <binary> | ||
472 | |||
473 | |||
474 | @@ -XXX,XX +XXX,XX @@ compatible_features [] | ||
475 | autoclear_features [] | ||
476 | Header extension: | ||
477 | magic 0x6803f857 | ||
478 | -length 288 | ||
479 | +length 336 | ||
480 | data <binary> | ||
481 | |||
482 | *** done | ||
483 | diff --git a/tests/qemu-iotests/049.out b/tests/qemu-iotests/049.out | ||
484 | index XXXXXXX..XXXXXXX 100644 | ||
485 | --- a/tests/qemu-iotests/049.out | ||
486 | +++ b/tests/qemu-iotests/049.out | ||
487 | @@ -XXX,XX +XXX,XX @@ QA output created by 049 | ||
488 | == 1. Traditional size parameter == | ||
489 | |||
490 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024 | ||
491 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
492 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
493 | |||
494 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024b | ||
495 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
496 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
497 | |||
498 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1k | ||
499 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
500 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
501 | |||
502 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1K | ||
503 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
504 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
505 | |||
506 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1M | ||
507 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1048576 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
508 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1048576 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
509 | |||
510 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1G | ||
511 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
512 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
513 | |||
514 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1T | ||
515 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1099511627776 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
516 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1099511627776 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
517 | |||
518 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024.0 | ||
519 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
520 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
521 | |||
522 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024.0b | ||
523 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
524 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
525 | |||
526 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5k | ||
527 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1536 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
528 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1536 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
529 | |||
530 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5K | ||
531 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1536 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
532 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1536 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
533 | |||
534 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5M | ||
535 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1572864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
536 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1572864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
537 | |||
538 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5G | ||
539 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1610612736 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
540 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1610612736 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
541 | |||
542 | qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5T | ||
543 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1649267441664 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
544 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1649267441664 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
545 | |||
546 | == 2. Specifying size via -o == | ||
547 | |||
548 | qemu-img create -f qcow2 -o size=1024 TEST_DIR/t.qcow2 | ||
549 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
550 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
551 | |||
552 | qemu-img create -f qcow2 -o size=1024b TEST_DIR/t.qcow2 | ||
553 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
554 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
555 | |||
556 | qemu-img create -f qcow2 -o size=1k TEST_DIR/t.qcow2 | ||
557 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
558 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
559 | |||
560 | qemu-img create -f qcow2 -o size=1K TEST_DIR/t.qcow2 | ||
561 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
562 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
563 | |||
564 | qemu-img create -f qcow2 -o size=1M TEST_DIR/t.qcow2 | ||
565 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1048576 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
566 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1048576 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
567 | |||
568 | qemu-img create -f qcow2 -o size=1G TEST_DIR/t.qcow2 | ||
569 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
570 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
571 | |||
572 | qemu-img create -f qcow2 -o size=1T TEST_DIR/t.qcow2 | ||
573 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1099511627776 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
574 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1099511627776 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
575 | |||
576 | qemu-img create -f qcow2 -o size=1024.0 TEST_DIR/t.qcow2 | ||
577 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
578 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
579 | |||
580 | qemu-img create -f qcow2 -o size=1024.0b TEST_DIR/t.qcow2 | ||
581 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
582 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1024 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
583 | |||
584 | qemu-img create -f qcow2 -o size=1.5k TEST_DIR/t.qcow2 | ||
585 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1536 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
586 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1536 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
587 | |||
588 | qemu-img create -f qcow2 -o size=1.5K TEST_DIR/t.qcow2 | ||
589 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1536 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
590 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1536 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
591 | |||
592 | qemu-img create -f qcow2 -o size=1.5M TEST_DIR/t.qcow2 | ||
593 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1572864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
594 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1572864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
595 | |||
596 | qemu-img create -f qcow2 -o size=1.5G TEST_DIR/t.qcow2 | ||
597 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1610612736 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
598 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1610612736 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
599 | |||
600 | qemu-img create -f qcow2 -o size=1.5T TEST_DIR/t.qcow2 | ||
601 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1649267441664 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
602 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1649267441664 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
603 | |||
604 | == 3. Invalid sizes == | ||
605 | |||
606 | @@ -XXX,XX +XXX,XX @@ qemu-img: TEST_DIR/t.qcow2: The image size must be specified only once | ||
607 | == Check correct interpretation of suffixes for cluster size == | ||
608 | |||
609 | qemu-img create -f qcow2 -o cluster_size=1024 TEST_DIR/t.qcow2 64M | ||
610 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 | ||
611 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
612 | |||
613 | qemu-img create -f qcow2 -o cluster_size=1024b TEST_DIR/t.qcow2 64M | ||
614 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 | ||
615 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
616 | |||
617 | qemu-img create -f qcow2 -o cluster_size=1k TEST_DIR/t.qcow2 64M | ||
618 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 | ||
619 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
620 | |||
621 | qemu-img create -f qcow2 -o cluster_size=1K TEST_DIR/t.qcow2 64M | ||
622 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 | ||
623 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
624 | |||
625 | qemu-img create -f qcow2 -o cluster_size=1M TEST_DIR/t.qcow2 64M | ||
626 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1048576 lazy_refcounts=off refcount_bits=16 | ||
627 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1048576 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
628 | |||
629 | qemu-img create -f qcow2 -o cluster_size=1024.0 TEST_DIR/t.qcow2 64M | ||
630 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 | ||
631 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
632 | |||
633 | qemu-img create -f qcow2 -o cluster_size=1024.0b TEST_DIR/t.qcow2 64M | ||
634 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 | ||
635 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=1024 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
636 | |||
637 | qemu-img create -f qcow2 -o cluster_size=0.5k TEST_DIR/t.qcow2 64M | ||
638 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=512 lazy_refcounts=off refcount_bits=16 | ||
639 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=512 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
640 | |||
641 | qemu-img create -f qcow2 -o cluster_size=0.5K TEST_DIR/t.qcow2 64M | ||
642 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=512 lazy_refcounts=off refcount_bits=16 | ||
643 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=512 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
644 | |||
645 | qemu-img create -f qcow2 -o cluster_size=0.5M TEST_DIR/t.qcow2 64M | ||
646 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=524288 lazy_refcounts=off refcount_bits=16 | ||
647 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=524288 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
648 | |||
649 | == Check compat level option == | ||
650 | |||
651 | qemu-img create -f qcow2 -o compat=0.10 TEST_DIR/t.qcow2 64M | ||
652 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=0.10 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
653 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=0.10 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
654 | |||
655 | qemu-img create -f qcow2 -o compat=1.1 TEST_DIR/t.qcow2 64M | ||
656 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=1.1 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
657 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=1.1 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
658 | |||
659 | qemu-img create -f qcow2 -o compat=0.42 TEST_DIR/t.qcow2 64M | ||
660 | qemu-img: TEST_DIR/t.qcow2: Invalid parameter '0.42' | ||
661 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=0.42 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
662 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=0.42 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
663 | |||
664 | qemu-img create -f qcow2 -o compat=foobar TEST_DIR/t.qcow2 64M | ||
665 | qemu-img: TEST_DIR/t.qcow2: Invalid parameter 'foobar' | ||
666 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=foobar cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
667 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=foobar cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
668 | |||
669 | == Check preallocation option == | ||
670 | |||
671 | qemu-img create -f qcow2 -o preallocation=off TEST_DIR/t.qcow2 64M | ||
672 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=65536 preallocation=off lazy_refcounts=off refcount_bits=16 | ||
673 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=65536 preallocation=off lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
674 | |||
675 | qemu-img create -f qcow2 -o preallocation=metadata TEST_DIR/t.qcow2 64M | ||
676 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16 | ||
677 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
678 | |||
679 | qemu-img create -f qcow2 -o preallocation=1234 TEST_DIR/t.qcow2 64M | ||
680 | qemu-img: TEST_DIR/t.qcow2: Invalid parameter '1234' | ||
681 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=65536 preallocation=1234 lazy_refcounts=off refcount_bits=16 | ||
682 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 cluster_size=65536 preallocation=1234 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
683 | |||
684 | == Check encryption option == | ||
685 | |||
686 | qemu-img create -f qcow2 -o encryption=off TEST_DIR/t.qcow2 64M | ||
687 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
688 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
689 | |||
690 | qemu-img create -f qcow2 --object secret,id=sec0,data=123456 -o encryption=on,encrypt.key-secret=sec0 TEST_DIR/t.qcow2 64M | ||
691 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 encryption=on encrypt.key-secret=sec0 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
692 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 encryption=on encrypt.key-secret=sec0 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
693 | |||
694 | == Check lazy_refcounts option (only with v3) == | ||
695 | |||
696 | qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=off TEST_DIR/t.qcow2 64M | ||
697 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=1.1 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
698 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=1.1 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
699 | |||
700 | qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=on TEST_DIR/t.qcow2 64M | ||
701 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=1.1 cluster_size=65536 lazy_refcounts=on refcount_bits=16 | ||
702 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=1.1 cluster_size=65536 lazy_refcounts=on refcount_bits=16 compression_type=zlib | ||
703 | |||
704 | qemu-img create -f qcow2 -o compat=0.10,lazy_refcounts=off TEST_DIR/t.qcow2 64M | ||
705 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=0.10 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
706 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=0.10 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
707 | |||
708 | qemu-img create -f qcow2 -o compat=0.10,lazy_refcounts=on TEST_DIR/t.qcow2 64M | ||
709 | qemu-img: TEST_DIR/t.qcow2: Lazy refcounts only supported with compatibility level 1.1 and above (use version=v3 or greater) | ||
710 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=0.10 cluster_size=65536 lazy_refcounts=on refcount_bits=16 | ||
711 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat=0.10 cluster_size=65536 lazy_refcounts=on refcount_bits=16 compression_type=zlib | ||
712 | |||
713 | *** done | ||
714 | diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out | ||
715 | index XXXXXXX..XXXXXXX 100644 | ||
716 | --- a/tests/qemu-iotests/060.out | ||
717 | +++ b/tests/qemu-iotests/060.out | ||
718 | @@ -XXX,XX +XXX,XX @@ virtual size: 64 MiB (67108864 bytes) | ||
719 | cluster_size: 65536 | ||
720 | Format specific information: | ||
721 | compat: 1.1 | ||
722 | + compression type: zlib | ||
723 | lazy refcounts: false | ||
724 | refcount bits: 16 | ||
725 | corrupt: true | ||
726 | diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out | ||
727 | index XXXXXXX..XXXXXXX 100644 | ||
728 | --- a/tests/qemu-iotests/061.out | ||
729 | +++ b/tests/qemu-iotests/061.out | ||
730 | @@ -XXX,XX +XXX,XX @@ incompatible_features [] | ||
731 | compatible_features [0] | ||
732 | autoclear_features [] | ||
733 | refcount_order 4 | ||
734 | -header_length 104 | ||
735 | +header_length 112 | ||
736 | |||
737 | Header extension: | ||
738 | magic 0x6803f857 | ||
739 | -length 288 | ||
740 | +length 336 | ||
741 | data <binary> | ||
742 | |||
743 | magic 0x514649fb | ||
744 | @@ -XXX,XX +XXX,XX @@ incompatible_features [] | ||
745 | compatible_features [0] | ||
746 | autoclear_features [] | ||
747 | refcount_order 4 | ||
748 | -header_length 104 | ||
749 | +header_length 112 | ||
750 | |||
751 | Header extension: | ||
752 | magic 0x6803f857 | ||
753 | -length 288 | ||
754 | +length 336 | ||
755 | data <binary> | ||
756 | |||
757 | magic 0x514649fb | ||
758 | @@ -XXX,XX +XXX,XX @@ incompatible_features [0] | ||
759 | compatible_features [0] | ||
760 | autoclear_features [] | ||
761 | refcount_order 4 | ||
762 | -header_length 104 | ||
763 | +header_length 112 | ||
764 | |||
765 | Header extension: | ||
766 | magic 0x6803f857 | ||
767 | -length 288 | ||
768 | +length 336 | ||
769 | data <binary> | ||
770 | |||
771 | ERROR cluster 5 refcount=0 reference=1 | ||
772 | @@ -XXX,XX +XXX,XX @@ incompatible_features [] | ||
773 | compatible_features [42] | ||
774 | autoclear_features [42] | ||
775 | refcount_order 4 | ||
776 | -header_length 104 | ||
777 | +header_length 112 | ||
778 | |||
779 | Header extension: | ||
780 | magic 0x6803f857 | ||
781 | -length 288 | ||
782 | +length 336 | ||
783 | data <binary> | ||
784 | |||
785 | magic 0x514649fb | ||
786 | @@ -XXX,XX +XXX,XX @@ incompatible_features [] | ||
787 | compatible_features [0] | ||
788 | autoclear_features [] | ||
789 | refcount_order 4 | ||
790 | -header_length 104 | ||
791 | +header_length 112 | ||
792 | |||
793 | Header extension: | ||
794 | magic 0x6803f857 | ||
795 | -length 288 | ||
796 | +length 336 | ||
797 | data <binary> | ||
798 | |||
799 | read 65536/65536 bytes at offset 44040192 | ||
800 | @@ -XXX,XX +XXX,XX @@ incompatible_features [0] | ||
801 | compatible_features [0] | ||
802 | autoclear_features [] | ||
803 | refcount_order 4 | ||
804 | -header_length 104 | ||
805 | +header_length 112 | ||
806 | |||
807 | Header extension: | ||
808 | magic 0x6803f857 | ||
809 | -length 288 | ||
810 | +length 336 | ||
811 | data <binary> | ||
812 | |||
813 | ERROR cluster 5 refcount=0 reference=1 | ||
814 | @@ -XXX,XX +XXX,XX @@ incompatible_features [] | ||
815 | compatible_features [] | ||
816 | autoclear_features [] | ||
817 | refcount_order 4 | ||
818 | -header_length 104 | ||
819 | +header_length 112 | ||
820 | |||
821 | Header extension: | ||
822 | magic 0x6803f857 | ||
823 | -length 288 | ||
824 | +length 336 | ||
825 | data <binary> | ||
826 | |||
827 | read 131072/131072 bytes at offset 0 | ||
828 | @@ -XXX,XX +XXX,XX @@ virtual size: 64 MiB (67108864 bytes) | ||
829 | cluster_size: 65536 | ||
830 | Format specific information: | ||
831 | compat: 1.1 | ||
832 | + compression type: zlib | ||
833 | lazy refcounts: false | ||
834 | refcount bits: 16 | ||
835 | data file: TEST_DIR/t.IMGFMT.data | ||
836 | @@ -XXX,XX +XXX,XX @@ virtual size: 64 MiB (67108864 bytes) | ||
837 | cluster_size: 65536 | ||
838 | Format specific information: | ||
839 | compat: 1.1 | ||
840 | + compression type: zlib | ||
841 | lazy refcounts: false | ||
842 | refcount bits: 16 | ||
843 | data file: foo | ||
844 | @@ -XXX,XX +XXX,XX @@ virtual size: 64 MiB (67108864 bytes) | ||
845 | cluster_size: 65536 | ||
846 | Format specific information: | ||
847 | compat: 1.1 | ||
848 | + compression type: zlib | ||
849 | lazy refcounts: false | ||
850 | refcount bits: 16 | ||
851 | data file raw: false | ||
852 | @@ -XXX,XX +XXX,XX @@ virtual size: 64 MiB (67108864 bytes) | ||
853 | cluster_size: 65536 | ||
854 | Format specific information: | ||
855 | compat: 1.1 | ||
856 | + compression type: zlib | ||
857 | lazy refcounts: false | ||
858 | refcount bits: 16 | ||
859 | data file: TEST_DIR/t.IMGFMT.data | ||
860 | @@ -XXX,XX +XXX,XX @@ virtual size: 64 MiB (67108864 bytes) | ||
861 | cluster_size: 65536 | ||
862 | Format specific information: | ||
863 | compat: 1.1 | ||
864 | + compression type: zlib | ||
865 | lazy refcounts: false | ||
866 | refcount bits: 16 | ||
867 | data file: TEST_DIR/t.IMGFMT.data | ||
868 | @@ -XXX,XX +XXX,XX @@ virtual size: 64 MiB (67108864 bytes) | ||
869 | cluster_size: 65536 | ||
870 | Format specific information: | ||
871 | compat: 1.1 | ||
872 | + compression type: zlib | ||
873 | lazy refcounts: false | ||
874 | refcount bits: 16 | ||
875 | data file: TEST_DIR/t.IMGFMT.data | ||
876 | diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065 | ||
877 | index XXXXXXX..XXXXXXX 100755 | ||
878 | --- a/tests/qemu-iotests/065 | ||
879 | +++ b/tests/qemu-iotests/065 | ||
880 | @@ -XXX,XX +XXX,XX @@ class TestQMP(TestImageInfoSpecific): | ||
881 | class TestQCow2(TestQemuImgInfo): | ||
882 | '''Testing a qcow2 version 2 image''' | ||
883 | img_options = 'compat=0.10' | ||
884 | - json_compare = { 'compat': '0.10', 'refcount-bits': 16 } | ||
885 | - human_compare = [ 'compat: 0.10', 'refcount bits: 16' ] | ||
886 | + json_compare = { 'compat': '0.10', 'refcount-bits': 16, | ||
887 | + 'compression-type': 'zlib' } | ||
888 | + human_compare = [ 'compat: 0.10', 'compression type: zlib', | ||
889 | + 'refcount bits: 16' ] | ||
890 | |||
891 | class TestQCow3NotLazy(TestQemuImgInfo): | ||
892 | '''Testing a qcow2 version 3 image with lazy refcounts disabled''' | ||
893 | img_options = 'compat=1.1,lazy_refcounts=off' | ||
894 | json_compare = { 'compat': '1.1', 'lazy-refcounts': False, | ||
895 | - 'refcount-bits': 16, 'corrupt': False } | ||
896 | - human_compare = [ 'compat: 1.1', 'lazy refcounts: false', | ||
897 | - 'refcount bits: 16', 'corrupt: false' ] | ||
898 | + 'refcount-bits': 16, 'corrupt': False, | ||
899 | + 'compression-type': 'zlib' } | ||
900 | + human_compare = [ 'compat: 1.1', 'compression type: zlib', | ||
901 | + 'lazy refcounts: false', 'refcount bits: 16', | ||
902 | + 'corrupt: false' ] | ||
903 | |||
904 | class TestQCow3Lazy(TestQemuImgInfo): | ||
905 | '''Testing a qcow2 version 3 image with lazy refcounts enabled''' | ||
906 | img_options = 'compat=1.1,lazy_refcounts=on' | ||
907 | json_compare = { 'compat': '1.1', 'lazy-refcounts': True, | ||
908 | - 'refcount-bits': 16, 'corrupt': False } | ||
909 | - human_compare = [ 'compat: 1.1', 'lazy refcounts: true', | ||
910 | - 'refcount bits: 16', 'corrupt: false' ] | ||
911 | + 'refcount-bits': 16, 'corrupt': False, | ||
912 | + 'compression-type': 'zlib' } | ||
913 | + human_compare = [ 'compat: 1.1', 'compression type: zlib', | ||
914 | + 'lazy refcounts: true', 'refcount bits: 16', | ||
915 | + 'corrupt: false' ] | ||
916 | |||
917 | class TestQCow3NotLazyQMP(TestQMP): | ||
918 | '''Testing a qcow2 version 3 image with lazy refcounts disabled, opening | ||
919 | @@ -XXX,XX +XXX,XX @@ class TestQCow3NotLazyQMP(TestQMP): | ||
920 | img_options = 'compat=1.1,lazy_refcounts=off' | ||
921 | qemu_options = 'lazy-refcounts=on' | ||
922 | compare = { 'compat': '1.1', 'lazy-refcounts': False, | ||
923 | - 'refcount-bits': 16, 'corrupt': False } | ||
924 | + 'refcount-bits': 16, 'corrupt': False, | ||
925 | + 'compression-type': 'zlib' } | ||
926 | |||
927 | |||
928 | class TestQCow3LazyQMP(TestQMP): | ||
929 | @@ -XXX,XX +XXX,XX @@ class TestQCow3LazyQMP(TestQMP): | ||
930 | img_options = 'compat=1.1,lazy_refcounts=on' | ||
931 | qemu_options = 'lazy-refcounts=off' | ||
932 | compare = { 'compat': '1.1', 'lazy-refcounts': True, | ||
933 | - 'refcount-bits': 16, 'corrupt': False } | ||
934 | + 'refcount-bits': 16, 'corrupt': False, | ||
935 | + 'compression-type': 'zlib' } | ||
936 | |||
937 | TestImageInfoSpecific = None | ||
938 | TestQemuImgInfo = None | ||
939 | diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080 | ||
940 | index XXXXXXX..XXXXXXX 100755 | ||
941 | --- a/tests/qemu-iotests/080 | ||
942 | +++ b/tests/qemu-iotests/080 | ||
943 | @@ -XXX,XX +XXX,XX @@ _supported_os Linux | ||
944 | # - This is generally a test for compat=1.1 images | ||
945 | _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file 'compat=0.10' | ||
946 | |||
947 | -header_size=104 | ||
948 | +header_size=112 | ||
949 | |||
950 | offset_backing_file_offset=8 | ||
951 | offset_backing_file_size=16 | ||
952 | diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out | ||
953 | index XXXXXXX..XXXXXXX 100644 | ||
954 | --- a/tests/qemu-iotests/082.out | ||
955 | +++ b/tests/qemu-iotests/082.out | ||
956 | @@ -XXX,XX +XXX,XX @@ QA output created by 082 | ||
957 | === create: Options specified more than once === | ||
958 | |||
959 | Testing: create -f foo -f qcow2 TEST_DIR/t.qcow2 128M | ||
960 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
961 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
26 | image: TEST_DIR/t.IMGFMT | 962 | image: TEST_DIR/t.IMGFMT |
27 | file format: IMGFMT | 963 | file format: IMGFMT |
28 | virtual size: 2 GiB (2147483648 bytes) | 964 | virtual size: 128 MiB (134217728 bytes) |
29 | 965 | cluster_size: 65536 | |
30 | === Testing monolithicFlat with zeroed_grain === | 966 | |
31 | qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain | 967 | Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 128M |
32 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat | 968 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=4096 lazy_refcounts=on refcount_bits=16 |
33 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 | 969 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=4096 lazy_refcounts=on refcount_bits=16 compression_type=zlib |
34 | |||
35 | === Testing big twoGbMaxExtentFlat === | ||
36 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 subformat=twoGbMaxExtentFlat | ||
37 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 | ||
38 | image: TEST_DIR/t.vmdk | ||
39 | file format: vmdk | ||
40 | virtual size: 0.977 TiB (1073741824000 bytes) | ||
41 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
42 | qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Invalid extent line: RW 12582912 VMFS "dummy.IMGFMT" 1 | ||
43 | |||
44 | === Testing truncated sparse === | ||
45 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 subformat=monolithicSparse | ||
46 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 | ||
47 | qemu-img: Could not open 'TEST_DIR/t.IMGFMT': File truncated, expecting at least 13172736 bytes | ||
48 | |||
49 | === Converting to streamOptimized from image with small cluster size=== | ||
50 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 10240 | ||
51 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
52 | |||
53 | === Testing monolithicFlat with internally generated JSON file name === | ||
54 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 subformat=monolithicFlat | ||
55 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
56 | qemu-io: can't open: Cannot use relative extent paths with VMDK descriptor file 'json:{"image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "inject-error.0.event": "read_aio"}' | ||
57 | |||
58 | === Testing version 3 === | ||
59 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 64931328 | ||
60 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
61 | |||
62 | === Testing 4TB monolithicFlat creation and IO === | ||
63 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4398046511104 subformat=monolithicFlat | ||
64 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4398046511104 | ||
65 | image: TEST_DIR/t.IMGFMT | 970 | image: TEST_DIR/t.IMGFMT |
66 | file format: IMGFMT | 971 | file format: IMGFMT |
67 | virtual size: 4 TiB (4398046511104 bytes) | 972 | virtual size: 128 MiB (134217728 bytes) |
68 | @@ -XXX,XX +XXX,XX @@ read 1024/1024 bytes at offset 966367641600 | 973 | cluster_size: 4096 |
69 | 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | 974 | Format specific information: |
70 | 975 | compat: 1.1 | |
71 | === Testing qemu-img map on extents === | 976 | + compression type: zlib |
72 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=33285996544 subformat=monolithicSparse | 977 | lazy refcounts: true |
73 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=33285996544 | 978 | refcount bits: 16 |
74 | wrote 1024/1024 bytes at offset 65024 | 979 | corrupt: false |
75 | 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | 980 | |
76 | wrote 1024/1024 bytes at offset 2147483136 | 981 | Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k TEST_DIR/t.qcow2 128M |
77 | @@ -XXX,XX +XXX,XX @@ Offset Length Mapped to File | 982 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=on refcount_bits=16 |
78 | 0 0x20000 0x3f0000 TEST_DIR/t.vmdk | 983 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=on refcount_bits=16 compression_type=zlib |
79 | 0x7fff0000 0x20000 0x410000 TEST_DIR/t.vmdk | 984 | image: TEST_DIR/t.IMGFMT |
80 | 0x140000000 0x10000 0x430000 TEST_DIR/t.vmdk | 985 | file format: IMGFMT |
81 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=33285996544 subformat=twoGbMaxExtentSparse | 986 | virtual size: 128 MiB (134217728 bytes) |
82 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=33285996544 | 987 | cluster_size: 8192 |
83 | wrote 1024/1024 bytes at offset 65024 | 988 | Format specific information: |
84 | 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | 989 | compat: 1.1 |
85 | wrote 1024/1024 bytes at offset 2147483136 | 990 | + compression type: zlib |
991 | lazy refcounts: true | ||
992 | refcount bits: 16 | ||
993 | corrupt: false | ||
994 | |||
995 | Testing: create -f qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 128M | ||
996 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=off refcount_bits=16 | ||
997 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
998 | image: TEST_DIR/t.IMGFMT | ||
999 | file format: IMGFMT | ||
1000 | virtual size: 128 MiB (134217728 bytes) | ||
1001 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1002 | backing_fmt=<str> - Image format of the base image | ||
1003 | cluster_size=<size> - qcow2 cluster size | ||
1004 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1005 | + compression_type=<str> - Compression method used for image cluster compression | ||
1006 | data_file=<str> - File name of an external data file | ||
1007 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1008 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1009 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1010 | backing_fmt=<str> - Image format of the base image | ||
1011 | cluster_size=<size> - qcow2 cluster size | ||
1012 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1013 | + compression_type=<str> - Compression method used for image cluster compression | ||
1014 | data_file=<str> - File name of an external data file | ||
1015 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1016 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1017 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1018 | backing_fmt=<str> - Image format of the base image | ||
1019 | cluster_size=<size> - qcow2 cluster size | ||
1020 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1021 | + compression_type=<str> - Compression method used for image cluster compression | ||
1022 | data_file=<str> - File name of an external data file | ||
1023 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1024 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1025 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1026 | backing_fmt=<str> - Image format of the base image | ||
1027 | cluster_size=<size> - qcow2 cluster size | ||
1028 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1029 | + compression_type=<str> - Compression method used for image cluster compression | ||
1030 | data_file=<str> - File name of an external data file | ||
1031 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1032 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1033 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1034 | backing_fmt=<str> - Image format of the base image | ||
1035 | cluster_size=<size> - qcow2 cluster size | ||
1036 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1037 | + compression_type=<str> - Compression method used for image cluster compression | ||
1038 | data_file=<str> - File name of an external data file | ||
1039 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1040 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1041 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1042 | backing_fmt=<str> - Image format of the base image | ||
1043 | cluster_size=<size> - qcow2 cluster size | ||
1044 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1045 | + compression_type=<str> - Compression method used for image cluster compression | ||
1046 | data_file=<str> - File name of an external data file | ||
1047 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1048 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1049 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1050 | backing_fmt=<str> - Image format of the base image | ||
1051 | cluster_size=<size> - qcow2 cluster size | ||
1052 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1053 | + compression_type=<str> - Compression method used for image cluster compression | ||
1054 | data_file=<str> - File name of an external data file | ||
1055 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1056 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1057 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1058 | backing_fmt=<str> - Image format of the base image | ||
1059 | cluster_size=<size> - qcow2 cluster size | ||
1060 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1061 | + compression_type=<str> - Compression method used for image cluster compression | ||
1062 | data_file=<str> - File name of an external data file | ||
1063 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1064 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1065 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1066 | size=<size> - Virtual disk size | ||
1067 | |||
1068 | Testing: create -f qcow2 -u -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 128M | ||
1069 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/t.qcow2,,help cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1070 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/t.qcow2,,help cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1071 | |||
1072 | Testing: create -f qcow2 -u -o backing_file=TEST_DIR/t.qcow2,,? TEST_DIR/t.qcow2 128M | ||
1073 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/t.qcow2,,? cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1074 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/t.qcow2,,? cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1075 | |||
1076 | Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2, -o help TEST_DIR/t.qcow2 128M | ||
1077 | qemu-img: Invalid option list: backing_file=TEST_DIR/t.qcow2, | ||
1078 | @@ -XXX,XX +XXX,XX @@ Supported qcow2 options: | ||
1079 | backing_fmt=<str> - Image format of the base image | ||
1080 | cluster_size=<size> - qcow2 cluster size | ||
1081 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1082 | + compression_type=<str> - Compression method used for image cluster compression | ||
1083 | data_file=<str> - File name of an external data file | ||
1084 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1085 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1086 | @@ -XXX,XX +XXX,XX @@ qemu-img: Format driver 'bochs' does not support image creation | ||
1087 | === convert: Options specified more than once === | ||
1088 | |||
1089 | Testing: create -f qcow2 TEST_DIR/t.qcow2 128M | ||
1090 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1091 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1092 | |||
1093 | Testing: convert -f foo -f qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
1094 | image: TEST_DIR/t.IMGFMT.base | ||
1095 | @@ -XXX,XX +XXX,XX @@ virtual size: 128 MiB (134217728 bytes) | ||
1096 | cluster_size: 4096 | ||
1097 | Format specific information: | ||
1098 | compat: 1.1 | ||
1099 | + compression type: zlib | ||
1100 | lazy refcounts: true | ||
1101 | refcount bits: 16 | ||
1102 | corrupt: false | ||
1103 | @@ -XXX,XX +XXX,XX @@ virtual size: 128 MiB (134217728 bytes) | ||
1104 | cluster_size: 8192 | ||
1105 | Format specific information: | ||
1106 | compat: 1.1 | ||
1107 | + compression type: zlib | ||
1108 | lazy refcounts: true | ||
1109 | refcount bits: 16 | ||
1110 | corrupt: false | ||
1111 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1112 | backing_fmt=<str> - Image format of the base image | ||
1113 | cluster_size=<size> - qcow2 cluster size | ||
1114 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1115 | + compression_type=<str> - Compression method used for image cluster compression | ||
1116 | data_file=<str> - File name of an external data file | ||
1117 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1118 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1119 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1120 | backing_fmt=<str> - Image format of the base image | ||
1121 | cluster_size=<size> - qcow2 cluster size | ||
1122 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1123 | + compression_type=<str> - Compression method used for image cluster compression | ||
1124 | data_file=<str> - File name of an external data file | ||
1125 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1126 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1127 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1128 | backing_fmt=<str> - Image format of the base image | ||
1129 | cluster_size=<size> - qcow2 cluster size | ||
1130 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1131 | + compression_type=<str> - Compression method used for image cluster compression | ||
1132 | data_file=<str> - File name of an external data file | ||
1133 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1134 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1135 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1136 | backing_fmt=<str> - Image format of the base image | ||
1137 | cluster_size=<size> - qcow2 cluster size | ||
1138 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1139 | + compression_type=<str> - Compression method used for image cluster compression | ||
1140 | data_file=<str> - File name of an external data file | ||
1141 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1142 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1143 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1144 | backing_fmt=<str> - Image format of the base image | ||
1145 | cluster_size=<size> - qcow2 cluster size | ||
1146 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1147 | + compression_type=<str> - Compression method used for image cluster compression | ||
1148 | data_file=<str> - File name of an external data file | ||
1149 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1150 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1151 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1152 | backing_fmt=<str> - Image format of the base image | ||
1153 | cluster_size=<size> - qcow2 cluster size | ||
1154 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1155 | + compression_type=<str> - Compression method used for image cluster compression | ||
1156 | data_file=<str> - File name of an external data file | ||
1157 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1158 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1159 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1160 | backing_fmt=<str> - Image format of the base image | ||
1161 | cluster_size=<size> - qcow2 cluster size | ||
1162 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1163 | + compression_type=<str> - Compression method used for image cluster compression | ||
1164 | data_file=<str> - File name of an external data file | ||
1165 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1166 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1167 | @@ -XXX,XX +XXX,XX @@ Supported options: | ||
1168 | backing_fmt=<str> - Image format of the base image | ||
1169 | cluster_size=<size> - qcow2 cluster size | ||
1170 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1171 | + compression_type=<str> - Compression method used for image cluster compression | ||
1172 | data_file=<str> - File name of an external data file | ||
1173 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1174 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1175 | @@ -XXX,XX +XXX,XX @@ Supported qcow2 options: | ||
1176 | backing_fmt=<str> - Image format of the base image | ||
1177 | cluster_size=<size> - qcow2 cluster size | ||
1178 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1179 | + compression_type=<str> - Compression method used for image cluster compression | ||
1180 | data_file=<str> - File name of an external data file | ||
1181 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1182 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1183 | @@ -XXX,XX +XXX,XX @@ virtual size: 128 MiB (134217728 bytes) | ||
1184 | cluster_size: 65536 | ||
1185 | Format specific information: | ||
1186 | compat: 1.1 | ||
1187 | + compression type: zlib | ||
1188 | lazy refcounts: true | ||
1189 | refcount bits: 16 | ||
1190 | corrupt: false | ||
1191 | @@ -XXX,XX +XXX,XX @@ virtual size: 130 MiB (136314880 bytes) | ||
1192 | cluster_size: 65536 | ||
1193 | Format specific information: | ||
1194 | compat: 1.1 | ||
1195 | + compression type: zlib | ||
1196 | lazy refcounts: false | ||
1197 | refcount bits: 16 | ||
1198 | corrupt: false | ||
1199 | @@ -XXX,XX +XXX,XX @@ virtual size: 132 MiB (138412032 bytes) | ||
1200 | cluster_size: 65536 | ||
1201 | Format specific information: | ||
1202 | compat: 1.1 | ||
1203 | + compression type: zlib | ||
1204 | lazy refcounts: true | ||
1205 | refcount bits: 16 | ||
1206 | corrupt: false | ||
1207 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': | ||
1208 | backing_fmt=<str> - Image format of the base image | ||
1209 | cluster_size=<size> - qcow2 cluster size | ||
1210 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1211 | + compression_type=<str> - Compression method used for image cluster compression | ||
1212 | data_file=<str> - File name of an external data file | ||
1213 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1214 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1215 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': | ||
1216 | backing_fmt=<str> - Image format of the base image | ||
1217 | cluster_size=<size> - qcow2 cluster size | ||
1218 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1219 | + compression_type=<str> - Compression method used for image cluster compression | ||
1220 | data_file=<str> - File name of an external data file | ||
1221 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1222 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1223 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': | ||
1224 | backing_fmt=<str> - Image format of the base image | ||
1225 | cluster_size=<size> - qcow2 cluster size | ||
1226 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1227 | + compression_type=<str> - Compression method used for image cluster compression | ||
1228 | data_file=<str> - File name of an external data file | ||
1229 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1230 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1231 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': | ||
1232 | backing_fmt=<str> - Image format of the base image | ||
1233 | cluster_size=<size> - qcow2 cluster size | ||
1234 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1235 | + compression_type=<str> - Compression method used for image cluster compression | ||
1236 | data_file=<str> - File name of an external data file | ||
1237 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1238 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1239 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': | ||
1240 | backing_fmt=<str> - Image format of the base image | ||
1241 | cluster_size=<size> - qcow2 cluster size | ||
1242 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1243 | + compression_type=<str> - Compression method used for image cluster compression | ||
1244 | data_file=<str> - File name of an external data file | ||
1245 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1246 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1247 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': | ||
1248 | backing_fmt=<str> - Image format of the base image | ||
1249 | cluster_size=<size> - qcow2 cluster size | ||
1250 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1251 | + compression_type=<str> - Compression method used for image cluster compression | ||
1252 | data_file=<str> - File name of an external data file | ||
1253 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1254 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1255 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': | ||
1256 | backing_fmt=<str> - Image format of the base image | ||
1257 | cluster_size=<size> - qcow2 cluster size | ||
1258 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1259 | + compression_type=<str> - Compression method used for image cluster compression | ||
1260 | data_file=<str> - File name of an external data file | ||
1261 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1262 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1263 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': | ||
1264 | backing_fmt=<str> - Image format of the base image | ||
1265 | cluster_size=<size> - qcow2 cluster size | ||
1266 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1267 | + compression_type=<str> - Compression method used for image cluster compression | ||
1268 | data_file=<str> - File name of an external data file | ||
1269 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1270 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1271 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': | ||
1272 | backing_fmt=<str> - Image format of the base image | ||
1273 | cluster_size=<size> - qcow2 cluster size | ||
1274 | compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1]) | ||
1275 | + compression_type=<str> - Compression method used for image cluster compression | ||
1276 | data_file=<str> - File name of an external data file | ||
1277 | data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image | ||
1278 | encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1279 | diff --git a/tests/qemu-iotests/085.out b/tests/qemu-iotests/085.out | ||
1280 | index XXXXXXX..XXXXXXX 100644 | ||
1281 | --- a/tests/qemu-iotests/085.out | ||
1282 | +++ b/tests/qemu-iotests/085.out | ||
1283 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT.2', fmt=IMGFMT size=134217728 | ||
1284 | === Create a single snapshot on virtio0 === | ||
1285 | |||
1286 | { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0', 'snapshot-file':'TEST_DIR/1-snapshot-v0.IMGFMT', 'format': 'IMGFMT' } } | ||
1287 | -Formatting 'TEST_DIR/1-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/t.qcow2.1 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1288 | +Formatting 'TEST_DIR/1-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/t.qcow2.1 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1289 | {"return": {}} | ||
1290 | |||
1291 | === Invalid command - missing device and nodename === | ||
1292 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/1-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file | ||
1293 | === Create several transactional group snapshots === | ||
1294 | |||
1295 | { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/2-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/2-snapshot-v1.IMGFMT' } } ] } } | ||
1296 | -Formatting 'TEST_DIR/2-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/1-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1297 | -Formatting 'TEST_DIR/2-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/t.qcow2.2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1298 | +Formatting 'TEST_DIR/2-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/1-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1299 | +Formatting 'TEST_DIR/2-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/t.qcow2.2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1300 | {"return": {}} | ||
1301 | { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/3-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/3-snapshot-v1.IMGFMT' } } ] } } | ||
1302 | -Formatting 'TEST_DIR/3-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/2-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1303 | -Formatting 'TEST_DIR/3-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/2-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1304 | +Formatting 'TEST_DIR/3-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/2-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1305 | +Formatting 'TEST_DIR/3-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/2-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1306 | {"return": {}} | ||
1307 | { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/4-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/4-snapshot-v1.IMGFMT' } } ] } } | ||
1308 | -Formatting 'TEST_DIR/4-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/3-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1309 | -Formatting 'TEST_DIR/4-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/3-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1310 | +Formatting 'TEST_DIR/4-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/3-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1311 | +Formatting 'TEST_DIR/4-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/3-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1312 | {"return": {}} | ||
1313 | { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/5-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/5-snapshot-v1.IMGFMT' } } ] } } | ||
1314 | -Formatting 'TEST_DIR/5-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/4-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1315 | -Formatting 'TEST_DIR/5-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/4-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1316 | +Formatting 'TEST_DIR/5-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/4-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1317 | +Formatting 'TEST_DIR/5-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/4-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1318 | {"return": {}} | ||
1319 | { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/6-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/6-snapshot-v1.IMGFMT' } } ] } } | ||
1320 | -Formatting 'TEST_DIR/6-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/5-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1321 | -Formatting 'TEST_DIR/6-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/5-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1322 | +Formatting 'TEST_DIR/6-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/5-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1323 | +Formatting 'TEST_DIR/6-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/5-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1324 | {"return": {}} | ||
1325 | { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/7-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/7-snapshot-v1.IMGFMT' } } ] } } | ||
1326 | -Formatting 'TEST_DIR/7-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/6-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1327 | -Formatting 'TEST_DIR/7-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/6-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1328 | +Formatting 'TEST_DIR/7-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/6-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1329 | +Formatting 'TEST_DIR/7-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/6-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1330 | {"return": {}} | ||
1331 | { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/8-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/8-snapshot-v1.IMGFMT' } } ] } } | ||
1332 | -Formatting 'TEST_DIR/8-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/7-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1333 | -Formatting 'TEST_DIR/8-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/7-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1334 | +Formatting 'TEST_DIR/8-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/7-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1335 | +Formatting 'TEST_DIR/8-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/7-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1336 | {"return": {}} | ||
1337 | { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/9-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/9-snapshot-v1.IMGFMT' } } ] } } | ||
1338 | -Formatting 'TEST_DIR/9-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/8-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1339 | -Formatting 'TEST_DIR/9-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/8-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1340 | +Formatting 'TEST_DIR/9-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/8-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1341 | +Formatting 'TEST_DIR/9-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/8-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1342 | {"return": {}} | ||
1343 | { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/10-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/10-snapshot-v1.IMGFMT' } } ] } } | ||
1344 | -Formatting 'TEST_DIR/10-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/9-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1345 | -Formatting 'TEST_DIR/10-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/9-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1346 | +Formatting 'TEST_DIR/10-snapshot-v0.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/9-snapshot-v0.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1347 | +Formatting 'TEST_DIR/10-snapshot-v1.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/9-snapshot-v1.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1348 | {"return": {}} | ||
1349 | |||
1350 | === Create a couple of snapshots using blockdev-snapshot === | ||
1351 | diff --git a/tests/qemu-iotests/144.out b/tests/qemu-iotests/144.out | ||
1352 | index XXXXXXX..XXXXXXX 100644 | ||
1353 | --- a/tests/qemu-iotests/144.out | ||
1354 | +++ b/tests/qemu-iotests/144.out | ||
1355 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=536870912 | ||
1356 | { 'execute': 'qmp_capabilities' } | ||
1357 | {"return": {}} | ||
1358 | { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0', 'snapshot-file':'TEST_DIR/tmp.IMGFMT', 'format': 'IMGFMT' } } | ||
1359 | -Formatting 'TEST_DIR/tmp.qcow2', fmt=qcow2 size=536870912 backing_file=TEST_DIR/t.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1360 | +Formatting 'TEST_DIR/tmp.qcow2', fmt=qcow2 size=536870912 backing_file=TEST_DIR/t.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1361 | {"return": {}} | ||
1362 | |||
1363 | === Performing block-commit on active layer === | ||
1364 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/tmp.qcow2', fmt=qcow2 size=536870912 backing_file=TEST_DIR/ | ||
1365 | === Performing Live Snapshot 2 === | ||
1366 | |||
1367 | { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0', 'snapshot-file':'TEST_DIR/tmp2.IMGFMT', 'format': 'IMGFMT' } } | ||
1368 | -Formatting 'TEST_DIR/tmp2.qcow2', fmt=qcow2 size=536870912 backing_file=TEST_DIR/t.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1369 | +Formatting 'TEST_DIR/tmp2.qcow2', fmt=qcow2 size=536870912 backing_file=TEST_DIR/t.qcow2 backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1370 | {"return": {}} | ||
1371 | *** done | ||
1372 | diff --git a/tests/qemu-iotests/182.out b/tests/qemu-iotests/182.out | ||
1373 | index XXXXXXX..XXXXXXX 100644 | ||
1374 | --- a/tests/qemu-iotests/182.out | ||
1375 | +++ b/tests/qemu-iotests/182.out | ||
1376 | @@ -XXX,XX +XXX,XX @@ Is another process using the image [TEST_DIR/t.qcow2]? | ||
1377 | {'execute': 'blockdev-add', 'arguments': { 'node-name': 'node0', 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT', 'locking': 'on' } } | ||
1378 | {"return": {}} | ||
1379 | {'execute': 'blockdev-snapshot-sync', 'arguments': { 'node-name': 'node0', 'snapshot-file': 'TEST_DIR/t.IMGFMT.overlay', 'snapshot-node-name': 'node1' } } | ||
1380 | -Formatting 'TEST_DIR/t.qcow2.overlay', fmt=qcow2 size=197120 backing_file=TEST_DIR/t.qcow2 backing_fmt=file cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1381 | +Formatting 'TEST_DIR/t.qcow2.overlay', fmt=qcow2 size=197120 backing_file=TEST_DIR/t.qcow2 backing_fmt=file cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1382 | {"return": {}} | ||
1383 | {'execute': 'blockdev-add', 'arguments': { 'node-name': 'node1', 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT', 'locking': 'on' } } | ||
1384 | {"return": {}} | ||
1385 | diff --git a/tests/qemu-iotests/185.out b/tests/qemu-iotests/185.out | ||
1386 | index XXXXXXX..XXXXXXX 100644 | ||
1387 | --- a/tests/qemu-iotests/185.out | ||
1388 | +++ b/tests/qemu-iotests/185.out | ||
1389 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 | ||
1390 | === Creating backing chain === | ||
1391 | |||
1392 | { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'disk', 'snapshot-file': 'TEST_DIR/t.IMGFMT.mid', 'format': 'IMGFMT', 'mode': 'absolute-paths' } } | ||
1393 | -Formatting 'TEST_DIR/t.qcow2.mid', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.qcow2.base backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1394 | +Formatting 'TEST_DIR/t.qcow2.mid', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.qcow2.base backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1395 | {"return": {}} | ||
1396 | { 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io disk "write 0 4M"' } } | ||
1397 | wrote 4194304/4194304 bytes at offset 0 | ||
1398 | 4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1399 | {"return": ""} | ||
1400 | { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'disk', 'snapshot-file': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'absolute-paths' } } | ||
1401 | -Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.qcow2.mid backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1402 | +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.qcow2.mid backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1403 | {"return": {}} | ||
1404 | |||
1405 | === Start commit job and exit qemu === | ||
1406 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.q | ||
1407 | { 'execute': 'qmp_capabilities' } | ||
1408 | {"return": {}} | ||
1409 | { 'execute': 'drive-mirror', 'arguments': { 'device': 'disk', 'target': 'TEST_DIR/t.IMGFMT.copy', 'format': 'IMGFMT', 'sync': 'full', 'speed': 65536 } } | ||
1410 | -Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1411 | +Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1412 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}} | ||
1413 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}} | ||
1414 | {"return": {}} | ||
1415 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l | ||
1416 | { 'execute': 'qmp_capabilities' } | ||
1417 | {"return": {}} | ||
1418 | { 'execute': 'drive-backup', 'arguments': { 'device': 'disk', 'target': 'TEST_DIR/t.IMGFMT.copy', 'format': 'IMGFMT', 'sync': 'full', 'speed': 65536 } } | ||
1419 | -Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1420 | +Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1421 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}} | ||
1422 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}} | ||
1423 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "disk"}} | ||
1424 | diff --git a/tests/qemu-iotests/198.out b/tests/qemu-iotests/198.out | ||
1425 | index XXXXXXX..XXXXXXX 100644 | ||
1426 | --- a/tests/qemu-iotests/198.out | ||
1427 | +++ b/tests/qemu-iotests/198.out | ||
1428 | @@ -XXX,XX +XXX,XX @@ image: json:{ /* filtered */ } | ||
1429 | file format: IMGFMT | ||
1430 | virtual size: 16 MiB (16777216 bytes) | ||
1431 | Format specific information: | ||
1432 | + compression type: zlib | ||
1433 | encrypt: | ||
1434 | ivgen alg: plain64 | ||
1435 | hash alg: sha256 | ||
1436 | @@ -XXX,XX +XXX,XX @@ file format: IMGFMT | ||
1437 | virtual size: 16 MiB (16777216 bytes) | ||
1438 | backing file: TEST_DIR/t.IMGFMT.base | ||
1439 | Format specific information: | ||
1440 | + compression type: zlib | ||
1441 | encrypt: | ||
1442 | ivgen alg: plain64 | ||
1443 | hash alg: sha256 | ||
1444 | diff --git a/tests/qemu-iotests/206.out b/tests/qemu-iotests/206.out | ||
1445 | index XXXXXXX..XXXXXXX 100644 | ||
1446 | --- a/tests/qemu-iotests/206.out | ||
1447 | +++ b/tests/qemu-iotests/206.out | ||
1448 | @@ -XXX,XX +XXX,XX @@ virtual size: 128 MiB (134217728 bytes) | ||
1449 | cluster_size: 65536 | ||
1450 | Format specific information: | ||
1451 | compat: 1.1 | ||
1452 | + compression type: zlib | ||
1453 | lazy refcounts: false | ||
1454 | refcount bits: 16 | ||
1455 | corrupt: false | ||
1456 | @@ -XXX,XX +XXX,XX @@ virtual size: 64 MiB (67108864 bytes) | ||
1457 | cluster_size: 65536 | ||
1458 | Format specific information: | ||
1459 | compat: 1.1 | ||
1460 | + compression type: zlib | ||
1461 | lazy refcounts: false | ||
1462 | refcount bits: 16 | ||
1463 | corrupt: false | ||
1464 | @@ -XXX,XX +XXX,XX @@ virtual size: 32 MiB (33554432 bytes) | ||
1465 | cluster_size: 2097152 | ||
1466 | Format specific information: | ||
1467 | compat: 1.1 | ||
1468 | + compression type: zlib | ||
1469 | lazy refcounts: true | ||
1470 | refcount bits: 1 | ||
1471 | corrupt: false | ||
1472 | @@ -XXX,XX +XXX,XX @@ backing file: TEST_IMG.base | ||
1473 | backing file format: IMGFMT | ||
1474 | Format specific information: | ||
1475 | compat: 0.10 | ||
1476 | + compression type: zlib | ||
1477 | refcount bits: 16 | ||
1478 | |||
1479 | === Successful image creation (encrypted) === | ||
1480 | @@ -XXX,XX +XXX,XX @@ encrypted: yes | ||
1481 | cluster_size: 65536 | ||
1482 | Format specific information: | ||
1483 | compat: 1.1 | ||
1484 | + compression type: zlib | ||
1485 | lazy refcounts: false | ||
1486 | refcount bits: 16 | ||
1487 | encrypt: | ||
1488 | diff --git a/tests/qemu-iotests/242.out b/tests/qemu-iotests/242.out | ||
1489 | index XXXXXXX..XXXXXXX 100644 | ||
1490 | --- a/tests/qemu-iotests/242.out | ||
1491 | +++ b/tests/qemu-iotests/242.out | ||
1492 | @@ -XXX,XX +XXX,XX @@ virtual size: 1 MiB (1048576 bytes) | ||
1493 | cluster_size: 65536 | ||
1494 | Format specific information: | ||
1495 | compat: 1.1 | ||
1496 | + compression type: zlib | ||
1497 | lazy refcounts: false | ||
1498 | refcount bits: 16 | ||
1499 | corrupt: false | ||
1500 | @@ -XXX,XX +XXX,XX @@ virtual size: 1 MiB (1048576 bytes) | ||
1501 | cluster_size: 65536 | ||
1502 | Format specific information: | ||
1503 | compat: 1.1 | ||
1504 | + compression type: zlib | ||
1505 | lazy refcounts: false | ||
1506 | bitmaps: | ||
1507 | [0]: | ||
1508 | @@ -XXX,XX +XXX,XX @@ virtual size: 1 MiB (1048576 bytes) | ||
1509 | cluster_size: 65536 | ||
1510 | Format specific information: | ||
1511 | compat: 1.1 | ||
1512 | + compression type: zlib | ||
1513 | lazy refcounts: false | ||
1514 | bitmaps: | ||
1515 | [0]: | ||
1516 | @@ -XXX,XX +XXX,XX @@ virtual size: 1 MiB (1048576 bytes) | ||
1517 | cluster_size: 65536 | ||
1518 | Format specific information: | ||
1519 | compat: 1.1 | ||
1520 | + compression type: zlib | ||
1521 | lazy refcounts: false | ||
1522 | bitmaps: | ||
1523 | [0]: | ||
1524 | @@ -XXX,XX +XXX,XX @@ virtual size: 1 MiB (1048576 bytes) | ||
1525 | cluster_size: 65536 | ||
1526 | Format specific information: | ||
1527 | compat: 1.1 | ||
1528 | + compression type: zlib | ||
1529 | lazy refcounts: false | ||
1530 | bitmaps: | ||
1531 | [0]: | ||
1532 | diff --git a/tests/qemu-iotests/255.out b/tests/qemu-iotests/255.out | ||
1533 | index XXXXXXX..XXXXXXX 100644 | ||
1534 | --- a/tests/qemu-iotests/255.out | ||
1535 | +++ b/tests/qemu-iotests/255.out | ||
1536 | @@ -XXX,XX +XXX,XX @@ Finishing a commit job with background reads | ||
1537 | |||
1538 | === Create backing chain and start VM === | ||
1539 | |||
1540 | -Formatting 'TEST_DIR/PID-t.qcow2.mid', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1541 | +Formatting 'TEST_DIR/PID-t.qcow2.mid', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1542 | |||
1543 | -Formatting 'TEST_DIR/PID-t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1544 | +Formatting 'TEST_DIR/PID-t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1545 | |||
1546 | === Start background read requests === | ||
1547 | |||
1548 | @@ -XXX,XX +XXX,XX @@ Closing the VM while a job is being cancelled | ||
1549 | |||
1550 | === Create images and start VM === | ||
1551 | |||
1552 | -Formatting 'TEST_DIR/PID-src.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1553 | +Formatting 'TEST_DIR/PID-src.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1554 | |||
1555 | -Formatting 'TEST_DIR/PID-dst.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1556 | +Formatting 'TEST_DIR/PID-dst.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1557 | |||
1558 | wrote 1048576/1048576 bytes at offset 0 | ||
1559 | 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1560 | diff --git a/tests/qemu-iotests/274.out b/tests/qemu-iotests/274.out | ||
1561 | index XXXXXXX..XXXXXXX 100644 | ||
1562 | --- a/tests/qemu-iotests/274.out | ||
1563 | +++ b/tests/qemu-iotests/274.out | ||
1564 | @@ -XXX,XX +XXX,XX @@ | ||
1565 | == Commit tests == | ||
1566 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=2097152 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1567 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=2097152 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1568 | |||
1569 | -Formatting 'TEST_DIR/PID-mid', fmt=qcow2 size=1048576 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1570 | +Formatting 'TEST_DIR/PID-mid', fmt=qcow2 size=1048576 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1571 | |||
1572 | -Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=2097152 backing_file=TEST_DIR/PID-mid cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1573 | +Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=2097152 backing_file=TEST_DIR/PID-mid cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1574 | |||
1575 | wrote 2097152/2097152 bytes at offset 0 | ||
1576 | 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1577 | @@ -XXX,XX +XXX,XX @@ cluster_size: 65536 | ||
1578 | backing file: TEST_DIR/PID-base | ||
1579 | Format specific information: | ||
1580 | compat: 1.1 | ||
1581 | + compression type: zlib | ||
1582 | lazy refcounts: false | ||
1583 | refcount bits: 16 | ||
1584 | corrupt: false | ||
1585 | @@ -XXX,XX +XXX,XX @@ read 1048576/1048576 bytes at offset 1048576 | ||
1586 | 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1587 | |||
1588 | === Testing HMP commit (top -> mid) === | ||
1589 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=2097152 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1590 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=2097152 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1591 | |||
1592 | -Formatting 'TEST_DIR/PID-mid', fmt=qcow2 size=1048576 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1593 | +Formatting 'TEST_DIR/PID-mid', fmt=qcow2 size=1048576 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1594 | |||
1595 | -Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=2097152 backing_file=TEST_DIR/PID-mid cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1596 | +Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=2097152 backing_file=TEST_DIR/PID-mid cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1597 | |||
1598 | wrote 2097152/2097152 bytes at offset 0 | ||
1599 | 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1600 | @@ -XXX,XX +XXX,XX @@ cluster_size: 65536 | ||
1601 | backing file: TEST_DIR/PID-base | ||
1602 | Format specific information: | ||
1603 | compat: 1.1 | ||
1604 | + compression type: zlib | ||
1605 | lazy refcounts: false | ||
1606 | refcount bits: 16 | ||
1607 | corrupt: false | ||
1608 | @@ -XXX,XX +XXX,XX @@ read 1048576/1048576 bytes at offset 1048576 | ||
1609 | 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1610 | |||
1611 | === Testing QMP active commit (top -> mid) === | ||
1612 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=2097152 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1613 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=2097152 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1614 | |||
1615 | -Formatting 'TEST_DIR/PID-mid', fmt=qcow2 size=1048576 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1616 | +Formatting 'TEST_DIR/PID-mid', fmt=qcow2 size=1048576 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1617 | |||
1618 | -Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=2097152 backing_file=TEST_DIR/PID-mid cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1619 | +Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=2097152 backing_file=TEST_DIR/PID-mid cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1620 | |||
1621 | wrote 2097152/2097152 bytes at offset 0 | ||
1622 | 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1623 | @@ -XXX,XX +XXX,XX @@ cluster_size: 65536 | ||
1624 | backing file: TEST_DIR/PID-base | ||
1625 | Format specific information: | ||
1626 | compat: 1.1 | ||
1627 | + compression type: zlib | ||
1628 | lazy refcounts: false | ||
1629 | refcount bits: 16 | ||
1630 | corrupt: false | ||
1631 | @@ -XXX,XX +XXX,XX @@ read 1048576/1048576 bytes at offset 1048576 | ||
1632 | |||
1633 | == Resize tests == | ||
1634 | === preallocation=off === | ||
1635 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=6442450944 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1636 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=6442450944 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1637 | |||
1638 | -Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=1073741824 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1639 | +Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=1073741824 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1640 | |||
1641 | wrote 65536/65536 bytes at offset 5368709120 | ||
1642 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1643 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 5368709120 | ||
1644 | { "start": 1073741824, "length": 7516192768, "depth": 0, "zero": true, "data": false}] | ||
1645 | |||
1646 | === preallocation=metadata === | ||
1647 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=34359738368 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1648 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=34359738368 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1649 | |||
1650 | -Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=32212254720 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1651 | +Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=32212254720 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1652 | |||
1653 | wrote 65536/65536 bytes at offset 33285996544 | ||
1654 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1655 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 33285996544 | ||
1656 | { "start": 34896609280, "length": 536870912, "depth": 0, "zero": true, "data": false, "offset": 2685075456}] | ||
1657 | |||
1658 | === preallocation=falloc === | ||
1659 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=10485760 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1660 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=10485760 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1661 | |||
1662 | -Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=5242880 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1663 | +Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=5242880 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1664 | |||
1665 | wrote 65536/65536 bytes at offset 9437184 | ||
1666 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1667 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 9437184 | ||
1668 | { "start": 5242880, "length": 10485760, "depth": 0, "zero": false, "data": true, "offset": 327680}] | ||
1669 | |||
1670 | === preallocation=full === | ||
1671 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=16777216 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1672 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=16777216 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1673 | |||
1674 | -Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=8388608 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1675 | +Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=8388608 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1676 | |||
1677 | wrote 65536/65536 bytes at offset 11534336 | ||
1678 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1679 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 11534336 | ||
1680 | { "start": 8388608, "length": 4194304, "depth": 0, "zero": false, "data": true, "offset": 327680}] | ||
1681 | |||
1682 | === preallocation=off === | ||
1683 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=393216 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1684 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=393216 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1685 | |||
1686 | -Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=259072 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1687 | +Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=259072 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1688 | |||
1689 | wrote 65536/65536 bytes at offset 259072 | ||
1690 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1691 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 259072 | ||
1692 | { "start": 262144, "length": 262144, "depth": 0, "zero": true, "data": false}] | ||
1693 | |||
1694 | === preallocation=off === | ||
1695 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=409600 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1696 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=409600 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1697 | |||
1698 | -Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=262144 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1699 | +Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=262144 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1700 | |||
1701 | wrote 65536/65536 bytes at offset 344064 | ||
1702 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1703 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 344064 | ||
1704 | { "start": 262144, "length": 262144, "depth": 0, "zero": true, "data": false}] | ||
1705 | |||
1706 | === preallocation=off === | ||
1707 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=524288 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1708 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=524288 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1709 | |||
1710 | -Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=262144 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1711 | +Formatting 'TEST_DIR/PID-top', fmt=qcow2 size=262144 backing_file=TEST_DIR/PID-base cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1712 | |||
1713 | wrote 65536/65536 bytes at offset 446464 | ||
1714 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1715 | diff --git a/tests/qemu-iotests/280.out b/tests/qemu-iotests/280.out | ||
1716 | index XXXXXXX..XXXXXXX 100644 | ||
1717 | --- a/tests/qemu-iotests/280.out | ||
1718 | +++ b/tests/qemu-iotests/280.out | ||
1719 | @@ -XXX,XX +XXX,XX @@ | ||
1720 | -Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
1721 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib | ||
1722 | |||
1723 | === Launch VM === | ||
1724 | Enabling migration QMP events on VM... | ||
86 | diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter | 1725 | diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter |
87 | index XXXXXXX..XXXXXXX 100644 | 1726 | index XXXXXXX..XXXXXXX 100644 |
88 | --- a/tests/qemu-iotests/common.filter | 1727 | --- a/tests/qemu-iotests/common.filter |
89 | +++ b/tests/qemu-iotests/common.filter | 1728 | +++ b/tests/qemu-iotests/common.filter |
90 | @@ -XXX,XX +XXX,XX @@ _filter_img_create() | 1729 | @@ -XXX,XX +XXX,XX @@ _filter_img_create() |
91 | -e "s# compat6=\\(on\\|off\\)##g" \ | 1730 | -e "s# refcount_bits=[0-9]\\+##g" \ |
92 | -e "s# static=\\(on\\|off\\)##g" \ | 1731 | -e "s# key-secret=[a-zA-Z0-9]\\+##g" \ |
93 | -e "s# zeroed_grain=\\(on\\|off\\)##g" \ | 1732 | -e "s# iter-time=[0-9]\\+##g" \ |
94 | - -e "s# subformat='[^']*'##g" \ | 1733 | - -e "s# force_size=\\(on\\|off\\)##g" |
95 | - -e "s# adapter_type='[^']*'##g" \ | 1734 | + -e "s# force_size=\\(on\\|off\\)##g" \ |
96 | + -e "s# subformat=[^ ]*##g" \ | 1735 | + -e "s# compression_type=[a-zA-Z0-9]\\+##g" |
97 | + -e "s# adapter_type=[^ ]*##g" \ | 1736 | } |
98 | -e "s# hwversion=[^ ]*##g" \ | 1737 | |
99 | -e "s# lazy_refcounts=\\(on\\|off\\)##g" \ | 1738 | _filter_img_info() |
100 | -e "s# block_size=[0-9]\\+##g" \ | ||
101 | -- | 1739 | -- |
102 | 2.21.0 | 1740 | 2.26.2 |
103 | 1741 | ||
104 | 1742 | diff view generated by jsdifflib |
1 | From: Denis Plotnikov <dplotnikov@virtuozzo.com> | 1 | From: Denis Plotnikov <dplotnikov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | The patch allows to provide a pattern file for write | 3 | The patch enables processing the image compression type defined |
4 | command. There was no similar ability before. | 4 | for the image and chooses an appropriate method for image clusters |
5 | (de)compression. | ||
5 | 6 | ||
6 | Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com> | 7 | Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com> |
7 | Message-id: 20190820164616.4072-1-dplotnikov@virtuozzo.com | 8 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
8 | Reviewed-by: Eric Blake <eblake@redhat.com> | 9 | Reviewed-by: Alberto Garcia <berto@igalia.com> |
9 | [mreitz: Keep optstring in alphabetical order] | 10 | Reviewed-by: Max Reitz <mreitz@redhat.com> |
11 | Message-Id: <20200507082521.29210-3-dplotnikov@virtuozzo.com> | ||
10 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 12 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
11 | --- | 13 | --- |
12 | qemu-io-cmds.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++--- | 14 | block/qcow2-threads.c | 71 ++++++++++++++++++++++++++++++++++++------- |
13 | 1 file changed, 93 insertions(+), 6 deletions(-) | 15 | 1 file changed, 60 insertions(+), 11 deletions(-) |
14 | 16 | ||
15 | diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c | 17 | diff --git a/block/qcow2-threads.c b/block/qcow2-threads.c |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/qemu-io-cmds.c | 19 | --- a/block/qcow2-threads.c |
18 | +++ b/qemu-io-cmds.c | 20 | +++ b/block/qcow2-threads.c |
19 | @@ -XXX,XX +XXX,XX @@ static void qemu_io_free(void *p) | 21 | @@ -XXX,XX +XXX,XX @@ typedef struct Qcow2CompressData { |
20 | qemu_vfree(p); | 22 | } Qcow2CompressData; |
23 | |||
24 | /* | ||
25 | - * qcow2_compress() | ||
26 | + * qcow2_zlib_compress() | ||
27 | + * | ||
28 | + * Compress @src_size bytes of data using zlib compression method | ||
29 | * | ||
30 | * @dest - destination buffer, @dest_size bytes | ||
31 | * @src - source buffer, @src_size bytes | ||
32 | @@ -XXX,XX +XXX,XX @@ typedef struct Qcow2CompressData { | ||
33 | * -ENOMEM destination buffer is not enough to store compressed data | ||
34 | * -EIO on any other error | ||
35 | */ | ||
36 | -static ssize_t qcow2_compress(void *dest, size_t dest_size, | ||
37 | - const void *src, size_t src_size) | ||
38 | +static ssize_t qcow2_zlib_compress(void *dest, size_t dest_size, | ||
39 | + const void *src, size_t src_size) | ||
40 | { | ||
41 | ssize_t ret; | ||
42 | z_stream strm; | ||
43 | @@ -XXX,XX +XXX,XX @@ static ssize_t qcow2_compress(void *dest, size_t dest_size, | ||
21 | } | 44 | } |
22 | 45 | ||
46 | /* | ||
47 | - * qcow2_decompress() | ||
48 | + * qcow2_zlib_decompress() | ||
49 | * | ||
50 | * Decompress some data (not more than @src_size bytes) to produce exactly | ||
51 | - * @dest_size bytes. | ||
52 | + * @dest_size bytes using zlib compression method | ||
53 | * | ||
54 | * @dest - destination buffer, @dest_size bytes | ||
55 | * @src - source buffer, @src_size bytes | ||
56 | @@ -XXX,XX +XXX,XX @@ static ssize_t qcow2_compress(void *dest, size_t dest_size, | ||
57 | * Returns: 0 on success | ||
58 | * -EIO on fail | ||
59 | */ | ||
60 | -static ssize_t qcow2_decompress(void *dest, size_t dest_size, | ||
61 | - const void *src, size_t src_size) | ||
62 | +static ssize_t qcow2_zlib_decompress(void *dest, size_t dest_size, | ||
63 | + const void *src, size_t src_size) | ||
64 | { | ||
65 | int ret; | ||
66 | z_stream strm; | ||
67 | @@ -XXX,XX +XXX,XX @@ qcow2_co_do_compress(BlockDriverState *bs, void *dest, size_t dest_size, | ||
68 | return arg.ret; | ||
69 | } | ||
70 | |||
23 | +/* | 71 | +/* |
24 | + * qemu_io_alloc_from_file() | 72 | + * qcow2_co_compress() |
25 | + * | 73 | + * |
26 | + * Allocates the buffer and populates it with the content of the given file | 74 | + * Compress @src_size bytes of data using the compression |
27 | + * up to @len bytes. If the file length is less than @len, then the buffer | 75 | + * method defined by the image compression type |
28 | + * is populated with the file content cyclically. | ||
29 | + * | 76 | + * |
30 | + * @blk - the block backend where the buffer content is going to be written to | 77 | + * @dest - destination buffer, @dest_size bytes |
31 | + * @len - the buffer length | 78 | + * @src - source buffer, @src_size bytes |
32 | + * @file_name - the file to read the content from | ||
33 | + * | 79 | + * |
34 | + * Returns: the buffer pointer on success | 80 | + * Returns: compressed size on success |
35 | + * NULL on error | 81 | + * a negative error code on failure |
36 | + */ | 82 | + */ |
37 | +static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len, | 83 | ssize_t coroutine_fn |
38 | + const char *file_name) | 84 | qcow2_co_compress(BlockDriverState *bs, void *dest, size_t dest_size, |
39 | +{ | 85 | const void *src, size_t src_size) |
40 | + char *buf, *buf_origin; | 86 | { |
41 | + FILE *f = fopen(file_name, "r"); | 87 | - return qcow2_co_do_compress(bs, dest, dest_size, src, src_size, |
42 | + int pattern_len; | 88 | - qcow2_compress); |
89 | + BDRVQcow2State *s = bs->opaque; | ||
90 | + Qcow2CompressFunc fn; | ||
43 | + | 91 | + |
44 | + if (!f) { | 92 | + switch (s->compression_type) { |
45 | + perror(file_name); | 93 | + case QCOW2_COMPRESSION_TYPE_ZLIB: |
46 | + return NULL; | 94 | + fn = qcow2_zlib_compress; |
95 | + break; | ||
96 | + | ||
97 | + default: | ||
98 | + abort(); | ||
47 | + } | 99 | + } |
48 | + | 100 | + |
49 | + if (qemuio_misalign) { | 101 | + return qcow2_co_do_compress(bs, dest, dest_size, src, src_size, fn); |
50 | + len += MISALIGN_OFFSET; | 102 | } |
103 | |||
104 | +/* | ||
105 | + * qcow2_co_decompress() | ||
106 | + * | ||
107 | + * Decompress some data (not more than @src_size bytes) to produce exactly | ||
108 | + * @dest_size bytes using the compression method defined by the image | ||
109 | + * compression type | ||
110 | + * | ||
111 | + * @dest - destination buffer, @dest_size bytes | ||
112 | + * @src - source buffer, @src_size bytes | ||
113 | + * | ||
114 | + * Returns: 0 on success | ||
115 | + * a negative error code on failure | ||
116 | + */ | ||
117 | ssize_t coroutine_fn | ||
118 | qcow2_co_decompress(BlockDriverState *bs, void *dest, size_t dest_size, | ||
119 | const void *src, size_t src_size) | ||
120 | { | ||
121 | - return qcow2_co_do_compress(bs, dest, dest_size, src, src_size, | ||
122 | - qcow2_decompress); | ||
123 | + BDRVQcow2State *s = bs->opaque; | ||
124 | + Qcow2CompressFunc fn; | ||
125 | + | ||
126 | + switch (s->compression_type) { | ||
127 | + case QCOW2_COMPRESSION_TYPE_ZLIB: | ||
128 | + fn = qcow2_zlib_decompress; | ||
129 | + break; | ||
130 | + | ||
131 | + default: | ||
132 | + abort(); | ||
51 | + } | 133 | + } |
52 | + | 134 | + |
53 | + buf_origin = buf = blk_blockalign(blk, len); | 135 | + return qcow2_co_do_compress(bs, dest, dest_size, src, src_size, fn); |
54 | + | 136 | } |
55 | + if (qemuio_misalign) { | 137 | |
56 | + buf_origin += MISALIGN_OFFSET; | 138 | |
57 | + buf += MISALIGN_OFFSET; | ||
58 | + len -= MISALIGN_OFFSET; | ||
59 | + } | ||
60 | + | ||
61 | + pattern_len = fread(buf_origin, 1, len, f); | ||
62 | + | ||
63 | + if (ferror(f)) { | ||
64 | + perror(file_name); | ||
65 | + goto error; | ||
66 | + } | ||
67 | + | ||
68 | + if (pattern_len == 0) { | ||
69 | + fprintf(stderr, "%s: file is empty\n", file_name); | ||
70 | + goto error; | ||
71 | + } | ||
72 | + | ||
73 | + fclose(f); | ||
74 | + | ||
75 | + if (len > pattern_len) { | ||
76 | + len -= pattern_len; | ||
77 | + buf += pattern_len; | ||
78 | + | ||
79 | + while (len > 0) { | ||
80 | + size_t len_to_copy = MIN(pattern_len, len); | ||
81 | + | ||
82 | + memcpy(buf, buf_origin, len_to_copy); | ||
83 | + | ||
84 | + len -= len_to_copy; | ||
85 | + buf += len_to_copy; | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | + return buf_origin; | ||
90 | + | ||
91 | +error: | ||
92 | + qemu_io_free(buf_origin); | ||
93 | + return NULL; | ||
94 | +} | ||
95 | + | ||
96 | static void dump_buffer(const void *buffer, int64_t offset, int64_t len) | ||
97 | { | ||
98 | uint64_t i; | ||
99 | @@ -XXX,XX +XXX,XX @@ static void write_help(void) | ||
100 | " -n, -- with -z, don't allow slow fallback\n" | ||
101 | " -p, -- ignored for backwards compatibility\n" | ||
102 | " -P, -- use different pattern to fill file\n" | ||
103 | +" -s, -- use a pattern file to fill the write buffer\n" | ||
104 | " -C, -- report statistics in a machine parsable format\n" | ||
105 | " -q, -- quiet mode, do not show I/O statistics\n" | ||
106 | " -u, -- with -z, allow unmapping\n" | ||
107 | @@ -XXX,XX +XXX,XX @@ static const cmdinfo_t write_cmd = { | ||
108 | .perm = BLK_PERM_WRITE, | ||
109 | .argmin = 2, | ||
110 | .argmax = -1, | ||
111 | - .args = "[-bcCfnquz] [-P pattern] off len", | ||
112 | + .args = "[-bcCfnquz] [-P pattern | -s source_file] off len", | ||
113 | .oneline = "writes a number of bytes at a specified offset", | ||
114 | .help = write_help, | ||
115 | }; | ||
116 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | ||
117 | { | ||
118 | struct timespec t1, t2; | ||
119 | bool Cflag = false, qflag = false, bflag = false; | ||
120 | - bool Pflag = false, zflag = false, cflag = false; | ||
121 | + bool Pflag = false, zflag = false, cflag = false, sflag = false; | ||
122 | int flags = 0; | ||
123 | int c, cnt, ret; | ||
124 | char *buf = NULL; | ||
125 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | ||
126 | /* Some compilers get confused and warn if this is not initialized. */ | ||
127 | int64_t total = 0; | ||
128 | int pattern = 0xcd; | ||
129 | + const char *file_name = NULL; | ||
130 | |||
131 | - while ((c = getopt(argc, argv, "bcCfnpP:quz")) != -1) { | ||
132 | + while ((c = getopt(argc, argv, "bcCfnpP:qs:uz")) != -1) { | ||
133 | switch (c) { | ||
134 | case 'b': | ||
135 | bflag = true; | ||
136 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | ||
137 | case 'q': | ||
138 | qflag = true; | ||
139 | break; | ||
140 | + case 's': | ||
141 | + sflag = true; | ||
142 | + file_name = optarg; | ||
143 | + break; | ||
144 | case 'u': | ||
145 | flags |= BDRV_REQ_MAY_UNMAP; | ||
146 | break; | ||
147 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | ||
148 | return -EINVAL; | ||
149 | } | ||
150 | |||
151 | - if (zflag && Pflag) { | ||
152 | - printf("-z and -P cannot be specified at the same time\n"); | ||
153 | + if (zflag + Pflag + sflag > 1) { | ||
154 | + printf("Only one of -z, -P, and -s " | ||
155 | + "can be specified at the same time\n"); | ||
156 | return -EINVAL; | ||
157 | } | ||
158 | |||
159 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | ||
160 | } | ||
161 | |||
162 | if (!zflag) { | ||
163 | - buf = qemu_io_alloc(blk, count, pattern); | ||
164 | + if (sflag) { | ||
165 | + buf = qemu_io_alloc_from_file(blk, count, file_name); | ||
166 | + if (!buf) { | ||
167 | + return -EINVAL; | ||
168 | + } | ||
169 | + } else { | ||
170 | + buf = qemu_io_alloc(blk, count, pattern); | ||
171 | + } | ||
172 | } | ||
173 | |||
174 | clock_gettime(CLOCK_MONOTONIC, &t1); | ||
175 | -- | 139 | -- |
176 | 2.21.0 | 140 | 2.26.2 |
177 | 141 | ||
178 | 142 | diff view generated by jsdifflib |
1 | From: Nir Soffer <nirsof@gmail.com> | 1 | From: Denis Plotnikov <dplotnikov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | When creating an image with preallocation "off" or "falloc", the first | 3 | zstd significantly reduces cluster compression time. |
4 | block of the image is typically not allocated. When using Gluster | 4 | It provides better compression performance maintaining |
5 | storage backed by XFS filesystem, reading this block using direct I/O | 5 | the same level of the compression ratio in comparison with |
6 | succeeds regardless of request length, fooling alignment detection. | 6 | zlib, which, at the moment, is the only compression |
7 | 7 | method available. | |
8 | In this case we fallback to a safe value (4096) instead of the optimal | 8 | |
9 | value (512), which may lead to unneeded data copying when aligning | 9 | The performance test results: |
10 | requests. Allocating the first block avoids the fallback. | 10 | Test compresses and decompresses qemu qcow2 image with just |
11 | 11 | installed rhel-7.6 guest. | |
12 | Since we allocate the first block even with preallocation=off, we no | 12 | Image cluster size: 64K. Image on disk size: 2.2G |
13 | longer create images with zero disk size: | 13 | |
14 | 14 | The test was conducted with brd disk to reduce the influence | |
15 | $ ./qemu-img create -f raw test.raw 1g | 15 | of disk subsystem to the test results. |
16 | Formatting 'test.raw', fmt=raw size=1073741824 | 16 | The results is given in seconds. |
17 | 17 | ||
18 | $ ls -lhs test.raw | 18 | compress cmd: |
19 | 4.0K -rw-r--r--. 1 nsoffer nsoffer 1.0G Aug 16 23:48 test.raw | 19 | time ./qemu-img convert -O qcow2 -c -o compression_type=[zlib|zstd] |
20 | 20 | src.img [zlib|zstd]_compressed.img | |
21 | And converting the image requires additional cluster: | 21 | decompress cmd |
22 | 22 | time ./qemu-img convert -O qcow2 | |
23 | $ ./qemu-img measure -f raw -O qcow2 test.raw | 23 | [zlib|zstd]_compressed.img uncompressed.img |
24 | required size: 458752 | 24 | |
25 | fully allocated size: 1074135040 | 25 | compression decompression |
26 | 26 | zlib zstd zlib zstd | |
27 | When using format like vmdk with multiple files per image, we allocate | 27 | ------------------------------------------------------------ |
28 | one block per file: | 28 | real 65.5 16.3 (-75 %) 1.9 1.6 (-16 %) |
29 | 29 | user 65.0 15.8 5.3 2.5 | |
30 | $ ./qemu-img create -f vmdk -o subformat=twoGbMaxExtentFlat test.vmdk 4g | 30 | sys 3.3 0.2 2.0 2.0 |
31 | Formatting 'test.vmdk', fmt=vmdk size=4294967296 compat6=off hwversion=undefined subformat=twoGbMaxExtentFlat | 31 | |
32 | 32 | Both ZLIB and ZSTD gave the same compression ratio: 1.57 | |
33 | $ ls -lhs test*.vmdk | 33 | compressed image size in both cases: 1.4G |
34 | 4.0K -rw-r--r--. 1 nsoffer nsoffer 2.0G Aug 27 03:23 test-f001.vmdk | 34 | |
35 | 4.0K -rw-r--r--. 1 nsoffer nsoffer 2.0G Aug 27 03:23 test-f002.vmdk | 35 | Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com> |
36 | 4.0K -rw-r--r--. 1 nsoffer nsoffer 353 Aug 27 03:23 test.vmdk | 36 | QAPI part: |
37 | 37 | Acked-by: Markus Armbruster <armbru@redhat.com> | |
38 | I did quick performance test for copying disks with qemu-img convert to | 38 | Message-Id: <20200507082521.29210-4-dplotnikov@virtuozzo.com> |
39 | new raw target image to Gluster storage with sector size of 512 bytes: | ||
40 | |||
41 | for i in $(seq 10); do | ||
42 | rm -f dst.raw | ||
43 | sleep 10 | ||
44 | time ./qemu-img convert -f raw -O raw -t none -T none src.raw dst.raw | ||
45 | done | ||
46 | |||
47 | Here is a table comparing the total time spent: | ||
48 | |||
49 | Type Before(s) After(s) Diff(%) | ||
50 | --------------------------------------- | ||
51 | real 530.028 469.123 -11.4 | ||
52 | user 17.204 10.768 -37.4 | ||
53 | sys 17.881 7.011 -60.7 | ||
54 | |||
55 | We can see very clear improvement in CPU usage. | ||
56 | |||
57 | Signed-off-by: Nir Soffer <nsoffer@redhat.com> | ||
58 | Message-id: 20190827010528.8818-2-nsoffer@redhat.com | ||
59 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
60 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 39 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
61 | --- | 40 | --- |
62 | block/file-posix.c | 51 +++++++++++++++++++ | 41 | docs/interop/qcow2.txt | 1 + |
63 | tests/qemu-iotests/059.out | 2 +- | 42 | configure | 2 +- |
64 | tests/qemu-iotests/{150.out => 150.out.qcow2} | 0 | 43 | qapi/block-core.json | 3 +- |
65 | tests/qemu-iotests/150.out.raw | 12 +++++ | 44 | block/qcow2-threads.c | 169 +++++++++++++++++++++++++++++++++++++++++ |
66 | tests/qemu-iotests/175 | 19 ++++--- | 45 | block/qcow2.c | 7 ++ |
67 | tests/qemu-iotests/175.out | 8 +-- | 46 | 5 files changed, 180 insertions(+), 2 deletions(-) |
68 | tests/qemu-iotests/178.out.qcow2 | 4 +- | 47 | |
69 | tests/qemu-iotests/221.out | 12 +++-- | 48 | diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt |
70 | tests/qemu-iotests/253.out | 12 +++-- | ||
71 | 9 files changed, 99 insertions(+), 21 deletions(-) | ||
72 | rename tests/qemu-iotests/{150.out => 150.out.qcow2} (100%) | ||
73 | create mode 100644 tests/qemu-iotests/150.out.raw | ||
74 | |||
75 | diff --git a/block/file-posix.c b/block/file-posix.c | ||
76 | index XXXXXXX..XXXXXXX 100644 | 49 | index XXXXXXX..XXXXXXX 100644 |
77 | --- a/block/file-posix.c | 50 | --- a/docs/interop/qcow2.txt |
78 | +++ b/block/file-posix.c | 51 | +++ b/docs/interop/qcow2.txt |
79 | @@ -XXX,XX +XXX,XX @@ static int handle_aiocb_discard(void *opaque) | 52 | @@ -XXX,XX +XXX,XX @@ version 2. |
53 | |||
54 | Available compression type values: | ||
55 | 0: zlib <https://www.zlib.net/> | ||
56 | + 1: zstd <http://github.com/facebook/zstd> | ||
57 | |||
58 | |||
59 | === Header padding === | ||
60 | diff --git a/configure b/configure | ||
61 | index XXXXXXX..XXXXXXX 100755 | ||
62 | --- a/configure | ||
63 | +++ b/configure | ||
64 | @@ -XXX,XX +XXX,XX @@ disabled with --disable-FEATURE, default is enabled if available: | ||
65 | lzfse support of lzfse compression library | ||
66 | (for reading lzfse-compressed dmg images) | ||
67 | zstd support for zstd compression library | ||
68 | - (for migration compression) | ||
69 | + (for migration compression and qcow2 cluster compression) | ||
70 | seccomp seccomp support | ||
71 | coroutine-pool coroutine freelist (better performance) | ||
72 | glusterfs GlusterFS backend | ||
73 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
74 | index XXXXXXX..XXXXXXX 100644 | ||
75 | --- a/qapi/block-core.json | ||
76 | +++ b/qapi/block-core.json | ||
77 | @@ -XXX,XX +XXX,XX @@ | ||
78 | # Compression type used in qcow2 image file | ||
79 | # | ||
80 | # @zlib: zlib compression, see <http://zlib.net/> | ||
81 | +# @zstd: zstd compression, see <http://github.com/facebook/zstd> | ||
82 | # | ||
83 | # Since: 5.1 | ||
84 | ## | ||
85 | { 'enum': 'Qcow2CompressionType', | ||
86 | - 'data': [ 'zlib' ] } | ||
87 | + 'data': [ 'zlib', { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] } | ||
88 | |||
89 | ## | ||
90 | # @BlockdevCreateOptionsQcow2: | ||
91 | diff --git a/block/qcow2-threads.c b/block/qcow2-threads.c | ||
92 | index XXXXXXX..XXXXXXX 100644 | ||
93 | --- a/block/qcow2-threads.c | ||
94 | +++ b/block/qcow2-threads.c | ||
95 | @@ -XXX,XX +XXX,XX @@ | ||
96 | #define ZLIB_CONST | ||
97 | #include <zlib.h> | ||
98 | |||
99 | +#ifdef CONFIG_ZSTD | ||
100 | +#include <zstd.h> | ||
101 | +#include <zstd_errors.h> | ||
102 | +#endif | ||
103 | + | ||
104 | #include "qcow2.h" | ||
105 | #include "block/thread-pool.h" | ||
106 | #include "crypto.h" | ||
107 | @@ -XXX,XX +XXX,XX @@ static ssize_t qcow2_zlib_decompress(void *dest, size_t dest_size, | ||
80 | return ret; | 108 | return ret; |
81 | } | 109 | } |
82 | 110 | ||
111 | +#ifdef CONFIG_ZSTD | ||
112 | + | ||
83 | +/* | 113 | +/* |
84 | + * Help alignment probing by allocating the first block. | 114 | + * qcow2_zstd_compress() |
85 | + * | 115 | + * |
86 | + * When reading with direct I/O from unallocated area on Gluster backed by XFS, | 116 | + * Compress @src_size bytes of data using zstd compression method |
87 | + * reading succeeds regardless of request length. In this case we fallback to | 117 | + * |
88 | + * safe alignment which is not optimal. Allocating the first block avoids this | 118 | + * @dest - destination buffer, @dest_size bytes |
89 | + * fallback. | 119 | + * @src - source buffer, @src_size bytes |
90 | + * | 120 | + * |
91 | + * fd may be opened with O_DIRECT, but we don't know the buffer alignment or | 121 | + * Returns: compressed size on success |
92 | + * request alignment, so we use safe values. | 122 | + * -ENOMEM destination buffer is not enough to store compressed data |
93 | + * | 123 | + * -EIO on any other error |
94 | + * Returns: 0 on success, -errno on failure. Since this is an optimization, | ||
95 | + * caller may ignore failures. | ||
96 | + */ | 124 | + */ |
97 | +static int allocate_first_block(int fd, size_t max_size) | 125 | +static ssize_t qcow2_zstd_compress(void *dest, size_t dest_size, |
126 | + const void *src, size_t src_size) | ||
98 | +{ | 127 | +{ |
99 | + size_t write_size = (max_size < MAX_BLOCKSIZE) | 128 | + ssize_t ret; |
100 | + ? BDRV_SECTOR_SIZE | 129 | + size_t zstd_ret; |
101 | + : MAX_BLOCKSIZE; | 130 | + ZSTD_outBuffer output = { |
102 | + size_t max_align = MAX(MAX_BLOCKSIZE, getpagesize()); | 131 | + .dst = dest, |
103 | + void *buf; | 132 | + .size = dest_size, |
104 | + ssize_t n; | 133 | + .pos = 0 |
105 | + int ret; | 134 | + }; |
106 | + | 135 | + ZSTD_inBuffer input = { |
107 | + buf = qemu_memalign(max_align, write_size); | 136 | + .src = src, |
108 | + memset(buf, 0, write_size); | 137 | + .size = src_size, |
109 | + | 138 | + .pos = 0 |
110 | + do { | 139 | + }; |
111 | + n = pwrite(fd, buf, write_size, 0); | 140 | + ZSTD_CCtx *cctx = ZSTD_createCCtx(); |
112 | + } while (n == -1 && errno == EINTR); | 141 | + |
113 | + | 142 | + if (!cctx) { |
114 | + ret = (n == -1) ? -errno : 0; | 143 | + return -EIO; |
115 | + | 144 | + } |
116 | + qemu_vfree(buf); | 145 | + /* |
146 | + * Use the zstd streamed interface for symmetry with decompression, | ||
147 | + * where streaming is essential since we don't record the exact | ||
148 | + * compressed size. | ||
149 | + * | ||
150 | + * ZSTD_compressStream2() tries to compress everything it could | ||
151 | + * with a single call. Although, ZSTD docs says that: | ||
152 | + * "You must continue calling ZSTD_compressStream2() with ZSTD_e_end | ||
153 | + * until it returns 0, at which point you are free to start a new frame", | ||
154 | + * in out tests we saw the only case when it returned with >0 - | ||
155 | + * when the output buffer was too small. In that case, | ||
156 | + * ZSTD_compressStream2() expects a bigger buffer on the next call. | ||
157 | + * We can't provide a bigger buffer because we are limited with dest_size | ||
158 | + * which we pass to the ZSTD_compressStream2() at once. | ||
159 | + * So, we don't need any loops and just abort the compression when we | ||
160 | + * don't get 0 result on the first call. | ||
161 | + */ | ||
162 | + zstd_ret = ZSTD_compressStream2(cctx, &output, &input, ZSTD_e_end); | ||
163 | + | ||
164 | + if (zstd_ret) { | ||
165 | + if (zstd_ret > output.size - output.pos) { | ||
166 | + ret = -ENOMEM; | ||
167 | + } else { | ||
168 | + ret = -EIO; | ||
169 | + } | ||
170 | + goto out; | ||
171 | + } | ||
172 | + | ||
173 | + /* make sure that zstd didn't overflow the dest buffer */ | ||
174 | + assert(output.pos <= dest_size); | ||
175 | + ret = output.pos; | ||
176 | +out: | ||
177 | + ZSTD_freeCCtx(cctx); | ||
117 | + return ret; | 178 | + return ret; |
118 | +} | 179 | +} |
119 | + | 180 | + |
120 | static int handle_aiocb_truncate(void *opaque) | 181 | +/* |
182 | + * qcow2_zstd_decompress() | ||
183 | + * | ||
184 | + * Decompress some data (not more than @src_size bytes) to produce exactly | ||
185 | + * @dest_size bytes using zstd compression method | ||
186 | + * | ||
187 | + * @dest - destination buffer, @dest_size bytes | ||
188 | + * @src - source buffer, @src_size bytes | ||
189 | + * | ||
190 | + * Returns: 0 on success | ||
191 | + * -EIO on any error | ||
192 | + */ | ||
193 | +static ssize_t qcow2_zstd_decompress(void *dest, size_t dest_size, | ||
194 | + const void *src, size_t src_size) | ||
195 | +{ | ||
196 | + size_t zstd_ret = 0; | ||
197 | + ssize_t ret = 0; | ||
198 | + ZSTD_outBuffer output = { | ||
199 | + .dst = dest, | ||
200 | + .size = dest_size, | ||
201 | + .pos = 0 | ||
202 | + }; | ||
203 | + ZSTD_inBuffer input = { | ||
204 | + .src = src, | ||
205 | + .size = src_size, | ||
206 | + .pos = 0 | ||
207 | + }; | ||
208 | + ZSTD_DCtx *dctx = ZSTD_createDCtx(); | ||
209 | + | ||
210 | + if (!dctx) { | ||
211 | + return -EIO; | ||
212 | + } | ||
213 | + | ||
214 | + /* | ||
215 | + * The compressed stream from the input buffer may consist of more | ||
216 | + * than one zstd frame. So we iterate until we get a fully | ||
217 | + * uncompressed cluster. | ||
218 | + * From zstd docs related to ZSTD_decompressStream: | ||
219 | + * "return : 0 when a frame is completely decoded and fully flushed" | ||
220 | + * We suppose that this means: each time ZSTD_decompressStream reads | ||
221 | + * only ONE full frame and returns 0 if and only if that frame | ||
222 | + * is completely decoded and flushed. Only after returning 0, | ||
223 | + * ZSTD_decompressStream reads another ONE full frame. | ||
224 | + */ | ||
225 | + while (output.pos < output.size) { | ||
226 | + size_t last_in_pos = input.pos; | ||
227 | + size_t last_out_pos = output.pos; | ||
228 | + zstd_ret = ZSTD_decompressStream(dctx, &output, &input); | ||
229 | + | ||
230 | + if (ZSTD_isError(zstd_ret)) { | ||
231 | + ret = -EIO; | ||
232 | + break; | ||
233 | + } | ||
234 | + | ||
235 | + /* | ||
236 | + * The ZSTD manual is vague about what to do if it reads | ||
237 | + * the buffer partially, and we don't want to get stuck | ||
238 | + * in an infinite loop where ZSTD_decompressStream | ||
239 | + * returns > 0 waiting for another input chunk. So, we add | ||
240 | + * a check which ensures that the loop makes some progress | ||
241 | + * on each step. | ||
242 | + */ | ||
243 | + if (last_in_pos >= input.pos && | ||
244 | + last_out_pos >= output.pos) { | ||
245 | + ret = -EIO; | ||
246 | + break; | ||
247 | + } | ||
248 | + } | ||
249 | + /* | ||
250 | + * Make sure that we have the frame fully flushed here | ||
251 | + * if not, we somehow managed to get uncompressed cluster | ||
252 | + * greater then the cluster size, possibly because of its | ||
253 | + * damage. | ||
254 | + */ | ||
255 | + if (zstd_ret > 0) { | ||
256 | + ret = -EIO; | ||
257 | + } | ||
258 | + | ||
259 | + ZSTD_freeDCtx(dctx); | ||
260 | + assert(ret == 0 || ret == -EIO); | ||
261 | + return ret; | ||
262 | +} | ||
263 | +#endif | ||
264 | + | ||
265 | static int qcow2_compress_pool_func(void *opaque) | ||
121 | { | 266 | { |
122 | RawPosixAIOData *aiocb = opaque; | 267 | Qcow2CompressData *data = opaque; |
123 | @@ -XXX,XX +XXX,XX @@ static int handle_aiocb_truncate(void *opaque) | 268 | @@ -XXX,XX +XXX,XX @@ qcow2_co_compress(BlockDriverState *bs, void *dest, size_t dest_size, |
124 | /* posix_fallocate() doesn't set errno. */ | 269 | fn = qcow2_zlib_compress; |
125 | error_setg_errno(errp, -result, | 270 | break; |
126 | "Could not preallocate new data"); | 271 | |
127 | + } else if (current_length == 0) { | 272 | +#ifdef CONFIG_ZSTD |
128 | + /* | 273 | + case QCOW2_COMPRESSION_TYPE_ZSTD: |
129 | + * posix_fallocate() uses fallocate() if the filesystem | 274 | + fn = qcow2_zstd_compress; |
130 | + * supports it, or fallback to manually writing zeroes. If | 275 | + break; |
131 | + * fallocate() was used, unaligned reads from the fallocated | 276 | +#endif |
132 | + * area in raw_probe_alignment() will succeed, hence we need to | 277 | default: |
133 | + * allocate the first block. | 278 | abort(); |
134 | + * | 279 | } |
135 | + * Optimize future alignment probing; ignore failures. | 280 | @@ -XXX,XX +XXX,XX @@ qcow2_co_decompress(BlockDriverState *bs, void *dest, size_t dest_size, |
136 | + */ | 281 | fn = qcow2_zlib_decompress; |
137 | + allocate_first_block(fd, offset); | 282 | break; |
138 | } | 283 | |
139 | } else { | 284 | +#ifdef CONFIG_ZSTD |
140 | result = 0; | 285 | + case QCOW2_COMPRESSION_TYPE_ZSTD: |
141 | @@ -XXX,XX +XXX,XX @@ static int handle_aiocb_truncate(void *opaque) | 286 | + fn = qcow2_zstd_decompress; |
142 | if (ftruncate(fd, offset) != 0) { | 287 | + break; |
143 | result = -errno; | 288 | +#endif |
144 | error_setg_errno(errp, -result, "Could not resize file"); | 289 | default: |
145 | + } else if (current_length == 0 && offset > current_length) { | 290 | abort(); |
146 | + /* Optimize future alignment probing; ignore failures. */ | 291 | } |
147 | + allocate_first_block(fd, offset); | 292 | diff --git a/block/qcow2.c b/block/qcow2.c |
293 | index XXXXXXX..XXXXXXX 100644 | ||
294 | --- a/block/qcow2.c | ||
295 | +++ b/block/qcow2.c | ||
296 | @@ -XXX,XX +XXX,XX @@ static int validate_compression_type(BDRVQcow2State *s, Error **errp) | ||
297 | { | ||
298 | switch (s->compression_type) { | ||
299 | case QCOW2_COMPRESSION_TYPE_ZLIB: | ||
300 | +#ifdef CONFIG_ZSTD | ||
301 | + case QCOW2_COMPRESSION_TYPE_ZSTD: | ||
302 | +#endif | ||
303 | break; | ||
304 | |||
305 | default: | ||
306 | @@ -XXX,XX +XXX,XX @@ qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp) | ||
148 | } | 307 | } |
149 | return result; | 308 | |
150 | default: | 309 | switch (qcow2_opts->compression_type) { |
151 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | 310 | +#ifdef CONFIG_ZSTD |
152 | index XXXXXXX..XXXXXXX 100644 | 311 | + case QCOW2_COMPRESSION_TYPE_ZSTD: |
153 | --- a/tests/qemu-iotests/059.out | 312 | + break; |
154 | +++ b/tests/qemu-iotests/059.out | 313 | +#endif |
155 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 subformat=twoGbMax | 314 | default: |
156 | image: TEST_DIR/t.vmdk | 315 | error_setg(errp, "Unknown compression type"); |
157 | file format: vmdk | 316 | goto out; |
158 | virtual size: 0.977 TiB (1073741824000 bytes) | ||
159 | -disk size: 16 KiB | ||
160 | +disk size: 1.97 MiB | ||
161 | Format specific information: | ||
162 | cid: XXXXXXXX | ||
163 | parent cid: XXXXXXXX | ||
164 | diff --git a/tests/qemu-iotests/150.out b/tests/qemu-iotests/150.out.qcow2 | ||
165 | similarity index 100% | ||
166 | rename from tests/qemu-iotests/150.out | ||
167 | rename to tests/qemu-iotests/150.out.qcow2 | ||
168 | diff --git a/tests/qemu-iotests/150.out.raw b/tests/qemu-iotests/150.out.raw | ||
169 | new file mode 100644 | ||
170 | index XXXXXXX..XXXXXXX | ||
171 | --- /dev/null | ||
172 | +++ b/tests/qemu-iotests/150.out.raw | ||
173 | @@ -XXX,XX +XXX,XX @@ | ||
174 | +QA output created by 150 | ||
175 | + | ||
176 | +=== Mapping sparse conversion === | ||
177 | + | ||
178 | +Offset Length File | ||
179 | +0 0x1000 TEST_DIR/t.IMGFMT | ||
180 | + | ||
181 | +=== Mapping non-sparse conversion === | ||
182 | + | ||
183 | +Offset Length File | ||
184 | +0 0x100000 TEST_DIR/t.IMGFMT | ||
185 | +*** done | ||
186 | diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175 | ||
187 | index XXXXXXX..XXXXXXX 100755 | ||
188 | --- a/tests/qemu-iotests/175 | ||
189 | +++ b/tests/qemu-iotests/175 | ||
190 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
191 | # the file size. This function hides the resulting difference in the | ||
192 | # stat -c '%b' output. | ||
193 | # Parameter 1: Number of blocks an empty file occupies | ||
194 | -# Parameter 2: Image size in bytes | ||
195 | +# Parameter 2: Minimal number of blocks in an image | ||
196 | +# Parameter 3: Image size in bytes | ||
197 | _filter_blocks() | ||
198 | { | ||
199 | extra_blocks=$1 | ||
200 | - img_size=$2 | ||
201 | + min_blocks=$2 | ||
202 | + img_size=$3 | ||
203 | |||
204 | - sed -e "s/blocks=$extra_blocks\\(\$\\|[^0-9]\\)/nothing allocated/" \ | ||
205 | - -e "s/blocks=$((extra_blocks + img_size / 512))\\(\$\\|[^0-9]\\)/everything allocated/" | ||
206 | + sed -e "s/blocks=$min_blocks\\(\$\\|[^0-9]\\)/min allocation/" \ | ||
207 | + -e "s/blocks=$((extra_blocks + img_size / 512))\\(\$\\|[^0-9]\\)/max allocation/" | ||
208 | } | ||
209 | |||
210 | # get standard environment, filters and checks | ||
211 | @@ -XXX,XX +XXX,XX @@ size=$((1 * 1024 * 1024)) | ||
212 | touch "$TEST_DIR/empty" | ||
213 | extra_blocks=$(stat -c '%b' "$TEST_DIR/empty") | ||
214 | |||
215 | +# We always write the first byte; check how many blocks this filesystem | ||
216 | +# allocates to match empty image alloation. | ||
217 | +printf "\0" > "$TEST_DIR/empty" | ||
218 | +min_blocks=$(stat -c '%b' "$TEST_DIR/empty") | ||
219 | + | ||
220 | echo | ||
221 | echo "== creating image with default preallocation ==" | ||
222 | _make_test_img $size | _filter_imgfmt | ||
223 | -stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $size | ||
224 | +stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size | ||
225 | |||
226 | for mode in off full falloc; do | ||
227 | echo | ||
228 | echo "== creating image with preallocation $mode ==" | ||
229 | IMGOPTS=preallocation=$mode _make_test_img $size | _filter_imgfmt | ||
230 | - stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $size | ||
231 | + stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size | ||
232 | done | ||
233 | |||
234 | # success, all done | ||
235 | diff --git a/tests/qemu-iotests/175.out b/tests/qemu-iotests/175.out | ||
236 | index XXXXXXX..XXXXXXX 100644 | ||
237 | --- a/tests/qemu-iotests/175.out | ||
238 | +++ b/tests/qemu-iotests/175.out | ||
239 | @@ -XXX,XX +XXX,XX @@ QA output created by 175 | ||
240 | |||
241 | == creating image with default preallocation == | ||
242 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 | ||
243 | -size=1048576, nothing allocated | ||
244 | +size=1048576, min allocation | ||
245 | |||
246 | == creating image with preallocation off == | ||
247 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off | ||
248 | -size=1048576, nothing allocated | ||
249 | +size=1048576, min allocation | ||
250 | |||
251 | == creating image with preallocation full == | ||
252 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full | ||
253 | -size=1048576, everything allocated | ||
254 | +size=1048576, max allocation | ||
255 | |||
256 | == creating image with preallocation falloc == | ||
257 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=falloc | ||
258 | -size=1048576, everything allocated | ||
259 | +size=1048576, max allocation | ||
260 | *** done | ||
261 | diff --git a/tests/qemu-iotests/178.out.qcow2 b/tests/qemu-iotests/178.out.qcow2 | ||
262 | index XXXXXXX..XXXXXXX 100644 | ||
263 | --- a/tests/qemu-iotests/178.out.qcow2 | ||
264 | +++ b/tests/qemu-iotests/178.out.qcow2 | ||
265 | @@ -XXX,XX +XXX,XX @@ converted image file size in bytes: 196608 | ||
266 | == raw input image with data (human) == | ||
267 | |||
268 | Formatting 'TEST_DIR/t.qcow2', fmt=IMGFMT size=1073741824 | ||
269 | -required size: 393216 | ||
270 | +required size: 458752 | ||
271 | fully allocated size: 1074135040 | ||
272 | wrote 512/512 bytes at offset 512 | ||
273 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
274 | @@ -XXX,XX +XXX,XX @@ converted image file size in bytes: 196608 | ||
275 | |||
276 | Formatting 'TEST_DIR/t.qcow2', fmt=IMGFMT size=1073741824 | ||
277 | { | ||
278 | - "required": 393216, | ||
279 | + "required": 458752, | ||
280 | "fully-allocated": 1074135040 | ||
281 | } | ||
282 | wrote 512/512 bytes at offset 512 | ||
283 | diff --git a/tests/qemu-iotests/221.out b/tests/qemu-iotests/221.out | ||
284 | index XXXXXXX..XXXXXXX 100644 | ||
285 | --- a/tests/qemu-iotests/221.out | ||
286 | +++ b/tests/qemu-iotests/221.out | ||
287 | @@ -XXX,XX +XXX,XX @@ QA output created by 221 | ||
288 | === Check mapping of unaligned raw image === | ||
289 | |||
290 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65537 | ||
291 | -[{ "start": 0, "length": 66048, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
292 | -[{ "start": 0, "length": 66048, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
293 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
294 | +{ "start": 4096, "length": 61952, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
295 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
296 | +{ "start": 4096, "length": 61952, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
297 | wrote 1/1 bytes at offset 65536 | ||
298 | 1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
299 | -[{ "start": 0, "length": 65536, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
300 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
301 | +{ "start": 4096, "length": 61440, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
302 | { "start": 65536, "length": 1, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
303 | { "start": 65537, "length": 511, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
304 | -[{ "start": 0, "length": 65536, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
305 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
306 | +{ "start": 4096, "length": 61440, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
307 | { "start": 65536, "length": 1, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
308 | { "start": 65537, "length": 511, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
309 | *** done | ||
310 | diff --git a/tests/qemu-iotests/253.out b/tests/qemu-iotests/253.out | ||
311 | index XXXXXXX..XXXXXXX 100644 | ||
312 | --- a/tests/qemu-iotests/253.out | ||
313 | +++ b/tests/qemu-iotests/253.out | ||
314 | @@ -XXX,XX +XXX,XX @@ QA output created by 253 | ||
315 | === Check mapping of unaligned raw image === | ||
316 | |||
317 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048575 | ||
318 | -[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
319 | -[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
320 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
321 | +{ "start": 4096, "length": 1044480, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
322 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
323 | +{ "start": 4096, "length": 1044480, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
324 | wrote 65535/65535 bytes at offset 983040 | ||
325 | 63.999 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
326 | -[{ "start": 0, "length": 983040, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
327 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
328 | +{ "start": 4096, "length": 978944, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
329 | { "start": 983040, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": OFFSET}] | ||
330 | -[{ "start": 0, "length": 983040, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
331 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
332 | +{ "start": 4096, "length": 978944, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
333 | { "start": 983040, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": OFFSET}] | ||
334 | *** done | ||
335 | -- | 317 | -- |
336 | 2.21.0 | 318 | 2.26.2 |
337 | 319 | ||
338 | 320 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Denis Plotnikov <dplotnikov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | The sanitizers (especially the address sanitizer from Clang) are | 3 | The test checks fulfilling qcow2 requirements for the compression |
4 | sometimes printing out warnings or false positives - this spoils | 4 | type feature and zstd compression type operability. |
5 | the output of the iotests, causing some of the tests to fail. | 5 | |
6 | Thus let's skip the automatic iotests during "make check" when the | 6 | Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com> |
7 | user configured QEMU with --enable-sanitizers. | 7 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
8 | 8 | Tested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | |
9 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 9 | Reviewed-by: Eric Blake <eblake@redhat.com> |
10 | Message-id: 20190823084203.29734-1-thuth@redhat.com | 10 | Message-Id: <20200507082521.29210-5-dplotnikov@virtuozzo.com> |
11 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 11 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
12 | --- | 12 | --- |
13 | tests/check-block.sh | 5 +++++ | 13 | tests/qemu-iotests/287 | 152 +++++++++++++++++++++++++++++++++++++ |
14 | 1 file changed, 5 insertions(+) | 14 | tests/qemu-iotests/287.out | 67 ++++++++++++++++ |
15 | 15 | tests/qemu-iotests/group | 1 + | |
16 | diff --git a/tests/check-block.sh b/tests/check-block.sh | 16 | 3 files changed, 220 insertions(+) |
17 | index XXXXXXX..XXXXXXX 100755 | 17 | create mode 100755 tests/qemu-iotests/287 |
18 | --- a/tests/check-block.sh | 18 | create mode 100644 tests/qemu-iotests/287.out |
19 | +++ b/tests/check-block.sh | 19 | |
20 | @@ -XXX,XX +XXX,XX @@ if grep -q "TARGET_GPROF=y" *-softmmu/config-target.mak 2>/dev/null ; then | 20 | diff --git a/tests/qemu-iotests/287 b/tests/qemu-iotests/287 |
21 | exit 0 | 21 | new file mode 100755 |
22 | fi | 22 | index XXXXXXX..XXXXXXX |
23 | 23 | --- /dev/null | |
24 | +if grep -q "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null ; then | 24 | +++ b/tests/qemu-iotests/287 |
25 | + echo "Sanitizers are enabled ==> Not running the qemu-iotests." | 25 | @@ -XXX,XX +XXX,XX @@ |
26 | + exit 0 | 26 | +#!/usr/bin/env bash |
27 | +# | ||
28 | +# Test case for an image using zstd compression | ||
29 | +# | ||
30 | +# Copyright (c) 2020 Virtuozzo International GmbH | ||
31 | +# | ||
32 | +# This program is free software; you can redistribute it and/or modify | ||
33 | +# it under the terms of the GNU General Public License as published by | ||
34 | +# the Free Software Foundation; either version 2 of the License, or | ||
35 | +# (at your option) any later version. | ||
36 | +# | ||
37 | +# This program is distributed in the hope that it will be useful, | ||
38 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
39 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
40 | +# GNU General Public License for more details. | ||
41 | +# | ||
42 | +# You should have received a copy of the GNU General Public License | ||
43 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
44 | +# | ||
45 | + | ||
46 | +# creator | ||
47 | +owner=dplotnikov@virtuozzo.com | ||
48 | + | ||
49 | +seq="$(basename $0)" | ||
50 | +echo "QA output created by $seq" | ||
51 | + | ||
52 | +status=1 # failure is the default! | ||
53 | + | ||
54 | +# standard environment | ||
55 | +. ./common.rc | ||
56 | +. ./common.filter | ||
57 | + | ||
58 | +# This tests qocw2-specific low-level functionality | ||
59 | +_supported_fmt qcow2 | ||
60 | +_supported_proto file | ||
61 | +_supported_os Linux | ||
62 | +_unsupported_imgopts 'compat=0.10' data_file | ||
63 | + | ||
64 | +COMPR_IMG="$TEST_IMG.compressed" | ||
65 | +RAND_FILE="$TEST_DIR/rand_data" | ||
66 | + | ||
67 | +_cleanup() | ||
68 | +{ | ||
69 | + _cleanup_test_img | ||
70 | + _rm_test_img "$COMPR_IMG" | ||
71 | + rm -f "$RAND_FILE" | ||
72 | +} | ||
73 | +trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
74 | + | ||
75 | +# for all the cases | ||
76 | +CLUSTER_SIZE=65536 | ||
77 | + | ||
78 | +# Check if we can run this test. | ||
79 | +if IMGOPTS='compression_type=zstd' _make_test_img 64M | | ||
80 | + grep "Invalid parameter 'zstd'"; then | ||
81 | + _notrun "ZSTD is disabled" | ||
27 | +fi | 82 | +fi |
28 | + | 83 | + |
29 | if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then | 84 | +echo |
30 | echo "No qemu-system binary available ==> Not running the qemu-iotests." | 85 | +echo "=== Testing compression type incompatible bit setting for zlib ===" |
31 | exit 0 | 86 | +echo |
87 | +_make_test_img -o compression_type=zlib 64M | ||
88 | +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features | ||
89 | + | ||
90 | +echo | ||
91 | +echo "=== Testing compression type incompatible bit setting for zstd ===" | ||
92 | +echo | ||
93 | +_make_test_img -o compression_type=zstd 64M | ||
94 | +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features | ||
95 | + | ||
96 | +echo | ||
97 | +echo "=== Testing zlib with incompatible bit set ===" | ||
98 | +echo | ||
99 | +_make_test_img -o compression_type=zlib 64M | ||
100 | +$PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 3 | ||
101 | +# to make sure the bit was actually set | ||
102 | +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features | ||
103 | + | ||
104 | +if $QEMU_IMG info "$TEST_IMG" >/dev/null 2>&1 ; then | ||
105 | + echo "Error: The image opened successfully. The image must not be opened." | ||
106 | +fi | ||
107 | + | ||
108 | +echo | ||
109 | +echo "=== Testing zstd with incompatible bit unset ===" | ||
110 | +echo | ||
111 | +_make_test_img -o compression_type=zstd 64M | ||
112 | +$PYTHON qcow2.py "$TEST_IMG" set-header incompatible_features 0 | ||
113 | +# to make sure the bit was actually unset | ||
114 | +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features | ||
115 | + | ||
116 | +if $QEMU_IMG info "$TEST_IMG" >/dev/null 2>&1 ; then | ||
117 | + echo "Error: The image opened successfully. The image must not be opened." | ||
118 | +fi | ||
119 | + | ||
120 | +echo | ||
121 | +echo "=== Testing compression type values ===" | ||
122 | +echo | ||
123 | +# zlib=0 | ||
124 | +_make_test_img -o compression_type=zlib 64M | ||
125 | +peek_file_be "$TEST_IMG" 104 1 | ||
126 | +echo | ||
127 | + | ||
128 | +# zstd=1 | ||
129 | +_make_test_img -o compression_type=zstd 64M | ||
130 | +peek_file_be "$TEST_IMG" 104 1 | ||
131 | +echo | ||
132 | + | ||
133 | +echo | ||
134 | +echo "=== Testing simple reading and writing with zstd ===" | ||
135 | +echo | ||
136 | +_make_test_img -o compression_type=zstd 64M | ||
137 | +$QEMU_IO -c "write -c -P 0xAC 64K 64K " "$TEST_IMG" | _filter_qemu_io | ||
138 | +$QEMU_IO -c "read -P 0xAC 64K 64K " "$TEST_IMG" | _filter_qemu_io | ||
139 | +# read on the cluster boundaries | ||
140 | +$QEMU_IO -c "read -v 131070 8 " "$TEST_IMG" | _filter_qemu_io | ||
141 | +$QEMU_IO -c "read -v 65534 8" "$TEST_IMG" | _filter_qemu_io | ||
142 | + | ||
143 | +echo | ||
144 | +echo "=== Testing adjacent clusters reading and writing with zstd ===" | ||
145 | +echo | ||
146 | +_make_test_img -o compression_type=zstd 64M | ||
147 | +$QEMU_IO -c "write -c -P 0xAB 0 64K " "$TEST_IMG" | _filter_qemu_io | ||
148 | +$QEMU_IO -c "write -c -P 0xAC 64K 64K " "$TEST_IMG" | _filter_qemu_io | ||
149 | +$QEMU_IO -c "write -c -P 0xAD 128K 64K " "$TEST_IMG" | _filter_qemu_io | ||
150 | + | ||
151 | +$QEMU_IO -c "read -P 0xAB 0 64k " "$TEST_IMG" | _filter_qemu_io | ||
152 | +$QEMU_IO -c "read -P 0xAC 64K 64k " "$TEST_IMG" | _filter_qemu_io | ||
153 | +$QEMU_IO -c "read -P 0xAD 128K 64k " "$TEST_IMG" | _filter_qemu_io | ||
154 | + | ||
155 | +echo | ||
156 | +echo "=== Testing incompressible cluster processing with zstd ===" | ||
157 | +echo | ||
158 | +# create a 2M image and fill it with 1M likely incompressible data | ||
159 | +# and 1M compressible data | ||
160 | +dd if=/dev/urandom of="$RAND_FILE" bs=1M count=1 seek=1 | ||
161 | +QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS_NO_FMT" \ | ||
162 | +$QEMU_IO -f raw -c "write -P 0xFA 0 1M" "$RAND_FILE" | _filter_qemu_io | ||
163 | + | ||
164 | +$QEMU_IMG convert -f raw -O $IMGFMT -c \ | ||
165 | +-o "$(_optstr_add "$IMGOPTS" "compression_type=zlib")" "$RAND_FILE" \ | ||
166 | +"$TEST_IMG" | _filter_qemu_io | ||
167 | + | ||
168 | +$QEMU_IMG convert -O $IMGFMT -c \ | ||
169 | +-o "$(_optstr_add "$IMGOPTS" "compression_type=zstd")" "$TEST_IMG" \ | ||
170 | +"$COMPR_IMG" | _filter_qemu_io | ||
171 | + | ||
172 | +$QEMU_IMG compare "$TEST_IMG" "$COMPR_IMG" | ||
173 | + | ||
174 | +# success, all done | ||
175 | +echo "*** done" | ||
176 | +rm -f $seq.full | ||
177 | +status=0 | ||
178 | diff --git a/tests/qemu-iotests/287.out b/tests/qemu-iotests/287.out | ||
179 | new file mode 100644 | ||
180 | index XXXXXXX..XXXXXXX | ||
181 | --- /dev/null | ||
182 | +++ b/tests/qemu-iotests/287.out | ||
183 | @@ -XXX,XX +XXX,XX @@ | ||
184 | +QA output created by 287 | ||
185 | + | ||
186 | +=== Testing compression type incompatible bit setting for zlib === | ||
187 | + | ||
188 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
189 | +incompatible_features [] | ||
190 | + | ||
191 | +=== Testing compression type incompatible bit setting for zstd === | ||
192 | + | ||
193 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
194 | +incompatible_features [3] | ||
195 | + | ||
196 | +=== Testing zlib with incompatible bit set === | ||
197 | + | ||
198 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
199 | +incompatible_features [3] | ||
200 | + | ||
201 | +=== Testing zstd with incompatible bit unset === | ||
202 | + | ||
203 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
204 | +incompatible_features [] | ||
205 | + | ||
206 | +=== Testing compression type values === | ||
207 | + | ||
208 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
209 | + 0 | ||
210 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
211 | + 1 | ||
212 | + | ||
213 | +=== Testing simple reading and writing with zstd === | ||
214 | + | ||
215 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
216 | +wrote 65536/65536 bytes at offset 65536 | ||
217 | +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
218 | +read 65536/65536 bytes at offset 65536 | ||
219 | +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
220 | +0001fffe: ac ac 00 00 00 00 00 00 ........ | ||
221 | +read 8/8 bytes at offset 131070 | ||
222 | +8 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
223 | +0000fffe: 00 00 ac ac ac ac ac ac ........ | ||
224 | +read 8/8 bytes at offset 65534 | ||
225 | +8 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
226 | + | ||
227 | +=== Testing adjacent clusters reading and writing with zstd === | ||
228 | + | ||
229 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
230 | +wrote 65536/65536 bytes at offset 0 | ||
231 | +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
232 | +wrote 65536/65536 bytes at offset 65536 | ||
233 | +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
234 | +wrote 65536/65536 bytes at offset 131072 | ||
235 | +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
236 | +read 65536/65536 bytes at offset 0 | ||
237 | +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
238 | +read 65536/65536 bytes at offset 65536 | ||
239 | +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
240 | +read 65536/65536 bytes at offset 131072 | ||
241 | +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
242 | + | ||
243 | +=== Testing incompressible cluster processing with zstd === | ||
244 | + | ||
245 | +1+0 records in | ||
246 | +1+0 records out | ||
247 | +wrote 1048576/1048576 bytes at offset 0 | ||
248 | +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
249 | +Images are identical. | ||
250 | +*** done | ||
251 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group | ||
252 | index XXXXXXX..XXXXXXX 100644 | ||
253 | --- a/tests/qemu-iotests/group | ||
254 | +++ b/tests/qemu-iotests/group | ||
255 | @@ -XXX,XX +XXX,XX @@ | ||
256 | 283 auto quick | ||
257 | 284 rw | ||
258 | 286 rw quick | ||
259 | +287 auto quick | ||
260 | 288 quick | ||
261 | 289 rw quick | ||
262 | 290 rw auto quick | ||
32 | -- | 263 | -- |
33 | 2.21.0 | 264 | 2.26.2 |
34 | 265 | ||
35 | 266 | diff view generated by jsdifflib |
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | It's wrong to OR shared permissions. It may lead to crash on further | 3 | Obviously, we should g_free the task after trace point and offset |
4 | permission updates. | 4 | update. |
5 | Also, no needs to consider previously calculated permissions, as at | ||
6 | this point we already bind all new parents and bdrv_get_cumulative_perm | ||
7 | result is enough. So fix the bug by just set permissions by | ||
8 | bdrv_get_cumulative_perm result. | ||
9 | 5 | ||
10 | Bug was introduced in long ago 234ac1a9025, in 2.9. | 6 | Reported-by: Coverity (CID 1428756) |
11 | 7 | Fixes: 4ce5dd3e9b5ee0fac18625860eb3727399ee965e | |
12 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 8 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
13 | Message-id: 20190824100740.61635-1-vsementsov@virtuozzo.com | 9 | Message-Id: <20200507183800.22626-1-vsementsov@virtuozzo.com> |
10 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
14 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 11 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
15 | --- | 12 | --- |
16 | block.c | 5 ++--- | 13 | block/block-copy.c | 2 +- |
17 | 1 file changed, 2 insertions(+), 3 deletions(-) | 14 | 1 file changed, 1 insertion(+), 1 deletion(-) |
18 | 15 | ||
19 | diff --git a/block.c b/block.c | 16 | diff --git a/block/block-copy.c b/block/block-copy.c |
20 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/block.c | 18 | --- a/block/block-copy.c |
22 | +++ b/block.c | 19 | +++ b/block/block-copy.c |
23 | @@ -XXX,XX +XXX,XX @@ void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to, | 20 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn block_copy_dirty_clusters(BlockCopyState *s, |
24 | { | 21 | } |
25 | BdrvChild *c, *next; | 22 | if (s->skip_unallocated && !(ret & BDRV_BLOCK_ALLOCATED)) { |
26 | GSList *list = NULL, *p; | 23 | block_copy_task_end(task, 0); |
27 | - uint64_t old_perm, old_shared; | 24 | - g_free(task); |
28 | uint64_t perm = 0, shared = BLK_PERM_ALL; | 25 | progress_set_remaining(s->progress, |
29 | int ret; | 26 | bdrv_get_dirty_count(s->copy_bitmap) + |
30 | 27 | s->in_flight_bytes); | |
31 | @@ -XXX,XX +XXX,XX @@ void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to, | 28 | trace_block_copy_skip_range(s, task->offset, task->bytes); |
32 | bdrv_unref(from); | 29 | offset = task_end(task); |
33 | } | 30 | bytes = end - offset; |
34 | 31 | + g_free(task); | |
35 | - bdrv_get_cumulative_perm(to, &old_perm, &old_shared); | 32 | continue; |
36 | - bdrv_set_perm(to, old_perm | perm, old_shared | shared); | 33 | } |
37 | + bdrv_get_cumulative_perm(to, &perm, &shared); | 34 | task->zeroes = ret & BDRV_BLOCK_ZERO; |
38 | + bdrv_set_perm(to, perm, shared); | ||
39 | |||
40 | out: | ||
41 | g_slist_free(list); | ||
42 | -- | 35 | -- |
43 | 2.21.0 | 36 | 2.26.2 |
44 | 37 | ||
45 | 38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Nir Soffer <nirsof@gmail.com> | ||
2 | 1 | ||
3 | Using block_resize we can test allocate_first_block() with file | ||
4 | descriptor opened with O_DIRECT, ensuring that it works for any size | ||
5 | larger than 4096 bytes. | ||
6 | |||
7 | Testing smaller sizes is tricky as the result depends on the filesystem | ||
8 | used for testing. For example on NFS any size will work since O_DIRECT | ||
9 | does not require any alignment. | ||
10 | |||
11 | Signed-off-by: Nir Soffer <nsoffer@redhat.com> | ||
12 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
13 | Message-id: 20190827010528.8818-3-nsoffer@redhat.com | ||
14 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
15 | --- | ||
16 | tests/qemu-iotests/175 | 28 ++++++++++++++++++++++++++++ | ||
17 | tests/qemu-iotests/175.out | 8 ++++++++ | ||
18 | 2 files changed, 36 insertions(+) | ||
19 | |||
20 | diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175 | ||
21 | index XXXXXXX..XXXXXXX 100755 | ||
22 | --- a/tests/qemu-iotests/175 | ||
23 | +++ b/tests/qemu-iotests/175 | ||
24 | @@ -XXX,XX +XXX,XX @@ _filter_blocks() | ||
25 | -e "s/blocks=$((extra_blocks + img_size / 512))\\(\$\\|[^0-9]\\)/max allocation/" | ||
26 | } | ||
27 | |||
28 | +# Resize image using block_resize. | ||
29 | +# Parameter 1: image path | ||
30 | +# Parameter 2: new size | ||
31 | +_block_resize() | ||
32 | +{ | ||
33 | + local path=$1 | ||
34 | + local size=$2 | ||
35 | + | ||
36 | + $QEMU -qmp stdio -nographic -nodefaults \ | ||
37 | + -blockdev file,node-name=file,filename=$path,cache.direct=on \ | ||
38 | + <<EOF | ||
39 | +{'execute': 'qmp_capabilities'} | ||
40 | +{'execute': 'block_resize', 'arguments': {'node-name': 'file', 'size': $size}} | ||
41 | +{'execute': 'quit'} | ||
42 | +EOF | ||
43 | +} | ||
44 | + | ||
45 | # get standard environment, filters and checks | ||
46 | . ./common.rc | ||
47 | . ./common.filter | ||
48 | @@ -XXX,XX +XXX,XX @@ _supported_fmt raw | ||
49 | _supported_proto file | ||
50 | _supported_os Linux | ||
51 | |||
52 | +_default_cache_mode none | ||
53 | +_supported_cache_modes none directsync | ||
54 | + | ||
55 | size=$((1 * 1024 * 1024)) | ||
56 | |||
57 | touch "$TEST_DIR/empty" | ||
58 | @@ -XXX,XX +XXX,XX @@ for mode in off full falloc; do | ||
59 | stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size | ||
60 | done | ||
61 | |||
62 | +for new_size in 4096 1048576; do | ||
63 | + echo | ||
64 | + echo "== resize empty image with block_resize ==" | ||
65 | + _make_test_img 0 | _filter_imgfmt | ||
66 | + _block_resize $TEST_IMG $new_size >/dev/null | ||
67 | + stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $new_size | ||
68 | +done | ||
69 | + | ||
70 | # success, all done | ||
71 | echo "*** done" | ||
72 | rm -f $seq.full | ||
73 | diff --git a/tests/qemu-iotests/175.out b/tests/qemu-iotests/175.out | ||
74 | index XXXXXXX..XXXXXXX 100644 | ||
75 | --- a/tests/qemu-iotests/175.out | ||
76 | +++ b/tests/qemu-iotests/175.out | ||
77 | @@ -XXX,XX +XXX,XX @@ size=1048576, max allocation | ||
78 | == creating image with preallocation falloc == | ||
79 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=falloc | ||
80 | size=1048576, max allocation | ||
81 | + | ||
82 | +== resize empty image with block_resize == | ||
83 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=0 | ||
84 | +size=4096, min allocation | ||
85 | + | ||
86 | +== resize empty image with block_resize == | ||
87 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=0 | ||
88 | +size=1048576, min allocation | ||
89 | *** done | ||
90 | -- | ||
91 | 2.21.0 | ||
92 | |||
93 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | This makes iotest 033 pass with e.g. subformat=monolithicFlat. It also | ||
2 | turns a former error in 059 into success. | ||
3 | 1 | ||
4 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
5 | Message-id: 20190815153638.4600-3-mreitz@redhat.com | ||
6 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
7 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
8 | --- | ||
9 | block/vmdk.c | 54 ++++++++++++++++++++++++-------------- | ||
10 | tests/qemu-iotests/059 | 7 +++-- | ||
11 | tests/qemu-iotests/059.out | 4 ++- | ||
12 | 3 files changed, 42 insertions(+), 23 deletions(-) | ||
13 | |||
14 | diff --git a/block/vmdk.c b/block/vmdk.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/block/vmdk.c | ||
17 | +++ b/block/vmdk.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static const char *next_line(const char *s) | ||
19 | } | ||
20 | |||
21 | static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | ||
22 | - const char *desc_file_path, QDict *options, | ||
23 | - Error **errp) | ||
24 | + QDict *options, Error **errp) | ||
25 | { | ||
26 | int ret; | ||
27 | int matches; | ||
28 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | ||
29 | const char *p, *np; | ||
30 | int64_t sectors = 0; | ||
31 | int64_t flat_offset; | ||
32 | + char *desc_file_dir = NULL; | ||
33 | char *extent_path; | ||
34 | BdrvChild *extent_file; | ||
35 | BDRVVmdkState *s = bs->opaque; | ||
36 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | ||
37 | continue; | ||
38 | } | ||
39 | |||
40 | - if (!path_is_absolute(fname) && !path_has_protocol(fname) && | ||
41 | - !desc_file_path[0]) | ||
42 | - { | ||
43 | - bdrv_refresh_filename(bs->file->bs); | ||
44 | - error_setg(errp, "Cannot use relative extent paths with VMDK " | ||
45 | - "descriptor file '%s'", bs->file->bs->filename); | ||
46 | - return -EINVAL; | ||
47 | - } | ||
48 | + if (path_is_absolute(fname)) { | ||
49 | + extent_path = g_strdup(fname); | ||
50 | + } else { | ||
51 | + if (!desc_file_dir) { | ||
52 | + desc_file_dir = bdrv_dirname(bs->file->bs, errp); | ||
53 | + if (!desc_file_dir) { | ||
54 | + bdrv_refresh_filename(bs->file->bs); | ||
55 | + error_prepend(errp, "Cannot use relative paths with VMDK " | ||
56 | + "descriptor file '%s': ", | ||
57 | + bs->file->bs->filename); | ||
58 | + ret = -EINVAL; | ||
59 | + goto out; | ||
60 | + } | ||
61 | + } | ||
62 | |||
63 | - extent_path = path_combine(desc_file_path, fname); | ||
64 | + extent_path = g_strconcat(desc_file_dir, fname, NULL); | ||
65 | + } | ||
66 | |||
67 | ret = snprintf(extent_opt_prefix, 32, "extents.%d", s->num_extents); | ||
68 | assert(ret < 32); | ||
69 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | ||
70 | g_free(extent_path); | ||
71 | if (local_err) { | ||
72 | error_propagate(errp, local_err); | ||
73 | - return -EINVAL; | ||
74 | + ret = -EINVAL; | ||
75 | + goto out; | ||
76 | } | ||
77 | |||
78 | /* save to extents array */ | ||
79 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | ||
80 | 0, 0, 0, 0, 0, &extent, errp); | ||
81 | if (ret < 0) { | ||
82 | bdrv_unref_child(bs, extent_file); | ||
83 | - return ret; | ||
84 | + goto out; | ||
85 | } | ||
86 | extent->flat_start_offset = flat_offset << 9; | ||
87 | } else if (!strcmp(type, "SPARSE") || !strcmp(type, "VMFSSPARSE")) { | ||
88 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | ||
89 | g_free(buf); | ||
90 | if (ret) { | ||
91 | bdrv_unref_child(bs, extent_file); | ||
92 | - return ret; | ||
93 | + goto out; | ||
94 | } | ||
95 | extent = &s->extents[s->num_extents - 1]; | ||
96 | } else if (!strcmp(type, "SESPARSE")) { | ||
97 | ret = vmdk_open_se_sparse(bs, extent_file, bs->open_flags, errp); | ||
98 | if (ret) { | ||
99 | bdrv_unref_child(bs, extent_file); | ||
100 | - return ret; | ||
101 | + goto out; | ||
102 | } | ||
103 | extent = &s->extents[s->num_extents - 1]; | ||
104 | } else { | ||
105 | error_setg(errp, "Unsupported extent type '%s'", type); | ||
106 | bdrv_unref_child(bs, extent_file); | ||
107 | - return -ENOTSUP; | ||
108 | + ret = -ENOTSUP; | ||
109 | + goto out; | ||
110 | } | ||
111 | extent->type = g_strdup(type); | ||
112 | } | ||
113 | - return 0; | ||
114 | + | ||
115 | + ret = 0; | ||
116 | + goto out; | ||
117 | |||
118 | invalid: | ||
119 | np = next_line(p); | ||
120 | @@ -XXX,XX +XXX,XX @@ invalid: | ||
121 | np--; | ||
122 | } | ||
123 | error_setg(errp, "Invalid extent line: %.*s", (int)(np - p), p); | ||
124 | - return -EINVAL; | ||
125 | + ret = -EINVAL; | ||
126 | + | ||
127 | +out: | ||
128 | + g_free(desc_file_dir); | ||
129 | + return ret; | ||
130 | } | ||
131 | |||
132 | static int vmdk_open_desc_file(BlockDriverState *bs, int flags, char *buf, | ||
133 | @@ -XXX,XX +XXX,XX @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags, char *buf, | ||
134 | } | ||
135 | s->create_type = g_strdup(ct); | ||
136 | s->desc_offset = 0; | ||
137 | - ret = vmdk_parse_extents(buf, bs, bs->file->bs->exact_filename, options, | ||
138 | - errp); | ||
139 | + ret = vmdk_parse_extents(buf, bs, options, errp); | ||
140 | exit: | ||
141 | return ret; | ||
142 | } | ||
143 | diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 | ||
144 | index XXXXXXX..XXXXXXX 100755 | ||
145 | --- a/tests/qemu-iotests/059 | ||
146 | +++ b/tests/qemu-iotests/059 | ||
147 | @@ -XXX,XX +XXX,XX @@ $QEMU_IMG convert -f qcow2 -O vmdk -o subformat=streamOptimized "$TEST_IMG.qcow2 | ||
148 | |||
149 | echo | ||
150 | echo "=== Testing monolithicFlat with internally generated JSON file name ===" | ||
151 | +# Should work, because bdrv_dirname() works fine with blkdebug | ||
152 | IMGOPTS="subformat=monolithicFlat" _make_test_img 64M | ||
153 | -$QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=read_aio" 2>&1 \ | ||
154 | - | _filter_testdir | _filter_imgfmt | ||
155 | +$QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=read_aio" \ | ||
156 | + -c info \ | ||
157 | + 2>&1 \ | ||
158 | + | _filter_testdir | _filter_imgfmt | _filter_img_info | ||
159 | _cleanup_test_img | ||
160 | |||
161 | echo | ||
162 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | ||
163 | index XXXXXXX..XXXXXXX 100644 | ||
164 | --- a/tests/qemu-iotests/059.out | ||
165 | +++ b/tests/qemu-iotests/059.out | ||
166 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 10240 | ||
167 | |||
168 | === Testing monolithicFlat with internally generated JSON file name === | ||
169 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
170 | -qemu-io: can't open: Cannot use relative extent paths with VMDK descriptor file 'json:{"image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "inject-error.0.event": "read_aio"}' | ||
171 | +format name: IMGFMT | ||
172 | +cluster size: 0 bytes | ||
173 | +vm state offset: 0 bytes | ||
174 | |||
175 | === Testing version 3 === | ||
176 | image: TEST_DIR/iotest-version3.IMGFMT | ||
177 | -- | ||
178 | 2.21.0 | ||
179 | |||
180 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | We had a test for a case where relative extent paths did not work, but | ||
2 | unfortunately we just fixed the underlying problem, so it works now. | ||
3 | This patch adds a new test case that still fails. | ||
4 | 1 | ||
5 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
6 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
7 | Message-id: 20190815153638.4600-4-mreitz@redhat.com | ||
8 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
9 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
10 | --- | ||
11 | tests/qemu-iotests/059 | 27 +++++++++++++++++++++++++++ | ||
12 | tests/qemu-iotests/059.out | 4 ++++ | ||
13 | 2 files changed, 31 insertions(+) | ||
14 | |||
15 | diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 | ||
16 | index XXXXXXX..XXXXXXX 100755 | ||
17 | --- a/tests/qemu-iotests/059 | ||
18 | +++ b/tests/qemu-iotests/059 | ||
19 | @@ -XXX,XX +XXX,XX @@ $QEMU_IMG convert -f qcow2 -O vmdk -o subformat=streamOptimized "$TEST_IMG.qcow2 | ||
20 | |||
21 | echo | ||
22 | echo "=== Testing monolithicFlat with internally generated JSON file name ===" | ||
23 | + | ||
24 | +echo '--- blkdebug ---' | ||
25 | # Should work, because bdrv_dirname() works fine with blkdebug | ||
26 | IMGOPTS="subformat=monolithicFlat" _make_test_img 64M | ||
27 | $QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=read_aio" \ | ||
28 | @@ -XXX,XX +XXX,XX @@ $QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TE | ||
29 | | _filter_testdir | _filter_imgfmt | _filter_img_info | ||
30 | _cleanup_test_img | ||
31 | |||
32 | +echo '--- quorum ---' | ||
33 | +# Should not work, because bdrv_dirname() does not work with quorum | ||
34 | +IMGOPTS="subformat=monolithicFlat" _make_test_img 64M | ||
35 | +cp "$TEST_IMG" "$TEST_IMG.orig" | ||
36 | + | ||
37 | +filename="json:{ | ||
38 | + \"driver\": \"$IMGFMT\", | ||
39 | + \"file\": { | ||
40 | + \"driver\": \"quorum\", | ||
41 | + \"children\": [ { | ||
42 | + \"driver\": \"file\", | ||
43 | + \"filename\": \"$TEST_IMG\" | ||
44 | + }, { | ||
45 | + \"driver\": \"file\", | ||
46 | + \"filename\": \"$TEST_IMG.orig\" | ||
47 | + } ], | ||
48 | + \"vote-threshold\": 1 | ||
49 | + } }" | ||
50 | + | ||
51 | +filename=$(echo "$filename" | tr '\n' ' ' | sed -e 's/\s\+/ /g') | ||
52 | +$QEMU_IMG info "$filename" 2>&1 \ | ||
53 | + | sed -e "s/'json:[^']*'/\$QUORUM_FILE/g" \ | ||
54 | + | _filter_testdir | _filter_imgfmt | _filter_img_info | ||
55 | + | ||
56 | + | ||
57 | echo | ||
58 | echo "=== Testing version 3 ===" | ||
59 | _use_sample_img iotest-version3.vmdk.bz2 | ||
60 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/tests/qemu-iotests/059.out | ||
63 | +++ b/tests/qemu-iotests/059.out | ||
64 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 10240 | ||
65 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
66 | |||
67 | === Testing monolithicFlat with internally generated JSON file name === | ||
68 | +--- blkdebug --- | ||
69 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
70 | format name: IMGFMT | ||
71 | cluster size: 0 bytes | ||
72 | vm state offset: 0 bytes | ||
73 | +--- quorum --- | ||
74 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
75 | +qemu-img: Could not open $QUORUM_FILE: Cannot use relative paths with VMDK descriptor file $QUORUM_FILE: Cannot generate a base directory for quorum nodes | ||
76 | |||
77 | === Testing version 3 === | ||
78 | image: TEST_DIR/iotest-version3.IMGFMT | ||
79 | -- | ||
80 | 2.21.0 | ||
81 | |||
82 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Compressed writes generally have to write full clusters, not just in | ||
2 | theory but also in practice when it comes to vmdk's streamOptimized | ||
3 | subformat. It currently is just silently broken for writes with | ||
4 | non-zero in-cluster offsets: | ||
5 | 1 | ||
6 | $ qemu-img create -f vmdk -o subformat=streamOptimized foo.vmdk 1M | ||
7 | $ qemu-io -c 'write 4k 4k' -c 'read 4k 4k' foo.vmdk | ||
8 | wrote 4096/4096 bytes at offset 4096 | ||
9 | 4 KiB, 1 ops; 00.01 sec (443.724 KiB/sec and 110.9309 ops/sec) | ||
10 | read failed: Invalid argument | ||
11 | |||
12 | (The technical reason is that vmdk_write_extent() just writes the | ||
13 | incomplete compressed data actually to offset 4k. When reading the | ||
14 | data, vmdk_read_extent() looks at offset 0 and finds the compressed data | ||
15 | size to be 0, because that is what it reads from there. This yields an | ||
16 | error.) | ||
17 | |||
18 | For incomplete writes with zero in-cluster offsets, the error path when | ||
19 | reading the rest of the cluster is a bit different, but the result is | ||
20 | the same: | ||
21 | |||
22 | $ qemu-img create -f vmdk -o subformat=streamOptimized foo.vmdk 1M | ||
23 | $ qemu-io -c 'write 0k 4k' -c 'read 4k 4k' foo.vmdk | ||
24 | wrote 4096/4096 bytes at offset 0 | ||
25 | 4 KiB, 1 ops; 00.01 sec (362.641 KiB/sec and 90.6603 ops/sec) | ||
26 | read failed: Invalid argument | ||
27 | |||
28 | (Here, vmdk_read_extent() finds the data and then sees that the | ||
29 | uncompressed data is short.) | ||
30 | |||
31 | It is better to reject invalid writes than to make the user believe they | ||
32 | might have succeeded and then fail when trying to read it back. | ||
33 | |||
34 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
35 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
36 | Message-id: 20190815153638.4600-5-mreitz@redhat.com | ||
37 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
38 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
39 | --- | ||
40 | block/vmdk.c | 10 ++++++++++ | ||
41 | 1 file changed, 10 insertions(+) | ||
42 | |||
43 | diff --git a/block/vmdk.c b/block/vmdk.c | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/block/vmdk.c | ||
46 | +++ b/block/vmdk.c | ||
47 | @@ -XXX,XX +XXX,XX @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset, | ||
48 | if (extent->compressed) { | ||
49 | void *compressed_data; | ||
50 | |||
51 | + /* Only whole clusters */ | ||
52 | + if (offset_in_cluster || | ||
53 | + n_bytes > (extent->cluster_sectors * SECTOR_SIZE) || | ||
54 | + (n_bytes < (extent->cluster_sectors * SECTOR_SIZE) && | ||
55 | + offset + n_bytes != extent->end_sector * SECTOR_SIZE)) | ||
56 | + { | ||
57 | + ret = -EINVAL; | ||
58 | + goto out; | ||
59 | + } | ||
60 | + | ||
61 | if (!extent->has_marker) { | ||
62 | ret = -EINVAL; | ||
63 | goto out; | ||
64 | -- | ||
65 | 2.21.0 | ||
66 | |||
67 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | streamOptimized does not support writes that do not span exactly one | ||
2 | cluster. Furthermore, it cannot rewrite already allocated clusters. | ||
3 | As such, many iotests do not work with it. Disable them. | ||
4 | 1 | ||
5 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
6 | Message-id: 20190815153638.4600-6-mreitz@redhat.com | ||
7 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
8 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
9 | --- | ||
10 | tests/qemu-iotests/002 | 1 + | ||
11 | tests/qemu-iotests/003 | 1 + | ||
12 | tests/qemu-iotests/005 | 3 ++- | ||
13 | tests/qemu-iotests/009 | 1 + | ||
14 | tests/qemu-iotests/010 | 1 + | ||
15 | tests/qemu-iotests/011 | 1 + | ||
16 | tests/qemu-iotests/017 | 3 ++- | ||
17 | tests/qemu-iotests/018 | 3 ++- | ||
18 | tests/qemu-iotests/019 | 3 ++- | ||
19 | tests/qemu-iotests/020 | 3 ++- | ||
20 | tests/qemu-iotests/027 | 1 + | ||
21 | tests/qemu-iotests/032 | 1 + | ||
22 | tests/qemu-iotests/033 | 1 + | ||
23 | tests/qemu-iotests/034 | 3 ++- | ||
24 | tests/qemu-iotests/037 | 3 ++- | ||
25 | tests/qemu-iotests/063 | 3 ++- | ||
26 | tests/qemu-iotests/072 | 1 + | ||
27 | tests/qemu-iotests/105 | 3 ++- | ||
28 | tests/qemu-iotests/197 | 1 + | ||
29 | tests/qemu-iotests/215 | 1 + | ||
30 | tests/qemu-iotests/251 | 1 + | ||
31 | 21 files changed, 30 insertions(+), 9 deletions(-) | ||
32 | |||
33 | diff --git a/tests/qemu-iotests/002 b/tests/qemu-iotests/002 | ||
34 | index XXXXXXX..XXXXXXX 100755 | ||
35 | --- a/tests/qemu-iotests/002 | ||
36 | +++ b/tests/qemu-iotests/002 | ||
37 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
38 | |||
39 | _supported_fmt generic | ||
40 | _supported_proto generic | ||
41 | +_unsupported_imgopts "subformat=streamOptimized" | ||
42 | |||
43 | |||
44 | size=128M | ||
45 | diff --git a/tests/qemu-iotests/003 b/tests/qemu-iotests/003 | ||
46 | index XXXXXXX..XXXXXXX 100755 | ||
47 | --- a/tests/qemu-iotests/003 | ||
48 | +++ b/tests/qemu-iotests/003 | ||
49 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
50 | |||
51 | _supported_fmt generic | ||
52 | _supported_proto generic | ||
53 | +_unsupported_imgopts "subformat=streamOptimized" | ||
54 | |||
55 | size=128M | ||
56 | offset=67M | ||
57 | diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005 | ||
58 | index XXXXXXX..XXXXXXX 100755 | ||
59 | --- a/tests/qemu-iotests/005 | ||
60 | +++ b/tests/qemu-iotests/005 | ||
61 | @@ -XXX,XX +XXX,XX @@ _supported_fmt generic | ||
62 | _supported_proto generic | ||
63 | _supported_os Linux | ||
64 | _unsupported_imgopts "subformat=twoGbMaxExtentFlat" \ | ||
65 | - "subformat=twoGbMaxExtentSparse" | ||
66 | + "subformat=twoGbMaxExtentSparse" \ | ||
67 | + "subformat=streamOptimized" | ||
68 | |||
69 | # vpc is limited to 127GB, so we can't test it here | ||
70 | if [ "$IMGFMT" = "vpc" ]; then | ||
71 | diff --git a/tests/qemu-iotests/009 b/tests/qemu-iotests/009 | ||
72 | index XXXXXXX..XXXXXXX 100755 | ||
73 | --- a/tests/qemu-iotests/009 | ||
74 | +++ b/tests/qemu-iotests/009 | ||
75 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
76 | |||
77 | _supported_fmt generic | ||
78 | _supported_proto generic | ||
79 | +_unsupported_imgopts "subformat=streamOptimized" | ||
80 | |||
81 | |||
82 | size=6G | ||
83 | diff --git a/tests/qemu-iotests/010 b/tests/qemu-iotests/010 | ||
84 | index XXXXXXX..XXXXXXX 100755 | ||
85 | --- a/tests/qemu-iotests/010 | ||
86 | +++ b/tests/qemu-iotests/010 | ||
87 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
88 | |||
89 | _supported_fmt generic | ||
90 | _supported_proto generic | ||
91 | +_unsupported_imgopts "subformat=streamOptimized" | ||
92 | |||
93 | |||
94 | size=6G | ||
95 | diff --git a/tests/qemu-iotests/011 b/tests/qemu-iotests/011 | ||
96 | index XXXXXXX..XXXXXXX 100755 | ||
97 | --- a/tests/qemu-iotests/011 | ||
98 | +++ b/tests/qemu-iotests/011 | ||
99 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
100 | |||
101 | _supported_fmt generic | ||
102 | _supported_proto generic | ||
103 | +_unsupported_imgopts "subformat=streamOptimized" | ||
104 | |||
105 | |||
106 | size=6G | ||
107 | diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017 | ||
108 | index XXXXXXX..XXXXXXX 100755 | ||
109 | --- a/tests/qemu-iotests/017 | ||
110 | +++ b/tests/qemu-iotests/017 | ||
111 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
112 | _supported_fmt qcow qcow2 vmdk qed | ||
113 | _supported_proto generic | ||
114 | _unsupported_proto vxhs | ||
115 | -_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" | ||
116 | +_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \ | ||
117 | + "subformat=streamOptimized" | ||
118 | |||
119 | TEST_OFFSETS="0 4294967296" | ||
120 | |||
121 | diff --git a/tests/qemu-iotests/018 b/tests/qemu-iotests/018 | ||
122 | index XXXXXXX..XXXXXXX 100755 | ||
123 | --- a/tests/qemu-iotests/018 | ||
124 | +++ b/tests/qemu-iotests/018 | ||
125 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
126 | _supported_fmt qcow qcow2 vmdk qed | ||
127 | _supported_proto file | ||
128 | _supported_os Linux | ||
129 | -_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" | ||
130 | +_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \ | ||
131 | + "streamOptimized" | ||
132 | |||
133 | TEST_OFFSETS="0 4294967296" | ||
134 | |||
135 | diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019 | ||
136 | index XXXXXXX..XXXXXXX 100755 | ||
137 | --- a/tests/qemu-iotests/019 | ||
138 | +++ b/tests/qemu-iotests/019 | ||
139 | @@ -XXX,XX +XXX,XX @@ _supported_proto file | ||
140 | _supported_os Linux | ||
141 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
142 | "subformat=twoGbMaxExtentFlat" \ | ||
143 | - "subformat=twoGbMaxExtentSparse" | ||
144 | + "subformat=twoGbMaxExtentSparse" \ | ||
145 | + "subformat=streamOptimized" | ||
146 | |||
147 | TEST_OFFSETS="0 4294967296" | ||
148 | CLUSTER_SIZE=65536 | ||
149 | diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020 | ||
150 | index XXXXXXX..XXXXXXX 100755 | ||
151 | --- a/tests/qemu-iotests/020 | ||
152 | +++ b/tests/qemu-iotests/020 | ||
153 | @@ -XXX,XX +XXX,XX @@ _supported_fmt qcow qcow2 vmdk qed | ||
154 | _supported_proto file | ||
155 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
156 | "subformat=twoGbMaxExtentFlat" \ | ||
157 | - "subformat=twoGbMaxExtentSparse" | ||
158 | + "subformat=twoGbMaxExtentSparse" \ | ||
159 | + "subformat=streamOptimized" | ||
160 | |||
161 | TEST_OFFSETS="0 4294967296" | ||
162 | |||
163 | diff --git a/tests/qemu-iotests/027 b/tests/qemu-iotests/027 | ||
164 | index XXXXXXX..XXXXXXX 100755 | ||
165 | --- a/tests/qemu-iotests/027 | ||
166 | +++ b/tests/qemu-iotests/027 | ||
167 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
168 | |||
169 | _supported_fmt vmdk qcow qcow2 qed | ||
170 | _supported_proto generic | ||
171 | +_unsupported_imgopts "subformat=streamOptimized" | ||
172 | |||
173 | |||
174 | size=128M | ||
175 | diff --git a/tests/qemu-iotests/032 b/tests/qemu-iotests/032 | ||
176 | index XXXXXXX..XXXXXXX 100755 | ||
177 | --- a/tests/qemu-iotests/032 | ||
178 | +++ b/tests/qemu-iotests/032 | ||
179 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
180 | # This works for any image format (though unlikely to segfault for raw) | ||
181 | _supported_fmt generic | ||
182 | _supported_proto generic | ||
183 | +_unsupported_imgopts "subformat=streamOptimized" | ||
184 | |||
185 | echo | ||
186 | echo === Prepare image === | ||
187 | diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033 | ||
188 | index XXXXXXX..XXXXXXX 100755 | ||
189 | --- a/tests/qemu-iotests/033 | ||
190 | +++ b/tests/qemu-iotests/033 | ||
191 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
192 | |||
193 | _supported_fmt generic | ||
194 | _supported_proto generic | ||
195 | +_unsupported_imgopts "subformat=streamOptimized" | ||
196 | |||
197 | |||
198 | size=128M | ||
199 | diff --git a/tests/qemu-iotests/034 b/tests/qemu-iotests/034 | ||
200 | index XXXXXXX..XXXXXXX 100755 | ||
201 | --- a/tests/qemu-iotests/034 | ||
202 | +++ b/tests/qemu-iotests/034 | ||
203 | @@ -XXX,XX +XXX,XX @@ _supported_proto file | ||
204 | _supported_os Linux | ||
205 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
206 | "subformat=twoGbMaxExtentFlat" \ | ||
207 | - "subformat=twoGbMaxExtentSparse" | ||
208 | + "subformat=twoGbMaxExtentSparse" \ | ||
209 | + "subformat=streamOptimized" | ||
210 | |||
211 | CLUSTER_SIZE=4k | ||
212 | size=128M | ||
213 | diff --git a/tests/qemu-iotests/037 b/tests/qemu-iotests/037 | ||
214 | index XXXXXXX..XXXXXXX 100755 | ||
215 | --- a/tests/qemu-iotests/037 | ||
216 | +++ b/tests/qemu-iotests/037 | ||
217 | @@ -XXX,XX +XXX,XX @@ _supported_fmt qcow qcow2 vmdk qed | ||
218 | _supported_proto file | ||
219 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
220 | "subformat=twoGbMaxExtentFlat" \ | ||
221 | - "subformat=twoGbMaxExtentSparse" | ||
222 | + "subformat=twoGbMaxExtentSparse" \ | ||
223 | + "subformat=streamOptimized" | ||
224 | |||
225 | CLUSTER_SIZE=4k | ||
226 | size=128M | ||
227 | diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063 | ||
228 | index XXXXXXX..XXXXXXX 100755 | ||
229 | --- a/tests/qemu-iotests/063 | ||
230 | +++ b/tests/qemu-iotests/063 | ||
231 | @@ -XXX,XX +XXX,XX @@ _supported_fmt qcow qcow2 vmdk qed raw | ||
232 | _supported_proto file | ||
233 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
234 | "subformat=twoGbMaxExtentFlat" \ | ||
235 | - "subformat=twoGbMaxExtentSparse" | ||
236 | + "subformat=twoGbMaxExtentSparse" \ | ||
237 | + "subformat=streamOptimized" | ||
238 | |||
239 | _make_test_img 4M | ||
240 | |||
241 | diff --git a/tests/qemu-iotests/072 b/tests/qemu-iotests/072 | ||
242 | index XXXXXXX..XXXXXXX 100755 | ||
243 | --- a/tests/qemu-iotests/072 | ||
244 | +++ b/tests/qemu-iotests/072 | ||
245 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
246 | |||
247 | _supported_fmt vpc vmdk vhdx vdi qed qcow2 qcow | ||
248 | _supported_proto file | ||
249 | +_unsupported_imgopts "subformat=streamOptimized" | ||
250 | |||
251 | IMG_SIZE=64M | ||
252 | |||
253 | diff --git a/tests/qemu-iotests/105 b/tests/qemu-iotests/105 | ||
254 | index XXXXXXX..XXXXXXX 100755 | ||
255 | --- a/tests/qemu-iotests/105 | ||
256 | +++ b/tests/qemu-iotests/105 | ||
257 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
258 | _supported_fmt qcow2 vmdk vhdx qed | ||
259 | _supported_proto generic | ||
260 | _unsupported_imgopts "subformat=twoGbMaxExtentFlat" \ | ||
261 | - "subformat=twoGbMaxExtentSparse" | ||
262 | + "subformat=twoGbMaxExtentSparse" \ | ||
263 | + "subformat=streamOptimized" | ||
264 | |||
265 | echo | ||
266 | echo "creating large image" | ||
267 | diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197 | ||
268 | index XXXXXXX..XXXXXXX 100755 | ||
269 | --- a/tests/qemu-iotests/197 | ||
270 | +++ b/tests/qemu-iotests/197 | ||
271 | @@ -XXX,XX +XXX,XX @@ _supported_fmt generic | ||
272 | _supported_proto generic | ||
273 | # LUKS support may be possible, but it complicates things. | ||
274 | _unsupported_fmt luks | ||
275 | +_unsupported_imgopts "subformat=streamOptimized" | ||
276 | |||
277 | echo | ||
278 | echo '=== Copy-on-read ===' | ||
279 | diff --git a/tests/qemu-iotests/215 b/tests/qemu-iotests/215 | ||
280 | index XXXXXXX..XXXXXXX 100755 | ||
281 | --- a/tests/qemu-iotests/215 | ||
282 | +++ b/tests/qemu-iotests/215 | ||
283 | @@ -XXX,XX +XXX,XX @@ _supported_fmt generic | ||
284 | _supported_proto generic | ||
285 | # LUKS support may be possible, but it complicates things. | ||
286 | _unsupported_fmt luks | ||
287 | +_unsupported_imgopts "subformat=streamOptimized" | ||
288 | |||
289 | echo | ||
290 | echo '=== Copy-on-read ===' | ||
291 | diff --git a/tests/qemu-iotests/251 b/tests/qemu-iotests/251 | ||
292 | index XXXXXXX..XXXXXXX 100755 | ||
293 | --- a/tests/qemu-iotests/251 | ||
294 | +++ b/tests/qemu-iotests/251 | ||
295 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
296 | _supported_fmt generic | ||
297 | _supported_proto file | ||
298 | _supported_os Linux | ||
299 | +_unsupported_imgopts "subformat=streamOptimized" | ||
300 | |||
301 | if [ "$IMGOPTSSYNTAX" = "true" ]; then | ||
302 | # We use json:{} filenames here, so we cannot work with additional options. | ||
303 | -- | ||
304 | 2.21.0 | ||
305 | |||
306 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The error message for the test case where we have a quorum node for | ||
2 | which no directory name can be generated is different: For | ||
3 | twoGbMaxExtentSparse, it complains that it cannot open the extent file. | ||
4 | For other (sub)formats, it just notes that it cannot determine the | ||
5 | backing file path. Both are fine, but just disable twoGbMaxExtentSparse | ||
6 | for simplicity's sake. | ||
7 | 1 | ||
8 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
9 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
10 | Message-id: 20190815153638.4600-7-mreitz@redhat.com | ||
11 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
12 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
13 | --- | ||
14 | tests/qemu-iotests/110 | 3 ++- | ||
15 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110 | ||
18 | index XXXXXXX..XXXXXXX 100755 | ||
19 | --- a/tests/qemu-iotests/110 | ||
20 | +++ b/tests/qemu-iotests/110 | ||
21 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
22 | # Any format supporting backing files | ||
23 | _supported_fmt qed qcow qcow2 vmdk | ||
24 | _supported_proto file | ||
25 | -_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" | ||
26 | +_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \ | ||
27 | + "subformat=twoGbMaxExtentSparse" | ||
28 | |||
29 | TEST_IMG_REL=$(basename "$TEST_IMG") | ||
30 | |||
31 | -- | ||
32 | 2.21.0 | ||
33 | |||
34 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | iotest 126 requires backing file support, which flat vmdks cannot offer. | ||
2 | Skip this test for such subformats. | ||
3 | 1 | ||
4 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
5 | Message-id: 20190815153638.4600-8-mreitz@redhat.com | ||
6 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
7 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
8 | --- | ||
9 | tests/qemu-iotests/126 | 2 ++ | ||
10 | 1 file changed, 2 insertions(+) | ||
11 | |||
12 | diff --git a/tests/qemu-iotests/126 b/tests/qemu-iotests/126 | ||
13 | index XXXXXXX..XXXXXXX 100755 | ||
14 | --- a/tests/qemu-iotests/126 | ||
15 | +++ b/tests/qemu-iotests/126 | ||
16 | @@ -XXX,XX +XXX,XX @@ status=1 # failure is the default! | ||
17 | |||
18 | # Needs backing file support | ||
19 | _supported_fmt qcow qcow2 qed vmdk | ||
20 | +_unsupported_imgopts "subformat=monolithicFlat" \ | ||
21 | + "subformat=twoGbMaxExtentFlat" | ||
22 | # This is the default protocol (and we want to test the difference between | ||
23 | # colons which separate a protocol prefix from the rest and colons which are | ||
24 | # just part of the filename, so we cannot test protocols which require a prefix) | ||
25 | -- | ||
26 | 2.21.0 | ||
27 | |||
28 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Stefan Hajnoczi <stefanha@redhat.com> | ||
2 | 1 | ||
3 | Fixes: a6b257a08e3d72219f03e461a52152672fec0612 | ||
4 | ("file-posix: Handle undetectable alignment") | ||
5 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
6 | Message-id: 20190827101328.4062-1-stefanha@redhat.com | ||
7 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
8 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
9 | --- | ||
10 | block/file-posix.c | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/block/file-posix.c b/block/file-posix.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/block/file-posix.c | ||
16 | +++ b/block/file-posix.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp) | ||
18 | for (i = 0; i < ARRAY_SIZE(alignments); i++) { | ||
19 | align = alignments[i]; | ||
20 | if (raw_is_io_aligned(fd, buf + align, max_align)) { | ||
21 | - /* Fallback to request_aligment. */ | ||
22 | + /* Fallback to request_alignment. */ | ||
23 | s->buf_align = (align != 1) ? align : bs->bl.request_alignment; | ||
24 | break; | ||
25 | } | ||
26 | -- | ||
27 | 2.21.0 | ||
28 | |||
29 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | It is possible to enable only a subset of the block drivers with the | ||
4 | "--block-drv-rw-whitelist" option of the "configure" script. All other | ||
5 | drivers are marked as unusable (or only included as read-only with the | ||
6 | "--block-drv-ro-whitelist" option). If an iotest is now using such a | ||
7 | disabled block driver, it is failing - which is bad, since at least the | ||
8 | tests in the "auto" group should be able to deal with this situation. | ||
9 | Thus let's introduce a "_require_drivers" function that can be used by | ||
10 | the shell tests to check for the availability of certain drivers first, | ||
11 | and marks the test as "not run" if one of the drivers is missing. | ||
12 | |||
13 | This patch mainly targets the test in the "auto" group which should | ||
14 | never fail in such a case, but also improves some of the other tests | ||
15 | along the way. Note that we also assume that the "qcow2" and "file" | ||
16 | drivers are always available - otherwise it does not make sense to | ||
17 | run "make check-block" at all (which only tests with qcow2 by default). | ||
18 | |||
19 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
20 | Message-id: 20190823133552.11680-1-thuth@redhat.com | ||
21 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
22 | --- | ||
23 | tests/qemu-iotests/071 | 1 + | ||
24 | tests/qemu-iotests/081 | 4 +--- | ||
25 | tests/qemu-iotests/099 | 1 + | ||
26 | tests/qemu-iotests/120 | 1 + | ||
27 | tests/qemu-iotests/162 | 4 +--- | ||
28 | tests/qemu-iotests/184 | 1 + | ||
29 | tests/qemu-iotests/186 | 1 + | ||
30 | tests/qemu-iotests/common.rc | 14 ++++++++++++++ | ||
31 | 8 files changed, 21 insertions(+), 6 deletions(-) | ||
32 | |||
33 | diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071 | ||
34 | index XXXXXXX..XXXXXXX 100755 | ||
35 | --- a/tests/qemu-iotests/071 | ||
36 | +++ b/tests/qemu-iotests/071 | ||
37 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
38 | |||
39 | _supported_fmt qcow2 | ||
40 | _supported_proto file | ||
41 | +_require_drivers blkdebug blkverify | ||
42 | |||
43 | do_run_qemu() | ||
44 | { | ||
45 | diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 | ||
46 | index XXXXXXX..XXXXXXX 100755 | ||
47 | --- a/tests/qemu-iotests/081 | ||
48 | +++ b/tests/qemu-iotests/081 | ||
49 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
50 | _supported_fmt raw | ||
51 | _supported_proto file | ||
52 | _supported_os Linux | ||
53 | +_require_drivers quorum | ||
54 | |||
55 | do_run_qemu() | ||
56 | { | ||
57 | @@ -XXX,XX +XXX,XX @@ run_qemu() | ||
58 | | _filter_qemu_io | _filter_generated_node_ids | ||
59 | } | ||
60 | |||
61 | -test_quorum=$($QEMU_IMG --help|grep quorum) | ||
62 | -[ "$test_quorum" = "" ] && _supported_fmt quorum | ||
63 | - | ||
64 | quorum="driver=raw,file.driver=quorum,file.vote-threshold=2" | ||
65 | quorum="$quorum,file.children.0.file.filename=$TEST_DIR/1.raw" | ||
66 | quorum="$quorum,file.children.1.file.filename=$TEST_DIR/2.raw" | ||
67 | diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099 | ||
68 | index XXXXXXX..XXXXXXX 100755 | ||
69 | --- a/tests/qemu-iotests/099 | ||
70 | +++ b/tests/qemu-iotests/099 | ||
71 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
72 | _supported_fmt qcow qcow2 qed vdi vhdx vmdk vpc | ||
73 | _supported_proto file | ||
74 | _supported_os Linux | ||
75 | +_require_drivers blkdebug blkverify | ||
76 | _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \ | ||
77 | "subformat=twoGbMaxExtentSparse" | ||
78 | |||
79 | diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120 | ||
80 | index XXXXXXX..XXXXXXX 100755 | ||
81 | --- a/tests/qemu-iotests/120 | ||
82 | +++ b/tests/qemu-iotests/120 | ||
83 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
84 | _supported_fmt generic | ||
85 | _supported_proto file | ||
86 | _unsupported_fmt luks | ||
87 | +_require_drivers raw | ||
88 | |||
89 | _make_test_img 64M | ||
90 | |||
91 | diff --git a/tests/qemu-iotests/162 b/tests/qemu-iotests/162 | ||
92 | index XXXXXXX..XXXXXXX 100755 | ||
93 | --- a/tests/qemu-iotests/162 | ||
94 | +++ b/tests/qemu-iotests/162 | ||
95 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
96 | . ./common.filter | ||
97 | |||
98 | _supported_fmt generic | ||
99 | - | ||
100 | -test_ssh=$($QEMU_IMG --help | grep '^Supported formats:.* ssh\( \|$\)') | ||
101 | -[ "$test_ssh" = "" ] && _notrun "ssh support required" | ||
102 | +_require_drivers ssh | ||
103 | |||
104 | echo | ||
105 | echo '=== NBD ===' | ||
106 | diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184 | ||
107 | index XXXXXXX..XXXXXXX 100755 | ||
108 | --- a/tests/qemu-iotests/184 | ||
109 | +++ b/tests/qemu-iotests/184 | ||
110 | @@ -XXX,XX +XXX,XX @@ trap "exit \$status" 0 1 2 3 15 | ||
111 | . ./common.filter | ||
112 | |||
113 | _supported_os Linux | ||
114 | +_require_drivers throttle | ||
115 | |||
116 | do_run_qemu() | ||
117 | { | ||
118 | diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186 | ||
119 | index XXXXXXX..XXXXXXX 100755 | ||
120 | --- a/tests/qemu-iotests/186 | ||
121 | +++ b/tests/qemu-iotests/186 | ||
122 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
123 | |||
124 | _supported_fmt qcow2 | ||
125 | _supported_proto file | ||
126 | +_require_drivers null-co | ||
127 | |||
128 | if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then | ||
129 | _notrun "Requires a PC machine" | ||
130 | diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc | ||
131 | index XXXXXXX..XXXXXXX 100644 | ||
132 | --- a/tests/qemu-iotests/common.rc | ||
133 | +++ b/tests/qemu-iotests/common.rc | ||
134 | @@ -XXX,XX +XXX,XX @@ _require_command() | ||
135 | [ -x "$c" ] || _notrun "$1 utility required, skipped this test" | ||
136 | } | ||
137 | |||
138 | +# Check that a set of drivers has been whitelisted in the QEMU binary | ||
139 | +# | ||
140 | +_require_drivers() | ||
141 | +{ | ||
142 | + available=$($QEMU -drive format=help | \ | ||
143 | + sed -e '/Supported formats:/!d' -e 's/Supported formats://') | ||
144 | + for driver | ||
145 | + do | ||
146 | + if ! echo "$available" | grep -q " $driver\( \|$\)"; then | ||
147 | + _notrun "$driver not available" | ||
148 | + fi | ||
149 | + done | ||
150 | +} | ||
151 | + | ||
152 | # make sure this script returns success | ||
153 | true | ||
154 | -- | ||
155 | 2.21.0 | ||
156 | |||
157 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Nir Soffer <nirsof@gmail.com> | ||
2 | 1 | ||
3 | Quoting cache mode is not needed, and most tests use unquoted values. | ||
4 | Unify all test to use the same style. | ||
5 | |||
6 | Message-id: 20190827173432.7656-1-nsoffer@redhat.com | ||
7 | Signed-off-by: Nir Soffer <nsoffer@redhat.com> | ||
8 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
9 | --- | ||
10 | tests/qemu-iotests/026 | 4 ++-- | ||
11 | tests/qemu-iotests/039 | 4 ++-- | ||
12 | tests/qemu-iotests/052 | 2 +- | ||
13 | tests/qemu-iotests/091 | 4 ++-- | ||
14 | 4 files changed, 7 insertions(+), 7 deletions(-) | ||
15 | |||
16 | diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026 | ||
17 | index XXXXXXX..XXXXXXX 100755 | ||
18 | --- a/tests/qemu-iotests/026 | ||
19 | +++ b/tests/qemu-iotests/026 | ||
20 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
21 | # Currently only qcow2 supports rebasing | ||
22 | _supported_fmt qcow2 | ||
23 | _supported_proto file | ||
24 | -_default_cache_mode "writethrough" | ||
25 | -_supported_cache_modes "writethrough" "none" | ||
26 | +_default_cache_mode writethrough | ||
27 | +_supported_cache_modes writethrough none | ||
28 | # The refcount table tests expect a certain minimum width for refcount entries | ||
29 | # (so that the refcount table actually needs to grow); that minimum is 16 bits, | ||
30 | # being the default refcount entry width. | ||
31 | diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039 | ||
32 | index XXXXXXX..XXXXXXX 100755 | ||
33 | --- a/tests/qemu-iotests/039 | ||
34 | +++ b/tests/qemu-iotests/039 | ||
35 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
36 | _supported_fmt qcow2 | ||
37 | _supported_proto file | ||
38 | _supported_os Linux | ||
39 | -_default_cache_mode "writethrough" | ||
40 | -_supported_cache_modes "writethrough" | ||
41 | +_default_cache_mode writethrough | ||
42 | +_supported_cache_modes writethrough | ||
43 | |||
44 | size=128M | ||
45 | |||
46 | diff --git a/tests/qemu-iotests/052 b/tests/qemu-iotests/052 | ||
47 | index XXXXXXX..XXXXXXX 100755 | ||
48 | --- a/tests/qemu-iotests/052 | ||
49 | +++ b/tests/qemu-iotests/052 | ||
50 | @@ -XXX,XX +XXX,XX @@ _supported_fmt generic | ||
51 | _supported_proto file | ||
52 | |||
53 | # Don't do O_DIRECT on tmpfs | ||
54 | -_supported_cache_modes "writeback" "writethrough" "unsafe" | ||
55 | +_supported_cache_modes writeback writethrough unsafe | ||
56 | |||
57 | size=128M | ||
58 | _make_test_img $size | ||
59 | diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 | ||
60 | index XXXXXXX..XXXXXXX 100755 | ||
61 | --- a/tests/qemu-iotests/091 | ||
62 | +++ b/tests/qemu-iotests/091 | ||
63 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
64 | _supported_fmt qcow2 | ||
65 | _supported_proto file | ||
66 | _supported_os Linux | ||
67 | -_default_cache_mode "none" | ||
68 | -_supported_cache_modes "writethrough" "none" "writeback" | ||
69 | +_default_cache_mode none | ||
70 | +_supported_cache_modes writethrough none writeback | ||
71 | |||
72 | size=1G | ||
73 | |||
74 | -- | ||
75 | 2.21.0 | ||
76 | |||
77 | diff view generated by jsdifflib |