qemu-img: add qemu-img direct create
Introdue buffer_size while creating raw file, then we
can controll the speed of direct write by:
qemu-img create -t 'cache' -o buffer_size='num'
Signed-off-by: Jinhua Cao <caojinhua1@huawei.com>
This commit is contained in:
parent
86062beb87
commit
1dd60910b1
534
qemu-img-add-qemu-img-direct-create.patch
Normal file
534
qemu-img-add-qemu-img-direct-create.patch
Normal file
@ -0,0 +1,534 @@
|
||||
From 8832a7dcad4e09229537781ff8db98496aa6f533 Mon Sep 17 00:00:00 2001
|
||||
From: Jinhua Cao <caojinhua1@huawei.com>
|
||||
Date: Thu, 10 Feb 2022 21:27:53 +0800
|
||||
Subject: [PATCH] qemu-img: add qemu-img direct create
|
||||
|
||||
Introdue buffer_size while creating raw file, then we
|
||||
can controll the speed of direct write by:
|
||||
qemu-img create -t 'cache' -o buffer_size='num'
|
||||
|
||||
Signed-off-by: Jinhua Cao <caojinhua1@huawei.com>
|
||||
---
|
||||
block/file-posix.c | 65 +++++++++++++++++++++--
|
||||
include/block/block_int.h | 2 +
|
||||
qapi/block-core.json | 6 ++-
|
||||
qemu-img-cmds.hx | 4 +-
|
||||
qemu-img.c | 14 ++++-
|
||||
tests/qemu-iotests/049.out | 102 ++++++++++++++++++-------------------
|
||||
tests/qemu-iotests/099.out | 2 +-
|
||||
7 files changed, 134 insertions(+), 61 deletions(-)
|
||||
|
||||
diff --git a/block/file-posix.c b/block/file-posix.c
|
||||
index aed7529f44..5180fd1d0b 100644
|
||||
--- a/block/file-posix.c
|
||||
+++ b/block/file-posix.c
|
||||
@@ -128,6 +128,10 @@
|
||||
#define FTYPE_CD 1
|
||||
|
||||
#define MAX_BLOCKSIZE 4096
|
||||
+#define DEFAULT_BUFFER_SIZE 65536
|
||||
+#define BUFFER_ALIGN_SIZE 65536
|
||||
+#define MIN_BUFFER_SIZE 65536
|
||||
+#define MAX_BUFFER_SIZE 16777216
|
||||
|
||||
/* Posix file locking bytes. Libvirt takes byte 0, we start from higher bytes,
|
||||
* leaving a few more bytes for its future use. */
|
||||
@@ -206,6 +210,8 @@ typedef struct RawPosixAIOData {
|
||||
off_t aio_offset;
|
||||
uint64_t aio_nbytes;
|
||||
|
||||
+ size_t buffer_size;
|
||||
+
|
||||
union {
|
||||
struct {
|
||||
struct iovec *iov;
|
||||
@@ -2218,7 +2224,8 @@ static void raw_close(BlockDriverState *bs)
|
||||
*/
|
||||
static int coroutine_fn
|
||||
raw_regular_truncate(BlockDriverState *bs, int fd, int64_t offset,
|
||||
- PreallocMode prealloc, Error **errp)
|
||||
+ PreallocMode prealloc, size_t buffer_size,
|
||||
+ Error **errp)
|
||||
{
|
||||
RawPosixAIOData acb;
|
||||
|
||||
@@ -2227,6 +2234,7 @@ raw_regular_truncate(BlockDriverState *bs, int fd, int64_t offset,
|
||||
.aio_fildes = fd,
|
||||
.aio_type = QEMU_AIO_TRUNCATE,
|
||||
.aio_offset = offset,
|
||||
+ .buffer_size = buffer_size,
|
||||
.truncate = {
|
||||
.prealloc = prealloc,
|
||||
.errp = errp,
|
||||
@@ -2252,7 +2260,8 @@ static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
if (S_ISREG(st.st_mode)) {
|
||||
/* Always resizes to the exact @offset */
|
||||
- return raw_regular_truncate(bs, s->fd, offset, prealloc, errp);
|
||||
+ return raw_regular_truncate(bs, s->fd, offset, prealloc,
|
||||
+ DEFAULT_BUFFER_SIZE, errp);
|
||||
}
|
||||
|
||||
if (prealloc != PREALLOC_MODE_OFF) {
|
||||
@@ -2465,6 +2474,8 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||
int fd;
|
||||
uint64_t perm, shared;
|
||||
int result = 0;
|
||||
+ int flags = O_RDWR | O_BINARY;
|
||||
+ size_t buffer_size = DEFAULT_BUFFER_SIZE;
|
||||
|
||||
/* Validate options and set default values */
|
||||
assert(options->driver == BLOCKDEV_DRIVER_FILE);
|
||||
@@ -2484,9 +2495,19 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||
error_setg(errp, "Extent size hint is too large");
|
||||
goto out;
|
||||
}
|
||||
+ if (!file_opts->has_cache) {
|
||||
+ file_opts->cache = g_strdup("writeback");
|
||||
+ }
|
||||
+ if (file_opts->preallocation == PREALLOC_MODE_FULL &&
|
||||
+ !strcmp(file_opts->cache, "none")) {
|
||||
+ flags |= O_DIRECT;
|
||||
+ }
|
||||
+ if (file_opts->has_buffersize) {
|
||||
+ buffer_size = file_opts->buffersize;
|
||||
+ }
|
||||
|
||||
/* Create file */
|
||||
- fd = qemu_create(file_opts->filename, O_RDWR | O_BINARY, 0644, errp);
|
||||
+ fd = qemu_create(file_opts->filename, flags, 0644, errp);
|
||||
if (fd < 0) {
|
||||
result = -errno;
|
||||
goto out;
|
||||
@@ -2521,7 +2542,8 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||
}
|
||||
|
||||
/* Clear the file by truncating it to 0 */
|
||||
- result = raw_regular_truncate(NULL, fd, 0, PREALLOC_MODE_OFF, errp);
|
||||
+ result = raw_regular_truncate(NULL, fd, 0, PREALLOC_MODE_OFF,
|
||||
+ buffer_size, errp);
|
||||
if (result < 0) {
|
||||
goto out_unlock;
|
||||
}
|
||||
@@ -2565,7 +2587,8 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||
/* Resize and potentially preallocate the file to the desired
|
||||
* final size */
|
||||
result = raw_regular_truncate(NULL, fd, file_opts->size,
|
||||
- file_opts->preallocation, errp);
|
||||
+ file_opts->preallocation,
|
||||
+ buffer_size, errp);
|
||||
if (result < 0) {
|
||||
goto out_unlock;
|
||||
}
|
||||
@@ -2586,6 +2609,7 @@ out_close:
|
||||
error_setg_errno(errp, -result, "Could not close the new file");
|
||||
}
|
||||
out:
|
||||
+ g_free(file_opts->cache);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2602,6 +2626,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||
PreallocMode prealloc;
|
||||
char *buf = NULL;
|
||||
Error *local_err = NULL;
|
||||
+ size_t buffersize = DEFAULT_BUFFER_SIZE;
|
||||
+ char *cache = NULL;
|
||||
|
||||
/* Skip file: protocol prefix */
|
||||
strstart(filename, "file:", &filename);
|
||||
@@ -2624,6 +2650,21 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+ buffersize = qemu_opt_get_size_del(opts, BLOCK_OPT_BUFFER_SIZE,
|
||||
+ DEFAULT_BUFFER_SIZE);
|
||||
+ if (buffersize < MIN_BUFFER_SIZE || buffersize > MAX_BUFFER_SIZE) {
|
||||
+ error_setg_errno(errp, EINVAL, "Buffer size must be between %d "
|
||||
+ "and %d", MIN_BUFFER_SIZE, MAX_BUFFER_SIZE);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ cache = qemu_opt_get_del(opts, BLOCK_OPT_CACHE);
|
||||
+ if (!cache) {
|
||||
+ cache = g_strdup("writeback");
|
||||
+ }
|
||||
+
|
||||
+ buffersize = ROUND_UP(buffersize, BUFFER_ALIGN_SIZE);
|
||||
+
|
||||
options = (BlockdevCreateOptions) {
|
||||
.driver = BLOCKDEV_DRIVER_FILE,
|
||||
.u.file = {
|
||||
@@ -2635,6 +2676,10 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||
.nocow = nocow,
|
||||
.has_extent_size_hint = has_extent_size_hint,
|
||||
.extent_size_hint = extent_size_hint,
|
||||
+ .has_buffersize = true,
|
||||
+ .buffersize = buffersize,
|
||||
+ .has_cache = true,
|
||||
+ .cache = cache,
|
||||
},
|
||||
};
|
||||
return raw_co_create(&options, errp);
|
||||
@@ -3133,6 +3178,16 @@ static QemuOptsList raw_create_opts = {
|
||||
.type = QEMU_OPT_SIZE,
|
||||
.help = "Extent size hint for the image file, 0 to disable"
|
||||
},
|
||||
+ {
|
||||
+ .name = BLOCK_OPT_CACHE,
|
||||
+ .type = QEMU_OPT_STRING,
|
||||
+ .help = "Cache mode (allowed values: writeback, none)"
|
||||
+ },
|
||||
+ {
|
||||
+ .name = BLOCK_OPT_BUFFER_SIZE,
|
||||
+ .type = QEMU_OPT_SIZE,
|
||||
+ .help = "write buffer size"
|
||||
+ },
|
||||
{ /* end of list */ }
|
||||
}
|
||||
};
|
||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
||||
index f4c75e8ba9..701f031102 100644
|
||||
--- a/include/block/block_int.h
|
||||
+++ b/include/block/block_int.h
|
||||
@@ -61,6 +61,8 @@
|
||||
#define BLOCK_OPT_DATA_FILE_RAW "data_file_raw"
|
||||
#define BLOCK_OPT_COMPRESSION_TYPE "compression_type"
|
||||
#define BLOCK_OPT_EXTL2 "extended_l2"
|
||||
+#define BLOCK_OPT_CACHE "cache"
|
||||
+#define BLOCK_OPT_BUFFER_SIZE "buffer_size"
|
||||
|
||||
#define BLOCK_PROBE_BUF_SIZE 512
|
||||
|
||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||
index 804beabfb0..e65fabe36d 100644
|
||||
--- a/qapi/block-core.json
|
||||
+++ b/qapi/block-core.json
|
||||
@@ -4437,6 +4437,8 @@
|
||||
# @nocow: Turn off copy-on-write (valid only on btrfs; default: off)
|
||||
# @extent-size-hint: Extent size hint to add to the image file; 0 for not
|
||||
# adding an extent size hint (default: 1 MB, since 5.1)
|
||||
+# @cache: Cache mode used to write the output disk image
|
||||
+# @buffersize: Buffer size for creating image
|
||||
#
|
||||
# Since: 2.12
|
||||
##
|
||||
@@ -4445,7 +4447,9 @@
|
||||
'size': 'size',
|
||||
'*preallocation': 'PreallocMode',
|
||||
'*nocow': 'bool',
|
||||
- '*extent-size-hint': 'size'} }
|
||||
+ '*extent-size-hint': 'size',
|
||||
+ '*cache': 'str',
|
||||
+ '*buffersize': 'size'} }
|
||||
|
||||
##
|
||||
# @BlockdevCreateOptionsGluster:
|
||||
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
|
||||
index 72bcdcfbfa..ec6aa2886a 100644
|
||||
--- a/qemu-img-cmds.hx
|
||||
+++ b/qemu-img-cmds.hx
|
||||
@@ -52,9 +52,9 @@ SRST
|
||||
ERST
|
||||
|
||||
DEF("create", img_create,
|
||||
- "create [--object objectdef] [-q] [-f fmt] [-b backing_file] [-F backing_fmt] [-u] [-o options] filename [size]")
|
||||
+ "create [--object objectdef] [-q] [-f fmt] [-b backing_file] [-F backing_fmt] [-u] [-t cache] [-o options] filename [size]")
|
||||
SRST
|
||||
-.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE] [-F BACKING_FMT] [-u] [-o OPTIONS] FILENAME [SIZE]
|
||||
+.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE] [-F BACKING_FMT] [-u] [-t CACHE] [-o OPTIONS] FILENAME [SIZE]
|
||||
ERST
|
||||
|
||||
DEF("dd", img_dd,
|
||||
diff --git a/qemu-img.c b/qemu-img.c
|
||||
index f036a1d428..9409558772 100644
|
||||
--- a/qemu-img.c
|
||||
+++ b/qemu-img.c
|
||||
@@ -504,6 +504,7 @@ static int img_create(int argc, char **argv)
|
||||
const char *base_fmt = NULL;
|
||||
const char *filename;
|
||||
const char *base_filename = NULL;
|
||||
+ const char *cache = BDRV_DEFAULT_CACHE;
|
||||
char *options = NULL;
|
||||
Error *local_err = NULL;
|
||||
bool quiet = false;
|
||||
@@ -515,7 +516,7 @@ static int img_create(int argc, char **argv)
|
||||
{"object", required_argument, 0, OPTION_OBJECT},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
- c = getopt_long(argc, argv, ":F:b:f:ho:qu",
|
||||
+ c = getopt_long(argc, argv, ":F:b:f:t:ho:qu",
|
||||
long_options, NULL);
|
||||
if (c == -1) {
|
||||
break;
|
||||
@@ -539,6 +540,9 @@ static int img_create(int argc, char **argv)
|
||||
case 'f':
|
||||
fmt = optarg;
|
||||
break;
|
||||
+ case 't':
|
||||
+ cache = optarg;
|
||||
+ break;
|
||||
case 'o':
|
||||
if (accumulate_options(&options, optarg) < 0) {
|
||||
goto fail;
|
||||
@@ -582,6 +586,14 @@ static int img_create(int argc, char **argv)
|
||||
error_exit("Unexpected argument: %s", argv[optind]);
|
||||
}
|
||||
|
||||
+ if (!options) {
|
||||
+ options = g_strdup_printf(BLOCK_OPT_CACHE"=%s", cache);
|
||||
+ } else {
|
||||
+ char *old_options = options;
|
||||
+ options = g_strdup_printf("%s,"BLOCK_OPT_CACHE"=%s", options, cache);
|
||||
+ g_free(old_options);
|
||||
+ }
|
||||
+
|
||||
bdrv_img_create(filename, fmt, base_filename, base_fmt,
|
||||
options, img_size, flags, quiet, &local_err);
|
||||
if (local_err) {
|
||||
diff --git a/tests/qemu-iotests/049.out b/tests/qemu-iotests/049.out
|
||||
index 8719c91b48..6aca1a7797 100644
|
||||
--- a/tests/qemu-iotests/049.out
|
||||
+++ b/tests/qemu-iotests/049.out
|
||||
@@ -4,90 +4,90 @@ QA output created by 049
|
||||
== 1. Traditional size parameter ==
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024b
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1k
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1K
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1G
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1073741824 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1073741824 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1T
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1099511627776 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1099511627776 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024.0
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024.0b
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5k
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5K
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1572864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1572864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5G
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1610612736 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1610612736 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5T
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1649267441664 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1649267441664 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
== 2. Specifying size via -o ==
|
||||
|
||||
qemu-img create -f qcow2 -o size=1024 TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1024b TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1k TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1K TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1M TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1G TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1073741824 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1073741824 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1T TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1099511627776 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1099511627776 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1024.0 TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1024.0b TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1.5k TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1.5K TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1.5M TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1572864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1572864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1.5G TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1610612736 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1610612736 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o size=1.5T TEST_DIR/t.qcow2
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1649267441664 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1649267441664 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
== 3. Invalid sizes ==
|
||||
|
||||
@@ -135,84 +135,84 @@ qemu-img: TEST_DIR/t.qcow2: The image size must be specified only once
|
||||
== Check correct interpretation of suffixes for cluster size ==
|
||||
|
||||
qemu-img create -f qcow2 -o cluster_size=1024 TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o cluster_size=1024b TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o cluster_size=1k TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o cluster_size=1K TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o cluster_size=1M TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1048576 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1048576 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o cluster_size=1024.0 TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o cluster_size=1024.0b TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o cluster_size=0.5k TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=512 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=512 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o cluster_size=0.5K TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=512 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=512 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o cluster_size=0.5M TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=524288 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=524288 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
== Check compat level option ==
|
||||
|
||||
qemu-img create -f qcow2 -o compat=0.10 TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.10 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.10 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o compat=1.1 TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=1.1 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=1.1 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o compat=0.42 TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.42 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.42 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
qemu-img: TEST_DIR/t.qcow2: Parameter 'version' does not accept value '0.42'
|
||||
|
||||
qemu-img create -f qcow2 -o compat=foobar TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=foobar lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=foobar lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
qemu-img: TEST_DIR/t.qcow2: Parameter 'version' does not accept value 'foobar'
|
||||
|
||||
== Check preallocation option ==
|
||||
|
||||
qemu-img create -f qcow2 -o preallocation=off TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o preallocation=metadata TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=metadata compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=metadata compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o preallocation=1234 TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=1234 compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=1234 compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
qemu-img: TEST_DIR/t.qcow2: Parameter 'preallocation' does not accept value '1234'
|
||||
|
||||
== Check encryption option ==
|
||||
|
||||
qemu-img create -f qcow2 -o encryption=off TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 encryption=off cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 encryption=off cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 --object secret,id=sec0,data=123456 -o encryption=on,encrypt.key-secret=sec0 TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 encryption=on encrypt.key-secret=sec0 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 encryption=on encrypt.key-secret=sec0 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
== Check lazy_refcounts option (only with v3) ==
|
||||
|
||||
qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=off TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=1.1 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=1.1 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=on TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=1.1 lazy_refcounts=on refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=1.1 lazy_refcounts=on refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o compat=0.10,lazy_refcounts=off TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.10 lazy_refcounts=off refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.10 lazy_refcounts=off refcount_bits=16 cache=writeback
|
||||
|
||||
qemu-img create -f qcow2 -o compat=0.10,lazy_refcounts=on TEST_DIR/t.qcow2 64M
|
||||
-Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.10 lazy_refcounts=on refcount_bits=16
|
||||
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.10 lazy_refcounts=on refcount_bits=16 cache=writeback
|
||||
qemu-img: TEST_DIR/t.qcow2: Lazy refcounts only supported with compatibility level 1.1 and above (use version=v3 or greater)
|
||||
|
||||
== Expect error when backing file name is empty string ==
|
||||
diff --git a/tests/qemu-iotests/099.out b/tests/qemu-iotests/099.out
|
||||
index 8cce627529..f6f8f25957 100644
|
||||
--- a/tests/qemu-iotests/099.out
|
||||
+++ b/tests/qemu-iotests/099.out
|
||||
@@ -1,6 +1,6 @@
|
||||
QA output created by 099
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072
|
||||
-Formatting 'TEST_DIR/t.IMGFMT.compare', fmt=raw size=131072
|
||||
+Formatting 'TEST_DIR/t.IMGFMT.compare', fmt=raw size=131072 cache=writeback
|
||||
|
||||
=== Testing simple filename for blkverify ===
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user