1
The following changes since commit bfec359afba088aaacc7d316f43302f28c6e642a:
1
The following changes since commit d5c75ec500d96f1d93447f990cd5a4ef5ba27fae:
2
2
3
Merge remote-tracking branch 'remotes/armbru/tags/pull-qdev-2017-04-21' into staging (2017-04-21 11:42:03 +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
git://github.com/codyprime/qemu-kvm-jtc.git tags/block-pull-request
7
https://github.com/XanClic/qemu.git tags/pull-block-2020-05-13
8
8
9
for you to fetch changes up to 1507631e438930bc07f776f303af127a9cdb4d41:
9
for you to fetch changes up to fc9aefc8c0d3c6392656ea661ce72c1583b70bbd:
10
10
11
qemu-iotests: _cleanup_qemu must be called on exit (2017-04-21 08:32:44 -0400)
11
block/block-copy: fix use-after-free of task pointer (2020-05-13 14:20:31 +0200)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
14
Block patches:
15
Block patches for 2.10
15
- zstd compression for qcow2
16
- Fix use-after-free
16
17
17
----------------------------------------------------------------
18
----------------------------------------------------------------
19
Denis Plotnikov (4):
20
qcow2: introduce compression type feature
21
qcow2: rework the cluster compression routine
22
qcow2: add zstd cluster compression
23
iotests: 287: add qcow2 compression type test
18
24
19
Ashish Mittal (2):
25
Vladimir Sementsov-Ogievskiy (1):
20
block/vxhs.c: Add support for a new block device type called "vxhs"
26
block/block-copy: fix use-after-free of task pointer
21
block/vxhs.c: Add qemu-iotests for new block device type "vxhs"
22
27
23
Jeff Cody (10):
28
docs/interop/qcow2.txt | 1 +
24
qemu-iotests: exclude vxhs from image creation via protocol
29
configure | 2 +-
25
block: add bdrv_set_read_only() helper function
30
qapi/block-core.json | 23 ++-
26
block: do not set BDS read_only if copy_on_read enabled
31
block/qcow2.h | 20 ++-
27
block: honor BDRV_O_ALLOW_RDWR when clearing bs->read_only
32
include/block/block_int.h | 1 +
28
block: code movement
33
block/block-copy.c | 2 +-
29
block: introduce bdrv_can_set_read_only()
34
block/qcow2-threads.c | 240 +++++++++++++++++++++++++++++--
30
block: use bdrv_can_set_read_only() during reopen
35
block/qcow2.c | 120 ++++++++++++++++
31
block/rbd - update variable names to more apt names
36
tests/qemu-iotests/031.out | 14 +-
32
block/rbd: Add support for reopen()
37
tests/qemu-iotests/036.out | 4 +-
33
qemu-iotests: _cleanup_qemu must be called on exit
38
tests/qemu-iotests/049.out | 102 ++++++-------
34
39
tests/qemu-iotests/060.out | 1 +
35
block.c | 56 +++-
40
tests/qemu-iotests/061.out | 34 +++--
36
block/Makefile.objs | 2 +
41
tests/qemu-iotests/065 | 28 ++--
37
block/bochs.c | 5 +-
42
tests/qemu-iotests/080 | 2 +-
38
block/cloop.c | 5 +-
43
tests/qemu-iotests/082.out | 48 ++++++-
39
block/dmg.c | 6 +-
44
tests/qemu-iotests/085.out | 38 ++---
40
block/rbd.c | 65 +++--
45
tests/qemu-iotests/144.out | 4 +-
41
block/trace-events | 17 ++
46
tests/qemu-iotests/182.out | 2 +-
42
block/vvfat.c | 19 +-
47
tests/qemu-iotests/185.out | 8 +-
43
block/vxhs.c | 575 +++++++++++++++++++++++++++++++++++++++
48
tests/qemu-iotests/198.out | 2 +
44
configure | 39 +++
49
tests/qemu-iotests/206.out | 5 +
45
include/block/block.h | 2 +
50
tests/qemu-iotests/242.out | 5 +
46
qapi/block-core.json | 23 +-
51
tests/qemu-iotests/255.out | 8 +-
47
tests/qemu-iotests/017 | 1 +
52
tests/qemu-iotests/274.out | 49 ++++---
48
tests/qemu-iotests/020 | 1 +
53
tests/qemu-iotests/280.out | 2 +-
49
tests/qemu-iotests/028 | 1 +
54
tests/qemu-iotests/287 | 152 ++++++++++++++++++++
50
tests/qemu-iotests/029 | 1 +
55
tests/qemu-iotests/287.out | 67 +++++++++
51
tests/qemu-iotests/073 | 1 +
56
tests/qemu-iotests/common.filter | 3 +-
52
tests/qemu-iotests/094 | 11 +-
57
tests/qemu-iotests/group | 1 +
53
tests/qemu-iotests/102 | 5 +-
58
30 files changed, 825 insertions(+), 163 deletions(-)
54
tests/qemu-iotests/109 | 1 +
59
create mode 100755 tests/qemu-iotests/287
55
tests/qemu-iotests/114 | 1 +
60
create mode 100644 tests/qemu-iotests/287.out
56
tests/qemu-iotests/117 | 1 +
57
tests/qemu-iotests/130 | 2 +
58
tests/qemu-iotests/134 | 1 +
59
tests/qemu-iotests/140 | 1 +
60
tests/qemu-iotests/141 | 1 +
61
tests/qemu-iotests/143 | 1 +
62
tests/qemu-iotests/156 | 2 +
63
tests/qemu-iotests/158 | 1 +
64
tests/qemu-iotests/common | 6 +
65
tests/qemu-iotests/common.config | 13 +
66
tests/qemu-iotests/common.filter | 1 +
67
tests/qemu-iotests/common.rc | 19 ++
68
33 files changed, 844 insertions(+), 42 deletions(-)
69
create mode 100644 block/vxhs.c
70
61
71
--
62
--
72
2.9.3
63
2.26.2
73
64
74
65
diff view generated by jsdifflib
1
From: Ashish Mittal <ashmit602@gmail.com>
1
From: Denis Plotnikov <dplotnikov@virtuozzo.com>
2
2
3
These changes use a vxhs test server that is a part of the following
3
The patch adds some preparation parts for incompatible compression type
4
repository:
4
feature to qcow2 allowing the use different compression methods for
5
https://github.com/VeritasHyperScale/libqnio.git
5
image clusters (de)compressing.
6
6
7
Signed-off-by: Ashish Mittal <Ashish.Mittal@veritas.com>
7
It is implied that the compression type is set on the image creation and
8
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8
can be changed only later by image conversion, thus compression type
9
Reviewed-by: Jeff Cody <jcody@redhat.com>
9
defines the only compression algorithm used for the image, and thus,
10
Signed-off-by: Jeff Cody <jcody@redhat.com>
10
for all image clusters.
11
Message-id: 1491277689-24949-3-git-send-email-Ashish.Mittal@veritas.com
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>
41
Signed-off-by: Max Reitz <mreitz@redhat.com>
12
---
42
---
13
tests/qemu-iotests/common | 6 ++++++
43
qapi/block-core.json | 22 +++++-
14
tests/qemu-iotests/common.config | 13 +++++++++++++
44
block/qcow2.h | 20 +++++-
15
tests/qemu-iotests/common.filter | 1 +
45
include/block/block_int.h | 1 +
16
tests/qemu-iotests/common.rc | 19 +++++++++++++++++++
46
block/qcow2.c | 113 +++++++++++++++++++++++++++++++
17
4 files changed, 39 insertions(+)
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(-)
18
67
19
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
68
diff --git a/qapi/block-core.json b/qapi/block-core.json
20
index XXXXXXX..XXXXXXX 100644
69
index XXXXXXX..XXXXXXX 100644
21
--- a/tests/qemu-iotests/common
70
--- a/qapi/block-core.json
22
+++ b/tests/qemu-iotests/common
71
+++ b/qapi/block-core.json
23
@@ -XXX,XX +XXX,XX @@ check options
72
@@ -XXX,XX +XXX,XX @@
24
-ssh test ssh
73
#
25
-nfs test nfs
74
# @bitmaps: A list of qcow2 bitmap details (since 4.0)
26
-luks test luks
75
#
27
+ -vxhs test vxhs
76
+# @compression-type: the image cluster compression method (since 5.1)
28
-xdiff graphical mode diff
77
+#
29
-nocache use O_DIRECT on backing file
78
# Since: 1.7
30
-misalign misalign memory allocations
79
##
31
@@ -XXX,XX +XXX,XX @@ testlist options
80
{ 'struct': 'ImageInfoSpecificQCow2',
32
xpand=false
81
@@ -XXX,XX +XXX,XX @@
33
;;
82
'*corrupt': 'bool',
34
83
'refcount-bits': 'int',
35
+ -vxhs)
84
'*encrypt': 'ImageInfoSpecificQCow2Encryption',
36
+ IMGPROTO=vxhs
85
- '*bitmaps': ['Qcow2BitmapInfo']
37
+ xpand=false
86
+ '*bitmaps': ['Qcow2BitmapInfo'],
38
+ ;;
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' ] }
39
+
106
+
40
-ssh)
107
##
41
IMGPROTO=ssh
108
# @BlockdevCreateOptionsQcow2:
42
xpand=false
109
#
43
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
110
@@ -XXX,XX +XXX,XX @@
44
index XXXXXXX..XXXXXXX 100644
111
# allowed values: off, falloc, full, metadata)
45
--- a/tests/qemu-iotests/common.config
112
# @lazy-refcounts: True if refcounts may be updated lazily (default: off)
46
+++ b/tests/qemu-iotests/common.config
113
# @refcount-bits: Width of reference counts in bits (default: 16)
47
@@ -XXX,XX +XXX,XX @@ if [ -z "$QEMU_NBD_PROG" ]; then
114
+# @compression-type: The image cluster compression method
48
export QEMU_NBD_PROG="`set_prog_path qemu-nbd`"
115
+# (default: zlib, since 5.1)
49
fi
116
#
50
117
# Since: 2.12
51
+if [ -z "$QEMU_VXHS_PROG" ]; then
118
##
52
+ export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
119
@@ -XXX,XX +XXX,XX @@
53
+fi
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;
54
+
137
+
55
_qemu_wrapper()
138
+ /* Additional fields */
56
{
139
+ uint8_t compression_type;
57
(
140
+
58
@@ -XXX,XX +XXX,XX @@ _qemu_nbd_wrapper()
141
+ /* header must be a multiple of 8 */
59
)
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;
60
}
200
}
61
201
62
+_qemu_vxhs_wrapper()
202
+static int validate_compression_type(BDRVQcow2State *s, Error **errp)
63
+{
203
+{
64
+ (
204
+ switch (s->compression_type) {
65
+ echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid"
205
+ case QCOW2_COMPRESSION_TYPE_ZLIB:
66
+ exec "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@"
206
+ break;
67
+ )
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;
68
+}
233
+}
69
+
234
+
70
export QEMU=_qemu_wrapper
235
/* Called with s->lock held. */
71
export QEMU_IMG=_qemu_img_wrapper
236
static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
72
export QEMU_IO=_qemu_io_wrapper
237
int flags, Error **errp)
73
export QEMU_NBD=_qemu_nbd_wrapper
238
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
74
+export QEMU_VXHS=_qemu_vxhs_wrapper
239
s->compatible_features = header.compatible_features;
75
240
s->autoclear_features = header.autoclear_features;
76
QEMU_IMG_EXTRA_ARGS=
241
77
if [ "$IMGOPTSSYNTAX" = "true" ]; then
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
962
image: TEST_DIR/t.IMGFMT
963
file format: IMGFMT
964
virtual size: 128 MiB (134217728 bytes)
965
cluster_size: 65536
966
967
Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 128M
968
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=4096 lazy_refcounts=on refcount_bits=16
969
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=4096 lazy_refcounts=on refcount_bits=16 compression_type=zlib
970
image: TEST_DIR/t.IMGFMT
971
file format: IMGFMT
972
virtual size: 128 MiB (134217728 bytes)
973
cluster_size: 4096
974
Format specific information:
975
compat: 1.1
976
+ compression type: zlib
977
lazy refcounts: true
978
refcount bits: 16
979
corrupt: false
980
981
Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k TEST_DIR/t.qcow2 128M
982
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=on refcount_bits=16
983
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=on refcount_bits=16 compression_type=zlib
984
image: TEST_DIR/t.IMGFMT
985
file format: IMGFMT
986
virtual size: 128 MiB (134217728 bytes)
987
cluster_size: 8192
988
Format specific information:
989
compat: 1.1
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...
78
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
79
index XXXXXXX..XXXXXXX 100644
1726
index XXXXXXX..XXXXXXX 100644
80
--- a/tests/qemu-iotests/common.filter
1727
--- a/tests/qemu-iotests/common.filter
81
+++ b/tests/qemu-iotests/common.filter
1728
+++ b/tests/qemu-iotests/common.filter
82
@@ -XXX,XX +XXX,XX @@ _filter_img_info()
1729
@@ -XXX,XX +XXX,XX @@ _filter_img_create()
83
-e "s#$TEST_DIR#TEST_DIR#g" \
1730
-e "s# refcount_bits=[0-9]\\+##g" \
84
-e "s#$IMGFMT#IMGFMT#g" \
1731
-e "s# key-secret=[a-zA-Z0-9]\\+##g" \
85
-e 's#nbd://127.0.0.1:10810$#TEST_DIR/t.IMGFMT#g' \
1732
-e "s# iter-time=[0-9]\\+##g" \
86
+ -e 's#json.*vdisk-id.*vxhs"}}#TEST_DIR/t.IMGFMT#' \
1733
- -e "s# force_size=\\(on\\|off\\)##g"
87
-e "/encrypted: yes/d" \
1734
+ -e "s# force_size=\\(on\\|off\\)##g" \
88
-e "/cluster_size: [0-9]\\+/d" \
1735
+ -e "s# compression_type=[a-zA-Z0-9]\\+##g"
89
-e "/table_size: [0-9]\\+/d" \
90
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
91
index XXXXXXX..XXXXXXX 100644
92
--- a/tests/qemu-iotests/common.rc
93
+++ b/tests/qemu-iotests/common.rc
94
@@ -XXX,XX +XXX,XX @@ else
95
elif [ "$IMGPROTO" = "nfs" ]; then
96
TEST_DIR="nfs://127.0.0.1/$TEST_DIR"
97
TEST_IMG=$TEST_DIR/t.$IMGFMT
98
+ elif [ "$IMGPROTO" = "vxhs" ]; then
99
+ TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
100
+ TEST_IMG="vxhs://127.0.0.1:9999/t.$IMGFMT"
101
else
102
TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
103
fi
104
@@ -XXX,XX +XXX,XX @@ _make_test_img()
105
eval "$QEMU_NBD -v -t -b 127.0.0.1 -p 10810 -f $IMGFMT $TEST_IMG_FILE >/dev/null &"
106
sleep 1 # FIXME: qemu-nbd needs to be listening before we continue
107
fi
108
+
109
+ # Start QNIO server on image directory for vxhs protocol
110
+ if [ $IMGPROTO = "vxhs" ]; then
111
+ eval "$QEMU_VXHS -d $TEST_DIR > /dev/null &"
112
+ sleep 1 # Wait for server to come up.
113
+ fi
114
}
1736
}
115
1737
116
_rm_test_img()
1738
_filter_img_info()
117
@@ -XXX,XX +XXX,XX @@ _cleanup_test_img()
118
fi
119
rm -f "$TEST_IMG_FILE"
120
;;
121
+ vxhs)
122
+ if [ -f "${TEST_DIR}/qemu-vxhs.pid" ]; then
123
+ local QEMU_VXHS_PID
124
+ read QEMU_VXHS_PID < "${TEST_DIR}/qemu-vxhs.pid"
125
+ kill ${QEMU_VXHS_PID} >/dev/null 2>&1
126
+ rm -f "${TEST_DIR}/qemu-vxhs.pid"
127
+ fi
128
+ rm -f "$TEST_IMG_FILE"
129
+ ;;
130
+
131
file)
132
_rm_test_img "$TEST_DIR/t.$IMGFMT"
133
_rm_test_img "$TEST_DIR/t.$IMGFMT.orig"
134
--
1739
--
135
2.9.3
1740
2.26.2
136
1741
137
1742
diff view generated by jsdifflib
1
A few block drivers will set the BDS read_only flag from their
1
From: Denis Plotnikov <dplotnikov@virtuozzo.com>
2
.bdrv_open() function. This means the bs->read_only flag could
3
be set after we enable copy_on_read, as the BDRV_O_COPY_ON_READ
4
flag check occurs prior to the call to bdrv->bdrv_open().
5
2
6
This adds an error return to bdrv_set_read_only(), and an error will be
3
The patch enables processing the image compression type defined
7
return if we try to set the BDS to read_only while copy_on_read is
4
for the image and chooses an appropriate method for image clusters
8
enabled.
5
(de)compression.
9
6
10
This patch also changes the behavior of vvfat. Before, vvfat could
7
Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
11
override the drive 'readonly' flag with its own, internal 'rw' flag.
8
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
9
Reviewed-by: Alberto Garcia <berto@igalia.com>
10
Reviewed-by: Max Reitz <mreitz@redhat.com>
11
Message-Id: <20200507082521.29210-3-dplotnikov@virtuozzo.com>
12
Signed-off-by: Max Reitz <mreitz@redhat.com>
13
---
14
block/qcow2-threads.c | 71 ++++++++++++++++++++++++++++++++++++-------
15
1 file changed, 60 insertions(+), 11 deletions(-)
12
16
13
For instance, this -drive parameter would result in a writable image:
17
diff --git a/block/qcow2-threads.c b/block/qcow2-threads.c
14
15
"-drive format=vvfat,dir=/tmp/vvfat,rw,if=virtio,readonly=on"
16
17
This is not correct. Now, attempting to use the above -drive parameter
18
will result in an error (i.e., 'rw' is incompatible with 'readonly=on').
19
20
Signed-off-by: Jeff Cody <jcody@redhat.com>
21
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
22
Reviewed-by: John Snow <jsnow@redhat.com>
23
Message-id: 0c5b4c1cc2c651471b131f21376dfd5ea24d2196.1491597120.git.jcody@redhat.com
24
---
25
block.c | 10 +++++++++-
26
block/bochs.c | 5 ++++-
27
block/cloop.c | 5 ++++-
28
block/dmg.c | 6 +++++-
29
block/rbd.c | 11 ++++++++++-
30
block/vvfat.c | 19 +++++++++++++++----
31
include/block/block.h | 2 +-
32
7 files changed, 48 insertions(+), 10 deletions(-)
33
34
diff --git a/block.c b/block.c
35
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
36
--- a/block.c
19
--- a/block/qcow2-threads.c
37
+++ b/block.c
20
+++ b/block/qcow2-threads.c
38
@@ -XXX,XX +XXX,XX @@ void path_combine(char *dest, int dest_size,
21
@@ -XXX,XX +XXX,XX @@ typedef struct Qcow2CompressData {
39
}
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,
40
}
44
}
41
45
42
-void bdrv_set_read_only(BlockDriverState *bs, bool read_only)
46
/*
43
+int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
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)
44
{
64
{
45
+ /* Do not set read_only if copy_on_read is enabled */
65
int ret;
46
+ if (bs->copy_on_read && read_only) {
66
z_stream strm;
47
+ error_setg(errp, "Can't set node '%s' to r/o with copy-on-read enabled",
67
@@ -XXX,XX +XXX,XX @@ qcow2_co_do_compress(BlockDriverState *bs, void *dest, size_t dest_size,
48
+ bdrv_get_device_or_node_name(bs));
68
return arg.ret;
49
+ return -EINVAL;
69
}
70
71
+/*
72
+ * qcow2_co_compress()
73
+ *
74
+ * Compress @src_size bytes of data using the compression
75
+ * method defined by the image compression type
76
+ *
77
+ * @dest - destination buffer, @dest_size bytes
78
+ * @src - source buffer, @src_size bytes
79
+ *
80
+ * Returns: compressed size on success
81
+ * a negative error code on failure
82
+ */
83
ssize_t coroutine_fn
84
qcow2_co_compress(BlockDriverState *bs, void *dest, size_t dest_size,
85
const void *src, size_t src_size)
86
{
87
- return qcow2_co_do_compress(bs, dest, dest_size, src, src_size,
88
- qcow2_compress);
89
+ BDRVQcow2State *s = bs->opaque;
90
+ Qcow2CompressFunc fn;
91
+
92
+ switch (s->compression_type) {
93
+ case QCOW2_COMPRESSION_TYPE_ZLIB:
94
+ fn = qcow2_zlib_compress;
95
+ break;
96
+
97
+ default:
98
+ abort();
50
+ }
99
+ }
51
+
100
+
52
bs->read_only = read_only;
101
+ return qcow2_co_do_compress(bs, dest, dest_size, src, src_size, fn);
53
+ return 0;
54
}
102
}
55
103
56
void bdrv_get_full_backing_filename_from_filename(const char *backed,
104
+/*
57
diff --git a/block/bochs.c b/block/bochs.c
105
+ * qcow2_co_decompress()
58
index XXXXXXX..XXXXXXX 100644
106
+ *
59
--- a/block/bochs.c
107
+ * Decompress some data (not more than @src_size bytes) to produce exactly
60
+++ b/block/bochs.c
108
+ * @dest_size bytes using the compression method defined by the image
61
@@ -XXX,XX +XXX,XX @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags,
109
+ * compression type
62
return -EINVAL;
110
+ *
63
}
111
+ * @dest - destination buffer, @dest_size bytes
64
112
+ * @src - source buffer, @src_size bytes
65
- bdrv_set_read_only(bs, true); /* no write support yet */
113
+ *
66
+ ret = bdrv_set_read_only(bs, true, errp); /* no write support yet */
114
+ * Returns: 0 on success
67
+ if (ret < 0) {
115
+ * a negative error code on failure
68
+ return ret;
116
+ */
69
+ }
117
ssize_t coroutine_fn
70
118
qcow2_co_decompress(BlockDriverState *bs, void *dest, size_t dest_size,
71
ret = bdrv_pread(bs->file, 0, &bochs, sizeof(bochs));
119
const void *src, size_t src_size)
72
if (ret < 0) {
120
{
73
diff --git a/block/cloop.c b/block/cloop.c
121
- return qcow2_co_do_compress(bs, dest, dest_size, src, src_size,
74
index XXXXXXX..XXXXXXX 100644
122
- qcow2_decompress);
75
--- a/block/cloop.c
123
+ BDRVQcow2State *s = bs->opaque;
76
+++ b/block/cloop.c
124
+ Qcow2CompressFunc fn;
77
@@ -XXX,XX +XXX,XX @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
125
+
78
return -EINVAL;
126
+ switch (s->compression_type) {
79
}
127
+ case QCOW2_COMPRESSION_TYPE_ZLIB:
80
128
+ fn = qcow2_zlib_decompress;
81
- bdrv_set_read_only(bs, true);
129
+ break;
82
+ ret = bdrv_set_read_only(bs, true, errp);
130
+
83
+ if (ret < 0) {
131
+ default:
84
+ return ret;
132
+ abort();
85
+ }
86
87
/* read header */
88
ret = bdrv_pread(bs->file, 128, &s->block_size, 4);
89
diff --git a/block/dmg.c b/block/dmg.c
90
index XXXXXXX..XXXXXXX 100644
91
--- a/block/dmg.c
92
+++ b/block/dmg.c
93
@@ -XXX,XX +XXX,XX @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags,
94
return -EINVAL;
95
}
96
97
+ ret = bdrv_set_read_only(bs, true, errp);
98
+ if (ret < 0) {
99
+ return ret;
100
+ }
133
+ }
101
+
134
+
102
block_module_load_one("dmg-bz2");
135
+ return qcow2_co_do_compress(bs, dest, dest_size, src, src_size, fn);
103
- bdrv_set_read_only(bs, true);
136
}
104
137
105
s->n_chunks = 0;
138
106
s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL;
107
diff --git a/block/rbd.c b/block/rbd.c
108
index XXXXXXX..XXXXXXX 100644
109
--- a/block/rbd.c
110
+++ b/block/rbd.c
111
@@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
112
goto failed_shutdown;
113
}
114
115
+ /* rbd_open is always r/w */
116
r = rbd_open(s->io_ctx, s->name, &s->image, s->snap);
117
if (r < 0) {
118
error_setg_errno(errp, -r, "error reading header from %s", s->name);
119
goto failed_open;
120
}
121
122
- bdrv_set_read_only(bs, (s->snap != NULL));
123
+ /* If we are using an rbd snapshot, we must be r/o, otherwise
124
+ * leave as-is */
125
+ if (s->snap != NULL) {
126
+ r = bdrv_set_read_only(bs, true, &local_err);
127
+ if (r < 0) {
128
+ error_propagate(errp, local_err);
129
+ goto failed_open;
130
+ }
131
+ }
132
133
qemu_opts_del(opts);
134
return 0;
135
diff --git a/block/vvfat.c b/block/vvfat.c
136
index XXXXXXX..XXXXXXX 100644
137
--- a/block/vvfat.c
138
+++ b/block/vvfat.c
139
@@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
140
141
s->current_cluster=0xffffffff;
142
143
- /* read only is the default for safety */
144
- bdrv_set_read_only(bs, true);
145
s->qcow = NULL;
146
s->qcow_filename = NULL;
147
s->fat2 = NULL;
148
@@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
149
s->sector_count = cyls * heads * secs - (s->first_sectors_number - 1);
150
151
if (qemu_opt_get_bool(opts, "rw", false)) {
152
- ret = enable_write_target(bs, errp);
153
+ if (!bdrv_is_read_only(bs)) {
154
+ ret = enable_write_target(bs, errp);
155
+ if (ret < 0) {
156
+ goto fail;
157
+ }
158
+ } else {
159
+ ret = -EPERM;
160
+ error_setg(errp,
161
+ "Unable to set VVFAT to 'rw' when drive is read-only");
162
+ goto fail;
163
+ }
164
+ } else {
165
+ /* read only is the default for safety */
166
+ ret = bdrv_set_read_only(bs, true, &local_err);
167
if (ret < 0) {
168
+ error_propagate(errp, local_err);
169
goto fail;
170
}
171
- bdrv_set_read_only(bs, false);
172
}
173
174
bs->total_sectors = cyls * heads * secs;
175
diff --git a/include/block/block.h b/include/block/block.h
176
index XXXXXXX..XXXXXXX 100644
177
--- a/include/block/block.h
178
+++ b/include/block/block.h
179
@@ -XXX,XX +XXX,XX @@ int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base,
180
int64_t sector_num, int nb_sectors, int *pnum);
181
182
bool bdrv_is_read_only(BlockDriverState *bs);
183
-void bdrv_set_read_only(BlockDriverState *bs, bool read_only);
184
+int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp);
185
bool bdrv_is_sg(BlockDriverState *bs);
186
bool bdrv_is_inserted(BlockDriverState *bs);
187
int bdrv_media_changed(BlockDriverState *bs);
188
--
139
--
189
2.9.3
140
2.26.2
190
141
191
142
diff view generated by jsdifflib
1
From: Ashish Mittal <ashmit602@gmail.com>
1
From: Denis Plotnikov <dplotnikov@virtuozzo.com>
2
2
3
Source code for the qnio library that this code loads can be downloaded from:
3
zstd significantly reduces cluster compression time.
4
https://github.com/VeritasHyperScale/libqnio.git
4
It provides better compression performance maintaining
5
5
the same level of the compression ratio in comparison with
6
Sample command line using JSON syntax:
6
zlib, which, at the moment, is the only compression
7
./x86_64-softmmu/qemu-system-x86_64 -name instance-00000008 -S -vnc 0.0.0.0:0
7
method available.
8
-k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
8
9
-msg timestamp=on
9
The performance test results:
10
'json:{"driver":"vxhs","vdisk-id":"c3e9095a-a5ee-4dce-afeb-2a59fb387410",
10
Test compresses and decompresses qemu qcow2 image with just
11
"server":{"host":"172.172.17.4","port":"9999"}}'
11
installed rhel-7.6 guest.
12
12
Image cluster size: 64K. Image on disk size: 2.2G
13
Sample command line using URI syntax:
13
14
qemu-img convert -f raw -O raw -n
14
The test was conducted with brd disk to reduce the influence
15
/var/lib/nova/instances/_base/0c5eacd5ebea5ed914b6a3e7b18f1ce734c386ad
15
of disk subsystem to the test results.
16
vxhs://192.168.0.1:9999/c6718f6b-0401-441d-a8c3-1f0064d75ee0
16
The results is given in seconds.
17
17
18
Sample command line using TLS credentials (run in secure mode):
18
compress cmd:
19
./qemu-io --object
19
time ./qemu-img convert -O qcow2 -c -o compression_type=[zlib|zstd]
20
tls-creds-x509,id=tls0,dir=/etc/pki/qemu/vxhs,endpoint=client -c 'read
20
src.img [zlib|zstd]_compressed.img
21
-v 66000 2.5k' 'json:{"server.host": "127.0.0.1", "server.port": "9999",
21
decompress cmd
22
"vdisk-id": "/test.raw", "driver": "vxhs", "tls-creds":"tls0"}'
22
time ./qemu-img convert -O qcow2
23
23
[zlib|zstd]_compressed.img uncompressed.img
24
Signed-off-by: Ashish Mittal <Ashish.Mittal@veritas.com>
24
25
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
25
compression decompression
26
Reviewed-by: Jeff Cody <jcody@redhat.com>
26
zlib zstd zlib zstd
27
Signed-off-by: Jeff Cody <jcody@redhat.com>
27
------------------------------------------------------------
28
Message-id: 1491277689-24949-2-git-send-email-Ashish.Mittal@veritas.com
28
real 65.5 16.3 (-75 %) 1.9 1.6 (-16 %)
29
user 65.0 15.8 5.3 2.5
30
sys 3.3 0.2 2.0 2.0
31
32
Both ZLIB and ZSTD gave the same compression ratio: 1.57
33
compressed image size in both cases: 1.4G
34
35
Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
36
QAPI part:
37
Acked-by: Markus Armbruster <armbru@redhat.com>
38
Message-Id: <20200507082521.29210-4-dplotnikov@virtuozzo.com>
39
Signed-off-by: Max Reitz <mreitz@redhat.com>
29
---
40
---
30
block/Makefile.objs | 2 +
41
docs/interop/qcow2.txt | 1 +
31
block/trace-events | 17 ++
42
configure | 2 +-
32
block/vxhs.c | 575 +++++++++++++++++++++++++++++++++++++++++++++++++++
43
qapi/block-core.json | 3 +-
33
configure | 39 ++++
44
block/qcow2-threads.c | 169 +++++++++++++++++++++++++++++++++++++++++
34
qapi/block-core.json | 23 ++-
45
block/qcow2.c | 7 ++
35
5 files changed, 654 insertions(+), 2 deletions(-)
46
5 files changed, 180 insertions(+), 2 deletions(-)
36
create mode 100644 block/vxhs.c
47
37
48
diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt
38
diff --git a/block/Makefile.objs b/block/Makefile.objs
39
index XXXXXXX..XXXXXXX 100644
49
index XXXXXXX..XXXXXXX 100644
40
--- a/block/Makefile.objs
50
--- a/docs/interop/qcow2.txt
41
+++ b/block/Makefile.objs
51
+++ b/docs/interop/qcow2.txt
42
@@ -XXX,XX +XXX,XX @@ block-obj-$(CONFIG_LIBNFS) += nfs.o
52
@@ -XXX,XX +XXX,XX @@ version 2.
43
block-obj-$(CONFIG_CURL) += curl.o
53
44
block-obj-$(CONFIG_RBD) += rbd.o
54
Available compression type values:
45
block-obj-$(CONFIG_GLUSTERFS) += gluster.o
55
0: zlib <https://www.zlib.net/>
46
+block-obj-$(CONFIG_VXHS) += vxhs.o
56
+ 1: zstd <http://github.com/facebook/zstd>
47
block-obj-$(CONFIG_LIBSSH2) += ssh.o
57
48
block-obj-y += accounting.o dirty-bitmap.o
58
49
block-obj-y += write-threshold.o
59
=== Header padding ===
50
@@ -XXX,XX +XXX,XX @@ rbd.o-cflags := $(RBD_CFLAGS)
51
rbd.o-libs := $(RBD_LIBS)
52
gluster.o-cflags := $(GLUSTERFS_CFLAGS)
53
gluster.o-libs := $(GLUSTERFS_LIBS)
54
+vxhs.o-libs := $(VXHS_LIBS)
55
ssh.o-cflags := $(LIBSSH2_CFLAGS)
56
ssh.o-libs := $(LIBSSH2_LIBS)
57
block-obj-$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
58
diff --git a/block/trace-events b/block/trace-events
59
index XXXXXXX..XXXXXXX 100644
60
--- a/block/trace-events
61
+++ b/block/trace-events
62
@@ -XXX,XX +XXX,XX @@ qed_aio_write_data(void *s, void *acb, int ret, uint64_t offset, size_t len) "s
63
qed_aio_write_prefill(void *s, void *acb, uint64_t start, size_t len, uint64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64
64
qed_aio_write_postfill(void *s, void *acb, uint64_t start, size_t len, uint64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64
65
qed_aio_write_main(void *s, void *acb, int ret, uint64_t offset, size_t len) "s %p acb %p ret %d offset %"PRIu64" len %zu"
66
+
67
+# block/vxhs.c
68
+vxhs_iio_callback(int error) "ctx is NULL: error %d"
69
+vxhs_iio_callback_chnfail(int err, int error) "QNIO channel failed, no i/o %d, %d"
70
+vxhs_iio_callback_unknwn(int opcode, int err) "unexpected opcode %d, errno %d"
71
+vxhs_aio_rw_invalid(int req) "Invalid I/O request iodir %d"
72
+vxhs_aio_rw_ioerr(char *guid, int iodir, uint64_t size, uint64_t off, void *acb, int ret, int err) "IO ERROR (vDisk %s) FOR : Read/Write = %d size = %lu offset = %lu ACB = %p. Error = %d, errno = %d"
73
+vxhs_get_vdisk_stat_err(char *guid, int ret, int err) "vDisk (%s) stat ioctl failed, ret = %d, errno = %d"
74
+vxhs_get_vdisk_stat(char *vdisk_guid, uint64_t vdisk_size) "vDisk %s stat ioctl returned size %lu"
75
+vxhs_complete_aio(void *acb, uint64_t ret) "aio failed acb %p ret %ld"
76
+vxhs_parse_uri_filename(const char *filename) "URI passed via bdrv_parse_filename %s"
77
+vxhs_open_vdiskid(const char *vdisk_id) "Opening vdisk-id %s"
78
+vxhs_open_hostinfo(char *of_vsa_addr, int port) "Adding host %s:%d to BDRVVXHSState"
79
+vxhs_open_iio_open(const char *host) "Failed to connect to storage agent on host %s"
80
+vxhs_parse_uri_hostinfo(char *host, int port) "Host: IP %s, Port %d"
81
+vxhs_close(char *vdisk_guid) "Closing vdisk %s"
82
+vxhs_get_creds(const char *cacert, const char *client_key, const char *client_cert) "cacert %s, client_key %s, client_cert %s"
83
diff --git a/block/vxhs.c b/block/vxhs.c
84
new file mode 100644
85
index XXXXXXX..XXXXXXX
86
--- /dev/null
87
+++ b/block/vxhs.c
88
@@ -XXX,XX +XXX,XX @@
89
+/*
90
+ * QEMU Block driver for Veritas HyperScale (VxHS)
91
+ *
92
+ * Copyright (c) 2017 Veritas Technologies LLC.
93
+ *
94
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
95
+ * See the COPYING file in the top-level directory.
96
+ *
97
+ */
98
+
99
+#include "qemu/osdep.h"
100
+#include <qnio/qnio_api.h>
101
+#include <sys/param.h>
102
+#include "block/block_int.h"
103
+#include "qapi/qmp/qerror.h"
104
+#include "qapi/qmp/qdict.h"
105
+#include "qapi/qmp/qstring.h"
106
+#include "trace.h"
107
+#include "qemu/uri.h"
108
+#include "qapi/error.h"
109
+#include "qemu/uuid.h"
110
+#include "crypto/tlscredsx509.h"
111
+
112
+#define VXHS_OPT_FILENAME "filename"
113
+#define VXHS_OPT_VDISK_ID "vdisk-id"
114
+#define VXHS_OPT_SERVER "server"
115
+#define VXHS_OPT_HOST "host"
116
+#define VXHS_OPT_PORT "port"
117
+
118
+/* Only accessed under QEMU global mutex */
119
+static uint32_t vxhs_ref;
120
+
121
+typedef enum {
122
+ VDISK_AIO_READ,
123
+ VDISK_AIO_WRITE,
124
+} VDISKAIOCmd;
125
+
126
+/*
127
+ * HyperScale AIO callbacks structure
128
+ */
129
+typedef struct VXHSAIOCB {
130
+ BlockAIOCB common;
131
+ int err;
132
+} VXHSAIOCB;
133
+
134
+typedef struct VXHSvDiskHostsInfo {
135
+ void *dev_handle; /* Device handle */
136
+ char *host; /* Host name or IP */
137
+ int port; /* Host's port number */
138
+} VXHSvDiskHostsInfo;
139
+
140
+/*
141
+ * Structure per vDisk maintained for state
142
+ */
143
+typedef struct BDRVVXHSState {
144
+ VXHSvDiskHostsInfo vdisk_hostinfo; /* Per host info */
145
+ char *vdisk_guid;
146
+ char *tlscredsid; /* tlscredsid */
147
+} BDRVVXHSState;
148
+
149
+static void vxhs_complete_aio_bh(void *opaque)
150
+{
151
+ VXHSAIOCB *acb = opaque;
152
+ BlockCompletionFunc *cb = acb->common.cb;
153
+ void *cb_opaque = acb->common.opaque;
154
+ int ret = 0;
155
+
156
+ if (acb->err != 0) {
157
+ trace_vxhs_complete_aio(acb, acb->err);
158
+ ret = (-EIO);
159
+ }
160
+
161
+ qemu_aio_unref(acb);
162
+ cb(cb_opaque, ret);
163
+}
164
+
165
+/*
166
+ * Called from a libqnio thread
167
+ */
168
+static void vxhs_iio_callback(void *ctx, uint32_t opcode, uint32_t error)
169
+{
170
+ VXHSAIOCB *acb = NULL;
171
+
172
+ switch (opcode) {
173
+ case IRP_READ_REQUEST:
174
+ case IRP_WRITE_REQUEST:
175
+
176
+ /*
177
+ * ctx is VXHSAIOCB*
178
+ * ctx is NULL if error is QNIOERROR_CHANNEL_HUP
179
+ */
180
+ if (ctx) {
181
+ acb = ctx;
182
+ } else {
183
+ trace_vxhs_iio_callback(error);
184
+ goto out;
185
+ }
186
+
187
+ if (error) {
188
+ if (!acb->err) {
189
+ acb->err = error;
190
+ }
191
+ trace_vxhs_iio_callback(error);
192
+ }
193
+
194
+ aio_bh_schedule_oneshot(bdrv_get_aio_context(acb->common.bs),
195
+ vxhs_complete_aio_bh, acb);
196
+ break;
197
+
198
+ default:
199
+ if (error == QNIOERROR_HUP) {
200
+ /*
201
+ * Channel failed, spontaneous notification,
202
+ * not in response to I/O
203
+ */
204
+ trace_vxhs_iio_callback_chnfail(error, errno);
205
+ } else {
206
+ trace_vxhs_iio_callback_unknwn(opcode, error);
207
+ }
208
+ break;
209
+ }
210
+out:
211
+ return;
212
+}
213
+
214
+static QemuOptsList runtime_opts = {
215
+ .name = "vxhs",
216
+ .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head),
217
+ .desc = {
218
+ {
219
+ .name = VXHS_OPT_FILENAME,
220
+ .type = QEMU_OPT_STRING,
221
+ .help = "URI to the Veritas HyperScale image",
222
+ },
223
+ {
224
+ .name = VXHS_OPT_VDISK_ID,
225
+ .type = QEMU_OPT_STRING,
226
+ .help = "UUID of the VxHS vdisk",
227
+ },
228
+ {
229
+ .name = "tls-creds",
230
+ .type = QEMU_OPT_STRING,
231
+ .help = "ID of the TLS/SSL credentials to use",
232
+ },
233
+ { /* end of list */ }
234
+ },
235
+};
236
+
237
+static QemuOptsList runtime_tcp_opts = {
238
+ .name = "vxhs_tcp",
239
+ .head = QTAILQ_HEAD_INITIALIZER(runtime_tcp_opts.head),
240
+ .desc = {
241
+ {
242
+ .name = VXHS_OPT_HOST,
243
+ .type = QEMU_OPT_STRING,
244
+ .help = "host address (ipv4 addresses)",
245
+ },
246
+ {
247
+ .name = VXHS_OPT_PORT,
248
+ .type = QEMU_OPT_NUMBER,
249
+ .help = "port number on which VxHSD is listening (default 9999)",
250
+ .def_value_str = "9999"
251
+ },
252
+ { /* end of list */ }
253
+ },
254
+};
255
+
256
+/*
257
+ * Parse incoming URI and populate *options with the host
258
+ * and device information
259
+ */
260
+static int vxhs_parse_uri(const char *filename, QDict *options)
261
+{
262
+ URI *uri = NULL;
263
+ char *port;
264
+ int ret = 0;
265
+
266
+ trace_vxhs_parse_uri_filename(filename);
267
+ uri = uri_parse(filename);
268
+ if (!uri || !uri->server || !uri->path) {
269
+ uri_free(uri);
270
+ return -EINVAL;
271
+ }
272
+
273
+ qdict_put(options, VXHS_OPT_SERVER".host", qstring_from_str(uri->server));
274
+
275
+ if (uri->port) {
276
+ port = g_strdup_printf("%d", uri->port);
277
+ qdict_put(options, VXHS_OPT_SERVER".port", qstring_from_str(port));
278
+ g_free(port);
279
+ }
280
+
281
+ qdict_put(options, "vdisk-id", qstring_from_str(uri->path));
282
+
283
+ trace_vxhs_parse_uri_hostinfo(uri->server, uri->port);
284
+ uri_free(uri);
285
+
286
+ return ret;
287
+}
288
+
289
+static void vxhs_parse_filename(const char *filename, QDict *options,
290
+ Error **errp)
291
+{
292
+ if (qdict_haskey(options, "vdisk-id") || qdict_haskey(options, "server")) {
293
+ error_setg(errp, "vdisk-id/server and a file name may not be specified "
294
+ "at the same time");
295
+ return;
296
+ }
297
+
298
+ if (strstr(filename, "://")) {
299
+ int ret = vxhs_parse_uri(filename, options);
300
+ if (ret < 0) {
301
+ error_setg(errp, "Invalid URI. URI should be of the form "
302
+ " vxhs://<host_ip>:<port>/<vdisk-id>");
303
+ }
304
+ }
305
+}
306
+
307
+static int vxhs_init_and_ref(void)
308
+{
309
+ if (vxhs_ref++ == 0) {
310
+ if (iio_init(QNIO_VERSION, vxhs_iio_callback)) {
311
+ return -ENODEV;
312
+ }
313
+ }
314
+ return 0;
315
+}
316
+
317
+static void vxhs_unref(void)
318
+{
319
+ if (--vxhs_ref == 0) {
320
+ iio_fini();
321
+ }
322
+}
323
+
324
+static void vxhs_get_tls_creds(const char *id, char **cacert,
325
+ char **key, char **cert, Error **errp)
326
+{
327
+ Object *obj;
328
+ QCryptoTLSCreds *creds;
329
+ QCryptoTLSCredsX509 *creds_x509;
330
+
331
+ obj = object_resolve_path_component(
332
+ object_get_objects_root(), id);
333
+
334
+ if (!obj) {
335
+ error_setg(errp, "No TLS credentials with id '%s'",
336
+ id);
337
+ return;
338
+ }
339
+
340
+ creds_x509 = (QCryptoTLSCredsX509 *)
341
+ object_dynamic_cast(obj, TYPE_QCRYPTO_TLS_CREDS_X509);
342
+
343
+ if (!creds_x509) {
344
+ error_setg(errp, "Object with id '%s' is not TLS credentials",
345
+ id);
346
+ return;
347
+ }
348
+
349
+ creds = &creds_x509->parent_obj;
350
+
351
+ if (creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) {
352
+ error_setg(errp,
353
+ "Expecting TLS credentials with a client endpoint");
354
+ return;
355
+ }
356
+
357
+ /*
358
+ * Get the cacert, client_cert and client_key file names.
359
+ */
360
+ if (!creds->dir) {
361
+ error_setg(errp, "TLS object missing 'dir' property value");
362
+ return;
363
+ }
364
+
365
+ *cacert = g_strdup_printf("%s/%s", creds->dir,
366
+ QCRYPTO_TLS_CREDS_X509_CA_CERT);
367
+ *cert = g_strdup_printf("%s/%s", creds->dir,
368
+ QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
369
+ *key = g_strdup_printf("%s/%s", creds->dir,
370
+ QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
371
+}
372
+
373
+static int vxhs_open(BlockDriverState *bs, QDict *options,
374
+ int bdrv_flags, Error **errp)
375
+{
376
+ BDRVVXHSState *s = bs->opaque;
377
+ void *dev_handlep;
378
+ QDict *backing_options = NULL;
379
+ QemuOpts *opts = NULL;
380
+ QemuOpts *tcp_opts = NULL;
381
+ char *of_vsa_addr = NULL;
382
+ Error *local_err = NULL;
383
+ const char *vdisk_id_opt;
384
+ const char *server_host_opt;
385
+ int ret = 0;
386
+ char *cacert = NULL;
387
+ char *client_key = NULL;
388
+ char *client_cert = NULL;
389
+
390
+ ret = vxhs_init_and_ref();
391
+ if (ret < 0) {
392
+ ret = -EINVAL;
393
+ goto out;
394
+ }
395
+
396
+ /* Create opts info from runtime_opts and runtime_tcp_opts list */
397
+ opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
398
+ tcp_opts = qemu_opts_create(&runtime_tcp_opts, NULL, 0, &error_abort);
399
+
400
+ qemu_opts_absorb_qdict(opts, options, &local_err);
401
+ if (local_err) {
402
+ ret = -EINVAL;
403
+ goto out;
404
+ }
405
+
406
+ /* vdisk-id is the disk UUID */
407
+ vdisk_id_opt = qemu_opt_get(opts, VXHS_OPT_VDISK_ID);
408
+ if (!vdisk_id_opt) {
409
+ error_setg(&local_err, QERR_MISSING_PARAMETER, VXHS_OPT_VDISK_ID);
410
+ ret = -EINVAL;
411
+ goto out;
412
+ }
413
+
414
+ /* vdisk-id may contain a leading '/' */
415
+ if (strlen(vdisk_id_opt) > UUID_FMT_LEN + 1) {
416
+ error_setg(&local_err, "vdisk-id cannot be more than %d characters",
417
+ UUID_FMT_LEN);
418
+ ret = -EINVAL;
419
+ goto out;
420
+ }
421
+
422
+ s->vdisk_guid = g_strdup(vdisk_id_opt);
423
+ trace_vxhs_open_vdiskid(vdisk_id_opt);
424
+
425
+ /* get the 'server.' arguments */
426
+ qdict_extract_subqdict(options, &backing_options, VXHS_OPT_SERVER".");
427
+
428
+ qemu_opts_absorb_qdict(tcp_opts, backing_options, &local_err);
429
+ if (local_err != NULL) {
430
+ ret = -EINVAL;
431
+ goto out;
432
+ }
433
+
434
+ server_host_opt = qemu_opt_get(tcp_opts, VXHS_OPT_HOST);
435
+ if (!server_host_opt) {
436
+ error_setg(&local_err, QERR_MISSING_PARAMETER,
437
+ VXHS_OPT_SERVER"."VXHS_OPT_HOST);
438
+ ret = -EINVAL;
439
+ goto out;
440
+ }
441
+
442
+ if (strlen(server_host_opt) > MAXHOSTNAMELEN) {
443
+ error_setg(&local_err, "server.host cannot be more than %d characters",
444
+ MAXHOSTNAMELEN);
445
+ ret = -EINVAL;
446
+ goto out;
447
+ }
448
+
449
+ /* check if we got tls-creds via the --object argument */
450
+ s->tlscredsid = g_strdup(qemu_opt_get(opts, "tls-creds"));
451
+ if (s->tlscredsid) {
452
+ vxhs_get_tls_creds(s->tlscredsid, &cacert, &client_key,
453
+ &client_cert, &local_err);
454
+ if (local_err != NULL) {
455
+ ret = -EINVAL;
456
+ goto out;
457
+ }
458
+ trace_vxhs_get_creds(cacert, client_key, client_cert);
459
+ }
460
+
461
+ s->vdisk_hostinfo.host = g_strdup(server_host_opt);
462
+ s->vdisk_hostinfo.port = g_ascii_strtoll(qemu_opt_get(tcp_opts,
463
+ VXHS_OPT_PORT),
464
+ NULL, 0);
465
+
466
+ trace_vxhs_open_hostinfo(s->vdisk_hostinfo.host,
467
+ s->vdisk_hostinfo.port);
468
+
469
+ of_vsa_addr = g_strdup_printf("of://%s:%d",
470
+ s->vdisk_hostinfo.host,
471
+ s->vdisk_hostinfo.port);
472
+
473
+ /*
474
+ * Open qnio channel to storage agent if not opened before
475
+ */
476
+ dev_handlep = iio_open(of_vsa_addr, s->vdisk_guid, 0,
477
+ cacert, client_key, client_cert);
478
+ if (dev_handlep == NULL) {
479
+ trace_vxhs_open_iio_open(of_vsa_addr);
480
+ ret = -ENODEV;
481
+ goto out;
482
+ }
483
+ s->vdisk_hostinfo.dev_handle = dev_handlep;
484
+
485
+out:
486
+ g_free(of_vsa_addr);
487
+ QDECREF(backing_options);
488
+ qemu_opts_del(tcp_opts);
489
+ qemu_opts_del(opts);
490
+ g_free(cacert);
491
+ g_free(client_key);
492
+ g_free(client_cert);
493
+
494
+ if (ret < 0) {
495
+ vxhs_unref();
496
+ error_propagate(errp, local_err);
497
+ g_free(s->vdisk_hostinfo.host);
498
+ g_free(s->vdisk_guid);
499
+ g_free(s->tlscredsid);
500
+ s->vdisk_guid = NULL;
501
+ }
502
+
503
+ return ret;
504
+}
505
+
506
+static const AIOCBInfo vxhs_aiocb_info = {
507
+ .aiocb_size = sizeof(VXHSAIOCB)
508
+};
509
+
510
+/*
511
+ * This allocates QEMU-VXHS callback for each IO
512
+ * and is passed to QNIO. When QNIO completes the work,
513
+ * it will be passed back through the callback.
514
+ */
515
+static BlockAIOCB *vxhs_aio_rw(BlockDriverState *bs, int64_t sector_num,
516
+ QEMUIOVector *qiov, int nb_sectors,
517
+ BlockCompletionFunc *cb, void *opaque,
518
+ VDISKAIOCmd iodir)
519
+{
520
+ VXHSAIOCB *acb = NULL;
521
+ BDRVVXHSState *s = bs->opaque;
522
+ size_t size;
523
+ uint64_t offset;
524
+ int iio_flags = 0;
525
+ int ret = 0;
526
+ void *dev_handle = s->vdisk_hostinfo.dev_handle;
527
+
528
+ offset = sector_num * BDRV_SECTOR_SIZE;
529
+ size = nb_sectors * BDRV_SECTOR_SIZE;
530
+ acb = qemu_aio_get(&vxhs_aiocb_info, bs, cb, opaque);
531
+
532
+ /*
533
+ * Initialize VXHSAIOCB.
534
+ */
535
+ acb->err = 0;
536
+
537
+ iio_flags = IIO_FLAG_ASYNC;
538
+
539
+ switch (iodir) {
540
+ case VDISK_AIO_WRITE:
541
+ ret = iio_writev(dev_handle, acb, qiov->iov, qiov->niov,
542
+ offset, (uint64_t)size, iio_flags);
543
+ break;
544
+ case VDISK_AIO_READ:
545
+ ret = iio_readv(dev_handle, acb, qiov->iov, qiov->niov,
546
+ offset, (uint64_t)size, iio_flags);
547
+ break;
548
+ default:
549
+ trace_vxhs_aio_rw_invalid(iodir);
550
+ goto errout;
551
+ }
552
+
553
+ if (ret != 0) {
554
+ trace_vxhs_aio_rw_ioerr(s->vdisk_guid, iodir, size, offset,
555
+ acb, ret, errno);
556
+ goto errout;
557
+ }
558
+ return &acb->common;
559
+
560
+errout:
561
+ qemu_aio_unref(acb);
562
+ return NULL;
563
+}
564
+
565
+static BlockAIOCB *vxhs_aio_readv(BlockDriverState *bs,
566
+ int64_t sector_num, QEMUIOVector *qiov,
567
+ int nb_sectors,
568
+ BlockCompletionFunc *cb, void *opaque)
569
+{
570
+ return vxhs_aio_rw(bs, sector_num, qiov, nb_sectors, cb,
571
+ opaque, VDISK_AIO_READ);
572
+}
573
+
574
+static BlockAIOCB *vxhs_aio_writev(BlockDriverState *bs,
575
+ int64_t sector_num, QEMUIOVector *qiov,
576
+ int nb_sectors,
577
+ BlockCompletionFunc *cb, void *opaque)
578
+{
579
+ return vxhs_aio_rw(bs, sector_num, qiov, nb_sectors,
580
+ cb, opaque, VDISK_AIO_WRITE);
581
+}
582
+
583
+static void vxhs_close(BlockDriverState *bs)
584
+{
585
+ BDRVVXHSState *s = bs->opaque;
586
+
587
+ trace_vxhs_close(s->vdisk_guid);
588
+
589
+ g_free(s->vdisk_guid);
590
+ s->vdisk_guid = NULL;
591
+
592
+ /*
593
+ * Close vDisk device
594
+ */
595
+ if (s->vdisk_hostinfo.dev_handle) {
596
+ iio_close(s->vdisk_hostinfo.dev_handle);
597
+ s->vdisk_hostinfo.dev_handle = NULL;
598
+ }
599
+
600
+ vxhs_unref();
601
+
602
+ /*
603
+ * Free the dynamically allocated host string etc
604
+ */
605
+ g_free(s->vdisk_hostinfo.host);
606
+ g_free(s->tlscredsid);
607
+ s->tlscredsid = NULL;
608
+ s->vdisk_hostinfo.host = NULL;
609
+ s->vdisk_hostinfo.port = 0;
610
+}
611
+
612
+static int64_t vxhs_get_vdisk_stat(BDRVVXHSState *s)
613
+{
614
+ int64_t vdisk_size = -1;
615
+ int ret = 0;
616
+ void *dev_handle = s->vdisk_hostinfo.dev_handle;
617
+
618
+ ret = iio_ioctl(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0);
619
+ if (ret < 0) {
620
+ trace_vxhs_get_vdisk_stat_err(s->vdisk_guid, ret, errno);
621
+ return -EIO;
622
+ }
623
+
624
+ trace_vxhs_get_vdisk_stat(s->vdisk_guid, vdisk_size);
625
+ return vdisk_size;
626
+}
627
+
628
+/*
629
+ * Returns the size of vDisk in bytes. This is required
630
+ * by QEMU block upper block layer so that it is visible
631
+ * to guest.
632
+ */
633
+static int64_t vxhs_getlength(BlockDriverState *bs)
634
+{
635
+ BDRVVXHSState *s = bs->opaque;
636
+ int64_t vdisk_size;
637
+
638
+ vdisk_size = vxhs_get_vdisk_stat(s);
639
+ if (vdisk_size < 0) {
640
+ return -EIO;
641
+ }
642
+
643
+ return vdisk_size;
644
+}
645
+
646
+static BlockDriver bdrv_vxhs = {
647
+ .format_name = "vxhs",
648
+ .protocol_name = "vxhs",
649
+ .instance_size = sizeof(BDRVVXHSState),
650
+ .bdrv_file_open = vxhs_open,
651
+ .bdrv_parse_filename = vxhs_parse_filename,
652
+ .bdrv_close = vxhs_close,
653
+ .bdrv_getlength = vxhs_getlength,
654
+ .bdrv_aio_readv = vxhs_aio_readv,
655
+ .bdrv_aio_writev = vxhs_aio_writev,
656
+};
657
+
658
+static void bdrv_vxhs_init(void)
659
+{
660
+ bdrv_register(&bdrv_vxhs);
661
+}
662
+
663
+block_init(bdrv_vxhs_init);
664
diff --git a/configure b/configure
60
diff --git a/configure b/configure
665
index XXXXXXX..XXXXXXX 100755
61
index XXXXXXX..XXXXXXX 100755
666
--- a/configure
62
--- a/configure
667
+++ b/configure
63
+++ b/configure
668
@@ -XXX,XX +XXX,XX @@ numa=""
669
tcmalloc="no"
670
jemalloc="no"
671
replication="yes"
672
+vxhs=""
673
674
supported_cpu="no"
675
supported_os="no"
676
@@ -XXX,XX +XXX,XX @@ for opt do
677
;;
678
--enable-replication) replication="yes"
679
;;
680
+ --disable-vxhs) vxhs="no"
681
+ ;;
682
+ --enable-vxhs) vxhs="yes"
683
+ ;;
684
*)
685
echo "ERROR: unknown option $opt"
686
echo "Try '$0 --help' for more information"
687
@@ -XXX,XX +XXX,XX @@ disabled with --disable-FEATURE, default is enabled if available:
64
@@ -XXX,XX +XXX,XX @@ disabled with --disable-FEATURE, default is enabled if available:
688
xfsctl xfsctl support
65
lzfse support of lzfse compression library
689
qom-cast-debug cast debugging support
66
(for reading lzfse-compressed dmg images)
690
tools build qemu-io, qemu-nbd and qemu-image tools
67
zstd support for zstd compression library
691
+ vxhs Veritas HyperScale vDisk backend support
68
- (for migration compression)
692
69
+ (for migration compression and qcow2 cluster compression)
693
NOTE: The object files are built at the place where configure is launched
70
seccomp seccomp support
694
EOF
71
coroutine-pool coroutine freelist (better performance)
695
@@ -XXX,XX +XXX,XX @@ if compile_prog "" "" ; then
72
glusterfs GlusterFS backend
696
fi
697
698
##########################################
699
+# Veritas HyperScale block driver VxHS
700
+# Check if libvxhs is installed
701
+
702
+if test "$vxhs" != "no" ; then
703
+ cat > $TMPC <<EOF
704
+#include <stdint.h>
705
+#include <qnio/qnio_api.h>
706
+
707
+void *vxhs_callback;
708
+
709
+int main(void) {
710
+ iio_init(QNIO_VERSION, vxhs_callback);
711
+ return 0;
712
+}
713
+EOF
714
+ vxhs_libs="-lvxhs -lssl"
715
+ if compile_prog "" "$vxhs_libs" ; then
716
+ vxhs=yes
717
+ else
718
+ if test "$vxhs" = "yes" ; then
719
+ feature_not_found "vxhs block device" "Install libvxhs See github"
720
+ fi
721
+ vxhs=no
722
+ fi
723
+fi
724
+
725
+##########################################
726
# End of CC checks
727
# After here, no more $cc or $ld runs
728
729
@@ -XXX,XX +XXX,XX @@ echo "tcmalloc support $tcmalloc"
730
echo "jemalloc support $jemalloc"
731
echo "avx2 optimization $avx2_opt"
732
echo "replication support $replication"
733
+echo "VxHS block device $vxhs"
734
735
if test "$sdl_too_old" = "yes"; then
736
echo "-> Your SDL version is too old - please upgrade to have SDL support"
737
@@ -XXX,XX +XXX,XX @@ if test "$pthread_setname_np" = "yes" ; then
738
echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
739
fi
740
741
+if test "$vxhs" = "yes" ; then
742
+ echo "CONFIG_VXHS=y" >> $config_host_mak
743
+ echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
744
+fi
745
+
746
if test "$tcg_interpreter" = "yes"; then
747
QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
748
elif test "$ARCH" = "sparc64" ; then
749
diff --git a/qapi/block-core.json b/qapi/block-core.json
73
diff --git a/qapi/block-core.json b/qapi/block-core.json
750
index XXXXXXX..XXXXXXX 100644
74
index XXXXXXX..XXXXXXX 100644
751
--- a/qapi/block-core.json
75
--- a/qapi/block-core.json
752
+++ b/qapi/block-core.json
76
+++ b/qapi/block-core.json
753
@@ -XXX,XX +XXX,XX @@
77
@@ -XXX,XX +XXX,XX @@
78
# Compression type used in qcow2 image file
754
#
79
#
755
# Drivers that are supported in block device operations.
80
# @zlib: zlib compression, see <http://zlib.net/>
81
+# @zstd: zstd compression, see <http://github.com/facebook/zstd>
756
#
82
#
757
+# @vxhs: Since 2.10
83
# Since: 5.1
758
+#
759
# Since: 2.9
760
##
84
##
761
{ 'enum': 'BlockdevDriver',
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
762
@@ -XXX,XX +XXX,XX @@
95
@@ -XXX,XX +XXX,XX @@
763
'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',
96
#define ZLIB_CONST
764
'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed',
97
#include <zlib.h>
765
'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh',
98
766
- 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
99
+#ifdef CONFIG_ZSTD
767
+ 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
100
+#include <zstd.h>
768
101
+#include <zstd_errors.h>
769
##
102
+#endif
770
# @BlockdevOptionsFile:
103
+
771
@@ -XXX,XX +XXX,XX @@
104
#include "qcow2.h"
772
'data': { '*offset': 'int', '*size': 'int' } }
105
#include "block/thread-pool.h"
773
106
#include "crypto.h"
774
##
107
@@ -XXX,XX +XXX,XX @@ static ssize_t qcow2_zlib_decompress(void *dest, size_t dest_size,
775
+# @BlockdevOptionsVxHS:
108
return ret;
776
+#
109
}
777
+# Driver specific block device options for VxHS
110
778
+#
111
+#ifdef CONFIG_ZSTD
779
+# @vdisk-id: UUID of VxHS volume
112
+
780
+# @server: vxhs server IP, port
113
+/*
781
+# @tls-creds: TLS credentials ID
114
+ * qcow2_zstd_compress()
782
+#
115
+ *
783
+# Since: 2.10
116
+ * Compress @src_size bytes of data using zstd compression method
784
+##
117
+ *
785
+{ 'struct': 'BlockdevOptionsVxHS',
118
+ * @dest - destination buffer, @dest_size bytes
786
+ 'data': { 'vdisk-id': 'str',
119
+ * @src - source buffer, @src_size bytes
787
+ 'server': 'InetSocketAddressBase',
120
+ *
788
+ '*tls-creds': 'str' } }
121
+ * Returns: compressed size on success
789
+
122
+ * -ENOMEM destination buffer is not enough to store compressed data
790
+##
123
+ * -EIO on any other error
791
# @BlockdevOptions:
124
+ */
792
#
125
+static ssize_t qcow2_zstd_compress(void *dest, size_t dest_size,
793
# Options for creating a block device. Many options are available for all
126
+ const void *src, size_t src_size)
794
@@ -XXX,XX +XXX,XX @@
127
+{
795
'vhdx': 'BlockdevOptionsGenericFormat',
128
+ ssize_t ret;
796
'vmdk': 'BlockdevOptionsGenericCOWFormat',
129
+ size_t zstd_ret;
797
'vpc': 'BlockdevOptionsGenericFormat',
130
+ ZSTD_outBuffer output = {
798
- 'vvfat': 'BlockdevOptionsVVFAT'
131
+ .dst = dest,
799
+ 'vvfat': 'BlockdevOptionsVVFAT',
132
+ .size = dest_size,
800
+ 'vxhs': 'BlockdevOptionsVxHS'
133
+ .pos = 0
801
} }
134
+ };
802
135
+ ZSTD_inBuffer input = {
803
##
136
+ .src = src,
137
+ .size = src_size,
138
+ .pos = 0
139
+ };
140
+ ZSTD_CCtx *cctx = ZSTD_createCCtx();
141
+
142
+ if (!cctx) {
143
+ return -EIO;
144
+ }
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);
178
+ return ret;
179
+}
180
+
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)
266
{
267
Qcow2CompressData *data = opaque;
268
@@ -XXX,XX +XXX,XX @@ qcow2_co_compress(BlockDriverState *bs, void *dest, size_t dest_size,
269
fn = qcow2_zlib_compress;
270
break;
271
272
+#ifdef CONFIG_ZSTD
273
+ case QCOW2_COMPRESSION_TYPE_ZSTD:
274
+ fn = qcow2_zstd_compress;
275
+ break;
276
+#endif
277
default:
278
abort();
279
}
280
@@ -XXX,XX +XXX,XX @@ qcow2_co_decompress(BlockDriverState *bs, void *dest, size_t dest_size,
281
fn = qcow2_zlib_decompress;
282
break;
283
284
+#ifdef CONFIG_ZSTD
285
+ case QCOW2_COMPRESSION_TYPE_ZSTD:
286
+ fn = qcow2_zstd_decompress;
287
+ break;
288
+#endif
289
default:
290
abort();
291
}
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)
307
}
308
309
switch (qcow2_opts->compression_type) {
310
+#ifdef CONFIG_ZSTD
311
+ case QCOW2_COMPRESSION_TYPE_ZSTD:
312
+ break;
313
+#endif
314
default:
315
error_setg(errp, "Unknown compression type");
316
goto out;
804
--
317
--
805
2.9.3
318
2.26.2
806
319
807
320
diff view generated by jsdifflib
Deleted patch
1
The protocol VXHS does not support image creation. Some tests expect
2
to be able to create images through the protocol. Exclude VXHS from
3
these tests.
4
1
5
Signed-off-by: Jeff Cody <jcody@redhat.com>
6
---
7
tests/qemu-iotests/017 | 1 +
8
tests/qemu-iotests/020 | 1 +
9
tests/qemu-iotests/029 | 1 +
10
tests/qemu-iotests/073 | 1 +
11
tests/qemu-iotests/114 | 1 +
12
tests/qemu-iotests/130 | 1 +
13
tests/qemu-iotests/134 | 1 +
14
tests/qemu-iotests/156 | 1 +
15
tests/qemu-iotests/158 | 1 +
16
9 files changed, 9 insertions(+)
17
18
diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017
19
index XXXXXXX..XXXXXXX 100755
20
--- a/tests/qemu-iotests/017
21
+++ b/tests/qemu-iotests/017
22
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
23
# Any format supporting backing files
24
_supported_fmt qcow qcow2 vmdk qed
25
_supported_proto generic
26
+_unsupported_proto vxhs
27
_supported_os Linux
28
_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat"
29
30
diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
31
index XXXXXXX..XXXXXXX 100755
32
--- a/tests/qemu-iotests/020
33
+++ b/tests/qemu-iotests/020
34
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
35
# Any format supporting backing files
36
_supported_fmt qcow qcow2 vmdk qed
37
_supported_proto generic
38
+_unsupported_proto vxhs
39
_supported_os Linux
40
_unsupported_imgopts "subformat=monolithicFlat" \
41
"subformat=twoGbMaxExtentFlat" \
42
diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029
43
index XXXXXXX..XXXXXXX 100755
44
--- a/tests/qemu-iotests/029
45
+++ b/tests/qemu-iotests/029
46
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
47
# Any format supporting intenal snapshots
48
_supported_fmt qcow2
49
_supported_proto generic
50
+_unsupported_proto vxhs
51
_supported_os Linux
52
# Internal snapshots are (currently) impossible with refcount_bits=1
53
_unsupported_imgopts 'refcount_bits=1[^0-9]'
54
diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073
55
index XXXXXXX..XXXXXXX 100755
56
--- a/tests/qemu-iotests/073
57
+++ b/tests/qemu-iotests/073
58
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
59
60
_supported_fmt qcow2
61
_supported_proto generic
62
+_unsupported_proto vxhs
63
_supported_os Linux
64
65
CLUSTER_SIZE=64k
66
diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114
67
index XXXXXXX..XXXXXXX 100755
68
--- a/tests/qemu-iotests/114
69
+++ b/tests/qemu-iotests/114
70
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
71
72
_supported_fmt qcow2
73
_supported_proto generic
74
+_unsupported_proto vxhs
75
_supported_os Linux
76
77
78
diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130
79
index XXXXXXX..XXXXXXX 100755
80
--- a/tests/qemu-iotests/130
81
+++ b/tests/qemu-iotests/130
82
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
83
84
_supported_fmt qcow2
85
_supported_proto generic
86
+_unsupported_proto vxhs
87
_supported_os Linux
88
89
qemu_comm_method="monitor"
90
diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134
91
index XXXXXXX..XXXXXXX 100755
92
--- a/tests/qemu-iotests/134
93
+++ b/tests/qemu-iotests/134
94
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
95
96
_supported_fmt qcow2
97
_supported_proto generic
98
+_unsupported_proto vxhs
99
_supported_os Linux
100
101
102
diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
103
index XXXXXXX..XXXXXXX 100755
104
--- a/tests/qemu-iotests/156
105
+++ b/tests/qemu-iotests/156
106
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
107
108
_supported_fmt qcow2 qed
109
_supported_proto generic
110
+_unsupported_proto vxhs
111
_supported_os Linux
112
113
# Create source disk
114
diff --git a/tests/qemu-iotests/158 b/tests/qemu-iotests/158
115
index XXXXXXX..XXXXXXX 100755
116
--- a/tests/qemu-iotests/158
117
+++ b/tests/qemu-iotests/158
118
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
119
120
_supported_fmt qcow2
121
_supported_proto generic
122
+_unsupported_proto vxhs
123
_supported_os Linux
124
125
126
--
127
2.9.3
128
129
diff view generated by jsdifflib
Deleted patch
1
We have a helper wrapper for checking for the BDS read_only flag,
2
add a helper wrapper to set the read_only flag as well.
3
1
4
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
5
Signed-off-by: Jeff Cody <jcody@redhat.com>
6
Reviewed-by: John Snow <jsnow@redhat.com>
7
Message-id: 9b18972d05f5fa2ac16c014f0af98d680553048d.1491597120.git.jcody@redhat.com
8
---
9
block.c | 5 +++++
10
block/bochs.c | 2 +-
11
block/cloop.c | 2 +-
12
block/dmg.c | 2 +-
13
block/rbd.c | 2 +-
14
block/vvfat.c | 4 ++--
15
include/block/block.h | 1 +
16
7 files changed, 12 insertions(+), 6 deletions(-)
17
18
diff --git a/block.c b/block.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/block.c
21
+++ b/block.c
22
@@ -XXX,XX +XXX,XX @@ void path_combine(char *dest, int dest_size,
23
}
24
}
25
26
+void bdrv_set_read_only(BlockDriverState *bs, bool read_only)
27
+{
28
+ bs->read_only = read_only;
29
+}
30
+
31
void bdrv_get_full_backing_filename_from_filename(const char *backed,
32
const char *backing,
33
char *dest, size_t sz,
34
diff --git a/block/bochs.c b/block/bochs.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/block/bochs.c
37
+++ b/block/bochs.c
38
@@ -XXX,XX +XXX,XX @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags,
39
return -EINVAL;
40
}
41
42
- bs->read_only = true; /* no write support yet */
43
+ bdrv_set_read_only(bs, true); /* no write support yet */
44
45
ret = bdrv_pread(bs->file, 0, &bochs, sizeof(bochs));
46
if (ret < 0) {
47
diff --git a/block/cloop.c b/block/cloop.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/block/cloop.c
50
+++ b/block/cloop.c
51
@@ -XXX,XX +XXX,XX @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
52
return -EINVAL;
53
}
54
55
- bs->read_only = true;
56
+ bdrv_set_read_only(bs, true);
57
58
/* read header */
59
ret = bdrv_pread(bs->file, 128, &s->block_size, 4);
60
diff --git a/block/dmg.c b/block/dmg.c
61
index XXXXXXX..XXXXXXX 100644
62
--- a/block/dmg.c
63
+++ b/block/dmg.c
64
@@ -XXX,XX +XXX,XX @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags,
65
}
66
67
block_module_load_one("dmg-bz2");
68
- bs->read_only = true;
69
+ bdrv_set_read_only(bs, true);
70
71
s->n_chunks = 0;
72
s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL;
73
diff --git a/block/rbd.c b/block/rbd.c
74
index XXXXXXX..XXXXXXX 100644
75
--- a/block/rbd.c
76
+++ b/block/rbd.c
77
@@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
78
goto failed_open;
79
}
80
81
- bs->read_only = (s->snap != NULL);
82
+ bdrv_set_read_only(bs, (s->snap != NULL));
83
84
qemu_opts_del(opts);
85
return 0;
86
diff --git a/block/vvfat.c b/block/vvfat.c
87
index XXXXXXX..XXXXXXX 100644
88
--- a/block/vvfat.c
89
+++ b/block/vvfat.c
90
@@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
91
s->current_cluster=0xffffffff;
92
93
/* read only is the default for safety */
94
- bs->read_only = true;
95
+ bdrv_set_read_only(bs, true);
96
s->qcow = NULL;
97
s->qcow_filename = NULL;
98
s->fat2 = NULL;
99
@@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
100
if (ret < 0) {
101
goto fail;
102
}
103
- bs->read_only = false;
104
+ bdrv_set_read_only(bs, false);
105
}
106
107
bs->total_sectors = cyls * heads * secs;
108
diff --git a/include/block/block.h b/include/block/block.h
109
index XXXXXXX..XXXXXXX 100644
110
--- a/include/block/block.h
111
+++ b/include/block/block.h
112
@@ -XXX,XX +XXX,XX @@ int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base,
113
int64_t sector_num, int nb_sectors, int *pnum);
114
115
bool bdrv_is_read_only(BlockDriverState *bs);
116
+void bdrv_set_read_only(BlockDriverState *bs, bool read_only);
117
bool bdrv_is_sg(BlockDriverState *bs);
118
bool bdrv_is_inserted(BlockDriverState *bs);
119
int bdrv_media_changed(BlockDriverState *bs);
120
--
121
2.9.3
122
123
diff view generated by jsdifflib
Deleted patch
1
The BDRV_O_ALLOW_RDWR flag allows / prohibits the changing of
2
the BDS 'read_only' state, but there are a few places where it
3
is ignored. In the bdrv_set_read_only() helper, make sure to
4
honor the flag.
5
1
6
Signed-off-by: Jeff Cody <jcody@redhat.com>
7
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8
Reviewed-by: John Snow <jsnow@redhat.com>
9
Message-id: be2e5fb2d285cbece2b6d06bed54a6f56520d251.1491597120.git.jcody@redhat.com
10
---
11
block.c | 7 +++++++
12
1 file changed, 7 insertions(+)
13
14
diff --git a/block.c b/block.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/block.c
17
+++ b/block.c
18
@@ -XXX,XX +XXX,XX @@ int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
19
return -EINVAL;
20
}
21
22
+ /* Do not clear read_only if it is prohibited */
23
+ if (!read_only && !(bs->open_flags & BDRV_O_ALLOW_RDWR)) {
24
+ error_setg(errp, "Node '%s' is read only",
25
+ bdrv_get_device_or_node_name(bs));
26
+ return -EPERM;
27
+ }
28
+
29
bs->read_only = read_only;
30
return 0;
31
}
32
--
33
2.9.3
34
35
diff view generated by jsdifflib
Deleted patch
1
Move bdrv_is_read_only() up with its friends.
2
1
3
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4
Reviewed-by: John Snow <jsnow@redhat.com>
5
Signed-off-by: Jeff Cody <jcody@redhat.com>
6
Message-id: 73b2399459760c32506f9407efb9dddb3a2789de.1491597120.git.jcody@redhat.com
7
---
8
block.c | 10 +++++-----
9
1 file changed, 5 insertions(+), 5 deletions(-)
10
11
diff --git a/block.c b/block.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/block.c
14
+++ b/block.c
15
@@ -XXX,XX +XXX,XX @@ void path_combine(char *dest, int dest_size,
16
}
17
}
18
19
+bool bdrv_is_read_only(BlockDriverState *bs)
20
+{
21
+ return bs->read_only;
22
+}
23
+
24
int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
25
{
26
/* Do not set read_only if copy_on_read is enabled */
27
@@ -XXX,XX +XXX,XX @@ void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr)
28
*nb_sectors_ptr = nb_sectors < 0 ? 0 : nb_sectors;
29
}
30
31
-bool bdrv_is_read_only(BlockDriverState *bs)
32
-{
33
- return bs->read_only;
34
-}
35
-
36
bool bdrv_is_sg(BlockDriverState *bs)
37
{
38
return bs->sg;
39
--
40
2.9.3
41
42
diff view generated by jsdifflib
Deleted patch
1
Introduce check function for setting read_only flags. Will return < 0 on
2
error, with appropriate Error value set. Does not alter any flags.
3
1
4
Signed-off-by: Jeff Cody <jcody@redhat.com>
5
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
6
Reviewed-by: John Snow <jsnow@redhat.com>
7
Message-id: e2bba34ac3bc76a0c42adc390413f358ae0566e8.1491597120.git.jcody@redhat.com
8
---
9
block.c | 14 +++++++++++++-
10
include/block/block.h | 1 +
11
2 files changed, 14 insertions(+), 1 deletion(-)
12
13
diff --git a/block.c b/block.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/block.c
16
+++ b/block.c
17
@@ -XXX,XX +XXX,XX @@ bool bdrv_is_read_only(BlockDriverState *bs)
18
return bs->read_only;
19
}
20
21
-int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
22
+int bdrv_can_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
23
{
24
/* Do not set read_only if copy_on_read is enabled */
25
if (bs->copy_on_read && read_only) {
26
@@ -XXX,XX +XXX,XX @@ int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
27
return -EPERM;
28
}
29
30
+ return 0;
31
+}
32
+
33
+int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
34
+{
35
+ int ret = 0;
36
+
37
+ ret = bdrv_can_set_read_only(bs, read_only, errp);
38
+ if (ret < 0) {
39
+ return ret;
40
+ }
41
+
42
bs->read_only = read_only;
43
return 0;
44
}
45
diff --git a/include/block/block.h b/include/block/block.h
46
index XXXXXXX..XXXXXXX 100644
47
--- a/include/block/block.h
48
+++ b/include/block/block.h
49
@@ -XXX,XX +XXX,XX @@ int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base,
50
int64_t sector_num, int nb_sectors, int *pnum);
51
52
bool bdrv_is_read_only(BlockDriverState *bs);
53
+int bdrv_can_set_read_only(BlockDriverState *bs, bool read_only, Error **errp);
54
int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp);
55
bool bdrv_is_sg(BlockDriverState *bs);
56
bool bdrv_is_inserted(BlockDriverState *bs);
57
--
58
2.9.3
59
60
diff view generated by jsdifflib
Deleted patch
1
Signed-off-by: Jeff Cody <jcody@redhat.com>
2
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
3
Reviewed-by: John Snow <jsnow@redhat.com>
4
Message-id: 00aed7ffdd7be4b9ed9ce1007d50028a72b34ebe.1491597120.git.jcody@redhat.com
5
---
6
block.c | 14 ++++++++------
7
1 file changed, 8 insertions(+), 6 deletions(-)
8
1
9
diff --git a/block.c b/block.c
10
index XXXXXXX..XXXXXXX 100644
11
--- a/block.c
12
+++ b/block.c
13
@@ -XXX,XX +XXX,XX @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
14
BlockDriver *drv;
15
QemuOpts *opts;
16
const char *value;
17
+ bool read_only;
18
19
assert(reopen_state != NULL);
20
assert(reopen_state->bs->drv != NULL);
21
@@ -XXX,XX +XXX,XX @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
22
qdict_put(reopen_state->options, "driver", qstring_from_str(value));
23
}
24
25
- /* if we are to stay read-only, do not allow permission change
26
- * to r/w */
27
- if (!(reopen_state->bs->open_flags & BDRV_O_ALLOW_RDWR) &&
28
- reopen_state->flags & BDRV_O_RDWR) {
29
- error_setg(errp, "Node '%s' is read only",
30
- bdrv_get_device_or_node_name(reopen_state->bs));
31
+ /* If we are to stay read-only, do not allow permission change
32
+ * to r/w. Attempting to set to r/w may fail if either BDRV_O_ALLOW_RDWR is
33
+ * not set, or if the BDS still has copy_on_read enabled */
34
+ read_only = !(reopen_state->flags & BDRV_O_RDWR);
35
+ ret = bdrv_can_set_read_only(reopen_state->bs, read_only, &local_err);
36
+ if (local_err) {
37
+ error_propagate(errp, local_err);
38
goto error;
39
}
40
41
--
42
2.9.3
43
44
diff view generated by jsdifflib
Deleted patch
1
Update 'clientname' to be 'user', which tracks better with both
2
the QAPI and rados variable naming.
3
1
4
Update 'name' to be 'image_name', as it indicates the rbd image.
5
Naming it 'image' would have been ideal, but we are using that for
6
the rados_image_t value returned by rbd_open().
7
8
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
9
Signed-off-by: Jeff Cody <jcody@redhat.com>
10
Reviewed-by: John Snow <jsnow@redhat.com>
11
Message-id: b7ec1fb2e1cf36f9b6911631447a5b0422590b7d.1491597120.git.jcody@redhat.com
12
---
13
block/rbd.c | 33 +++++++++++++++++----------------
14
1 file changed, 17 insertions(+), 16 deletions(-)
15
16
diff --git a/block/rbd.c b/block/rbd.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/block/rbd.c
19
+++ b/block/rbd.c
20
@@ -XXX,XX +XXX,XX @@ typedef struct BDRVRBDState {
21
rados_t cluster;
22
rados_ioctx_t io_ctx;
23
rbd_image_t image;
24
- char *name;
25
+ char *image_name;
26
char *snap;
27
} BDRVRBDState;
28
29
@@ -XXX,XX +XXX,XX @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp)
30
int64_t bytes = 0;
31
int64_t objsize;
32
int obj_order = 0;
33
- const char *pool, *name, *conf, *clientname, *keypairs;
34
+ const char *pool, *image_name, *conf, *user, *keypairs;
35
const char *secretid;
36
rados_t cluster;
37
rados_ioctx_t io_ctx;
38
@@ -XXX,XX +XXX,XX @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp)
39
*/
40
pool = qdict_get_try_str(options, "pool");
41
conf = qdict_get_try_str(options, "conf");
42
- clientname = qdict_get_try_str(options, "user");
43
- name = qdict_get_try_str(options, "image");
44
+ user = qdict_get_try_str(options, "user");
45
+ image_name = qdict_get_try_str(options, "image");
46
keypairs = qdict_get_try_str(options, "=keyvalue-pairs");
47
48
- ret = rados_create(&cluster, clientname);
49
+ ret = rados_create(&cluster, user);
50
if (ret < 0) {
51
error_setg_errno(errp, -ret, "error initializing");
52
goto exit;
53
@@ -XXX,XX +XXX,XX @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp)
54
goto shutdown;
55
}
56
57
- ret = rbd_create(io_ctx, name, bytes, &obj_order);
58
+ ret = rbd_create(io_ctx, image_name, bytes, &obj_order);
59
if (ret < 0) {
60
error_setg_errno(errp, -ret, "error rbd create");
61
}
62
@@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
63
Error **errp)
64
{
65
BDRVRBDState *s = bs->opaque;
66
- const char *pool, *snap, *conf, *clientname, *name, *keypairs;
67
+ const char *pool, *snap, *conf, *user, *image_name, *keypairs;
68
const char *secretid;
69
QemuOpts *opts;
70
Error *local_err = NULL;
71
@@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
72
pool = qemu_opt_get(opts, "pool");
73
conf = qemu_opt_get(opts, "conf");
74
snap = qemu_opt_get(opts, "snapshot");
75
- clientname = qemu_opt_get(opts, "user");
76
- name = qemu_opt_get(opts, "image");
77
+ user = qemu_opt_get(opts, "user");
78
+ image_name = qemu_opt_get(opts, "image");
79
keypairs = qemu_opt_get(opts, "=keyvalue-pairs");
80
81
- if (!pool || !name) {
82
+ if (!pool || !image_name) {
83
error_setg(errp, "Parameters 'pool' and 'image' are required");
84
r = -EINVAL;
85
goto failed_opts;
86
}
87
88
- r = rados_create(&s->cluster, clientname);
89
+ r = rados_create(&s->cluster, user);
90
if (r < 0) {
91
error_setg_errno(errp, -r, "error initializing");
92
goto failed_opts;
93
}
94
95
s->snap = g_strdup(snap);
96
- s->name = g_strdup(name);
97
+ s->image_name = g_strdup(image_name);
98
99
/* try default location when conf=NULL, but ignore failure */
100
r = rados_conf_read_file(s->cluster, conf);
101
@@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
102
}
103
104
/* rbd_open is always r/w */
105
- r = rbd_open(s->io_ctx, s->name, &s->image, s->snap);
106
+ r = rbd_open(s->io_ctx, s->image_name, &s->image, s->snap);
107
if (r < 0) {
108
- error_setg_errno(errp, -r, "error reading header from %s", s->name);
109
+ error_setg_errno(errp, -r, "error reading header from %s",
110
+ s->image_name);
111
goto failed_open;
112
}
113
114
@@ -XXX,XX +XXX,XX @@ failed_open:
115
failed_shutdown:
116
rados_shutdown(s->cluster);
117
g_free(s->snap);
118
- g_free(s->name);
119
+ g_free(s->image_name);
120
failed_opts:
121
qemu_opts_del(opts);
122
g_free(mon_host);
123
@@ -XXX,XX +XXX,XX @@ static void qemu_rbd_close(BlockDriverState *bs)
124
rbd_close(s->image);
125
rados_ioctx_destroy(s->io_ctx);
126
g_free(s->snap);
127
- g_free(s->name);
128
+ g_free(s->image_name);
129
rados_shutdown(s->cluster);
130
}
131
132
--
133
2.9.3
134
135
diff view generated by jsdifflib
1
For the tests that use the common.qemu functions for running a QEMU
1
From: Denis Plotnikov <dplotnikov@virtuozzo.com>
2
process, _cleanup_qemu must be called in the exit function.
2
3
3
The test checks fulfilling qcow2 requirements for the compression
4
If it is not, if the qemu process aborts, then not all of the droppings
4
type feature and zstd compression type operability.
5
are cleaned up (e.g. pidfile, fifos).
5
6
6
Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
7
This updates those tests that did not have a cleanup in qemu-iotests.
7
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
8
8
Tested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
9
(I swapped spaces for tabs in test 102 as well)
10
11
Reported-by: Eric Blake <eblake@redhat.com>
12
Reviewed-by: Eric Blake <eblake@redhat.com>
9
Reviewed-by: Eric Blake <eblake@redhat.com>
13
Signed-off-by: Jeff Cody <jcody@redhat.com>
10
Message-Id: <20200507082521.29210-5-dplotnikov@virtuozzo.com>
14
Message-id: d59c2f6ad6c1da8b9b3c7f357c94a7122ccfc55a.1492544096.git.jcody@redhat.com
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
15
---
12
---
16
tests/qemu-iotests/028 | 1 +
13
tests/qemu-iotests/287 | 152 +++++++++++++++++++++++++++++++++++++
17
tests/qemu-iotests/094 | 11 ++++++++---
14
tests/qemu-iotests/287.out | 67 ++++++++++++++++
18
tests/qemu-iotests/102 | 5 +++--
15
tests/qemu-iotests/group | 1 +
19
tests/qemu-iotests/109 | 1 +
16
3 files changed, 220 insertions(+)
20
tests/qemu-iotests/117 | 1 +
17
create mode 100755 tests/qemu-iotests/287
21
tests/qemu-iotests/130 | 1 +
18
create mode 100644 tests/qemu-iotests/287.out
22
tests/qemu-iotests/140 | 1 +
19
23
tests/qemu-iotests/141 | 1 +
20
diff --git a/tests/qemu-iotests/287 b/tests/qemu-iotests/287
24
tests/qemu-iotests/143 | 1 +
21
new file mode 100755
25
tests/qemu-iotests/156 | 1 +
22
index XXXXXXX..XXXXXXX
26
10 files changed, 19 insertions(+), 5 deletions(-)
23
--- /dev/null
27
24
+++ b/tests/qemu-iotests/287
28
diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
25
@@ -XXX,XX +XXX,XX @@
29
index XXXXXXX..XXXXXXX 100755
26
+#!/usr/bin/env bash
30
--- a/tests/qemu-iotests/028
27
+#
31
+++ b/tests/qemu-iotests/028
28
+# Test case for an image using zstd compression
32
@@ -XXX,XX +XXX,XX @@ status=1    # failure is the default!
29
+#
33
30
+# Copyright (c) 2020 Virtuozzo International GmbH
34
_cleanup()
31
+#
35
{
32
+# This program is free software; you can redistribute it and/or modify
36
+ _cleanup_qemu
33
+# it under the terms of the GNU General Public License as published by
37
rm -f "${TEST_IMG}.copy"
34
+# the Free Software Foundation; either version 2 of the License, or
38
_cleanup_test_img
35
+# (at your option) any later version.
39
}
36
+#
40
diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094
37
+# This program is distributed in the hope that it will be useful,
41
index XXXXXXX..XXXXXXX 100755
38
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
42
--- a/tests/qemu-iotests/094
39
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43
+++ b/tests/qemu-iotests/094
40
+# GNU General Public License for more details.
44
@@ -XXX,XX +XXX,XX @@ echo "QA output created by $seq"
41
+#
45
here="$PWD"
42
+# You should have received a copy of the GNU General Public License
46
status=1    # failure is the default!
43
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
47
44
+#
48
-trap "exit \$status" 0 1 2 3 15
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
+
49
+_cleanup()
67
+_cleanup()
50
+{
68
+{
51
+ _cleanup_qemu
52
+ _cleanup_test_img
69
+ _cleanup_test_img
53
+ rm -f "$TEST_DIR/source.$IMGFMT"
70
+ _rm_test_img "$COMPR_IMG"
71
+ rm -f "$RAND_FILE"
54
+}
72
+}
55
+
56
+trap "_cleanup; exit \$status" 0 1 2 3 15
73
+trap "_cleanup; exit \$status" 0 1 2 3 15
57
74
+
58
# get standard environment, filters and checks
75
+# for all the cases
59
. ./common.rc
76
+CLUSTER_SIZE=65536
60
@@ -XXX,XX +XXX,XX @@ _send_qemu_cmd $QEMU_HANDLE \
77
+
61
78
+# Check if we can run this test.
62
wait=1 _cleanup_qemu
79
+if IMGOPTS='compression_type=zstd' _make_test_img 64M |
63
80
+ grep "Invalid parameter 'zstd'"; then
64
-_cleanup_test_img
81
+ _notrun "ZSTD is disabled"
65
-rm -f "$TEST_DIR/source.$IMGFMT"
82
+fi
66
83
+
67
# success, all done
84
+echo
68
echo '*** done'
85
+echo "=== Testing compression type incompatible bit setting for zlib ==="
69
diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102
86
+echo
70
index XXXXXXX..XXXXXXX 100755
87
+_make_test_img -o compression_type=zlib 64M
71
--- a/tests/qemu-iotests/102
88
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
72
+++ b/tests/qemu-iotests/102
89
+
73
@@ -XXX,XX +XXX,XX @@ seq=$(basename $0)
90
+echo
74
echo "QA output created by $seq"
91
+echo "=== Testing compression type incompatible bit setting for zstd ==="
75
92
+echo
76
here=$PWD
93
+_make_test_img -o compression_type=zstd 64M
77
-status=1    # failure is the default!
94
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
78
+status=1 # failure is the default!
95
+
79
96
+echo
80
_cleanup()
97
+echo "=== Testing zlib with incompatible bit set ==="
81
{
98
+echo
82
-    _cleanup_test_img
99
+_make_test_img -o compression_type=zlib 64M
83
+ _cleanup_qemu
100
+$PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 3
84
+ _cleanup_test_img
101
+# to make sure the bit was actually set
85
}
102
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
86
trap "_cleanup; exit \$status" 0 1 2 3 15
103
+
87
104
+if $QEMU_IMG info "$TEST_IMG" >/dev/null 2>&1 ; then
88
diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109
105
+ echo "Error: The image opened successfully. The image must not be opened."
89
index XXXXXXX..XXXXXXX 100755
106
+fi
90
--- a/tests/qemu-iotests/109
107
+
91
+++ b/tests/qemu-iotests/109
108
+echo
92
@@ -XXX,XX +XXX,XX @@ status=1    # failure is the default!
109
+echo "=== Testing zstd with incompatible bit unset ==="
93
110
+echo
94
_cleanup()
111
+_make_test_img -o compression_type=zstd 64M
95
{
112
+$PYTHON qcow2.py "$TEST_IMG" set-header incompatible_features 0
96
+ _cleanup_qemu
113
+# to make sure the bit was actually unset
97
rm -f $TEST_IMG.src
114
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
98
    _cleanup_test_img
115
+
99
}
116
+if $QEMU_IMG info "$TEST_IMG" >/dev/null 2>&1 ; then
100
diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117
117
+ echo "Error: The image opened successfully. The image must not be opened."
101
index XXXXXXX..XXXXXXX 100755
118
+fi
102
--- a/tests/qemu-iotests/117
119
+
103
+++ b/tests/qemu-iotests/117
120
+echo
104
@@ -XXX,XX +XXX,XX @@ status=1    # failure is the default!
121
+echo "=== Testing compression type values ==="
105
122
+echo
106
_cleanup()
123
+# zlib=0
107
{
124
+_make_test_img -o compression_type=zlib 64M
108
+ _cleanup_qemu
125
+peek_file_be "$TEST_IMG" 104 1
109
    _cleanup_test_img
126
+echo
110
}
127
+
111
trap "_cleanup; exit \$status" 0 1 2 3 15
128
+# zstd=1
112
diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130
129
+_make_test_img -o compression_type=zstd 64M
113
index XXXXXXX..XXXXXXX 100755
130
+peek_file_be "$TEST_IMG" 104 1
114
--- a/tests/qemu-iotests/130
131
+echo
115
+++ b/tests/qemu-iotests/130
132
+
116
@@ -XXX,XX +XXX,XX @@ status=1    # failure is the default!
133
+echo
117
134
+echo "=== Testing simple reading and writing with zstd ==="
118
_cleanup()
135
+echo
119
{
136
+_make_test_img -o compression_type=zstd 64M
120
+ _cleanup_qemu
137
+$QEMU_IO -c "write -c -P 0xAC 64K 64K " "$TEST_IMG" | _filter_qemu_io
121
_cleanup_test_img
138
+$QEMU_IO -c "read -P 0xAC 64K 64K " "$TEST_IMG" | _filter_qemu_io
122
}
139
+# read on the cluster boundaries
123
trap "_cleanup; exit \$status" 0 1 2 3 15
140
+$QEMU_IO -c "read -v 131070 8 " "$TEST_IMG" | _filter_qemu_io
124
diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140
141
+$QEMU_IO -c "read -v 65534 8" "$TEST_IMG" | _filter_qemu_io
125
index XXXXXXX..XXXXXXX 100755
142
+
126
--- a/tests/qemu-iotests/140
143
+echo
127
+++ b/tests/qemu-iotests/140
144
+echo "=== Testing adjacent clusters reading and writing with zstd ==="
128
@@ -XXX,XX +XXX,XX @@ status=1    # failure is the default!
145
+echo
129
146
+_make_test_img -o compression_type=zstd 64M
130
_cleanup()
147
+$QEMU_IO -c "write -c -P 0xAB 0 64K " "$TEST_IMG" | _filter_qemu_io
131
{
148
+$QEMU_IO -c "write -c -P 0xAC 64K 64K " "$TEST_IMG" | _filter_qemu_io
132
+ _cleanup_qemu
149
+$QEMU_IO -c "write -c -P 0xAD 128K 64K " "$TEST_IMG" | _filter_qemu_io
133
_cleanup_test_img
150
+
134
rm -f "$TEST_DIR/nbd"
151
+$QEMU_IO -c "read -P 0xAB 0 64k " "$TEST_IMG" | _filter_qemu_io
135
}
152
+$QEMU_IO -c "read -P 0xAC 64K 64k " "$TEST_IMG" | _filter_qemu_io
136
diff --git a/tests/qemu-iotests/141 b/tests/qemu-iotests/141
153
+$QEMU_IO -c "read -P 0xAD 128K 64k " "$TEST_IMG" | _filter_qemu_io
137
index XXXXXXX..XXXXXXX 100755
154
+
138
--- a/tests/qemu-iotests/141
155
+echo
139
+++ b/tests/qemu-iotests/141
156
+echo "=== Testing incompressible cluster processing with zstd ==="
140
@@ -XXX,XX +XXX,XX @@ status=1    # failure is the default!
157
+echo
141
158
+# create a 2M image and fill it with 1M likely incompressible data
142
_cleanup()
159
+# and 1M compressible data
143
{
160
+dd if=/dev/urandom of="$RAND_FILE" bs=1M count=1 seek=1
144
+ _cleanup_qemu
161
+QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS_NO_FMT" \
145
_cleanup_test_img
162
+$QEMU_IO -f raw -c "write -P 0xFA 0 1M" "$RAND_FILE" | _filter_qemu_io
146
rm -f "$TEST_DIR/{b,m,o}.$IMGFMT"
163
+
147
}
164
+$QEMU_IMG convert -f raw -O $IMGFMT -c \
148
diff --git a/tests/qemu-iotests/143 b/tests/qemu-iotests/143
165
+-o "$(_optstr_add "$IMGOPTS" "compression_type=zlib")" "$RAND_FILE" \
149
index XXXXXXX..XXXXXXX 100755
166
+"$TEST_IMG" | _filter_qemu_io
150
--- a/tests/qemu-iotests/143
167
+
151
+++ b/tests/qemu-iotests/143
168
+$QEMU_IMG convert -O $IMGFMT -c \
152
@@ -XXX,XX +XXX,XX @@ status=1    # failure is the default!
169
+-o "$(_optstr_add "$IMGOPTS" "compression_type=zstd")" "$TEST_IMG" \
153
170
+"$COMPR_IMG" | _filter_qemu_io
154
_cleanup()
171
+
155
{
172
+$QEMU_IMG compare "$TEST_IMG" "$COMPR_IMG"
156
+ _cleanup_qemu
173
+
157
rm -f "$TEST_DIR/nbd"
174
+# success, all done
158
}
175
+echo "*** done"
159
trap "_cleanup; exit \$status" 0 1 2 3 15
176
+rm -f $seq.full
160
diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
177
+status=0
161
index XXXXXXX..XXXXXXX 100755
178
diff --git a/tests/qemu-iotests/287.out b/tests/qemu-iotests/287.out
162
--- a/tests/qemu-iotests/156
179
new file mode 100644
163
+++ b/tests/qemu-iotests/156
180
index XXXXXXX..XXXXXXX
164
@@ -XXX,XX +XXX,XX @@ status=1    # failure is the default!
181
--- /dev/null
165
182
+++ b/tests/qemu-iotests/287.out
166
_cleanup()
183
@@ -XXX,XX +XXX,XX @@
167
{
184
+QA output created by 287
168
+ _cleanup_qemu
185
+
169
rm -f "$TEST_IMG{,.target}{,.backing,.overlay}"
186
+=== Testing compression type incompatible bit setting for zlib ===
170
}
187
+
171
trap "_cleanup; exit \$status" 0 1 2 3 15
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
172
--
263
--
173
2.9.3
264
2.26.2
174
265
175
266
diff view generated by jsdifflib
1
This adds support for reopen in rbd, for changing between r/w and r/o.
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2
2
3
Note, that this is only a flag change, but we will block a change from
3
Obviously, we should g_free the task after trace point and offset
4
r/o to r/w if we are using an RBD internal snapshot.
4
update.
5
5
6
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
6
Reported-by: Coverity (CID 1428756)
7
Signed-off-by: Jeff Cody <jcody@redhat.com>
7
Fixes: 4ce5dd3e9b5ee0fac18625860eb3727399ee965e
8
Reviewed-by: John Snow <jsnow@redhat.com>
8
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
9
Message-id: d4e87539167ec6527d44c97b164eabcccf96e4f3.1491597120.git.jcody@redhat.com
9
Message-Id: <20200507183800.22626-1-vsementsov@virtuozzo.com>
10
Reviewed-by: Eric Blake <eblake@redhat.com>
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
10
---
12
---
11
block/rbd.c | 21 +++++++++++++++++++++
13
block/block-copy.c | 2 +-
12
1 file changed, 21 insertions(+)
14
1 file changed, 1 insertion(+), 1 deletion(-)
13
15
14
diff --git a/block/rbd.c b/block/rbd.c
16
diff --git a/block/block-copy.c b/block/block-copy.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/block/rbd.c
18
--- a/block/block-copy.c
17
+++ b/block/rbd.c
19
+++ b/block/block-copy.c
18
@@ -XXX,XX +XXX,XX @@ failed_opts:
20
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn block_copy_dirty_clusters(BlockCopyState *s,
19
return r;
21
}
20
}
22
if (s->skip_unallocated && !(ret & BDRV_BLOCK_ALLOCATED)) {
21
23
block_copy_task_end(task, 0);
22
+
24
- g_free(task);
23
+/* Since RBD is currently always opened R/W via the API,
25
progress_set_remaining(s->progress,
24
+ * we just need to check if we are using a snapshot or not, in
26
bdrv_get_dirty_count(s->copy_bitmap) +
25
+ * order to determine if we will allow it to be R/W */
27
s->in_flight_bytes);
26
+static int qemu_rbd_reopen_prepare(BDRVReopenState *state,
28
trace_block_copy_skip_range(s, task->offset, task->bytes);
27
+ BlockReopenQueue *queue, Error **errp)
29
offset = task_end(task);
28
+{
30
bytes = end - offset;
29
+ BDRVRBDState *s = state->bs->opaque;
31
+ g_free(task);
30
+ int ret = 0;
32
continue;
31
+
33
}
32
+ if (s->snap && state->flags & BDRV_O_RDWR) {
34
task->zeroes = ret & BDRV_BLOCK_ZERO;
33
+ error_setg(errp,
34
+ "Cannot change node '%s' to r/w when using RBD snapshot",
35
+ bdrv_get_device_or_node_name(state->bs));
36
+ ret = -EINVAL;
37
+ }
38
+
39
+ return ret;
40
+}
41
+
42
static void qemu_rbd_close(BlockDriverState *bs)
43
{
44
BDRVRBDState *s = bs->opaque;
45
@@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_rbd = {
46
.bdrv_parse_filename = qemu_rbd_parse_filename,
47
.bdrv_file_open = qemu_rbd_open,
48
.bdrv_close = qemu_rbd_close,
49
+ .bdrv_reopen_prepare = qemu_rbd_reopen_prepare,
50
.bdrv_create = qemu_rbd_create,
51
.bdrv_has_zero_init = bdrv_has_zero_init_1,
52
.bdrv_get_info = qemu_rbd_getinfo,
53
--
35
--
54
2.9.3
36
2.26.2
55
37
56
38
diff view generated by jsdifflib