[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 21/34] qemu-img/convert: Move bs_n > 1 && -B check do
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 21/34] qemu-img/convert: Move bs_n > 1 && -B check down |
Date: |
Fri, 28 Apr 2017 22:33:29 +0200 |
From: Max Reitz <address@hidden>
It does not make much sense to use a backing image for the target when
you concatenate multiple images (because then there is no correspondence
between the source images' backing files and the target's); but it was
still possible to give one by using -o backing_file=X instead of -B X.
Fix this by moving the check.
(Also, change the error message because -B is not the only way to
specify the backing file, evidently.)
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-img.c | 13 +++++++------
tests/qemu-iotests/122.out | 4 ++--
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index e0503ae..7044884 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2089,12 +2089,6 @@ static int img_convert(int argc, char **argv)
}
- if (s.src_num > 1 && out_baseimg) {
- error_report("-B makes no sense when concatenating multiple input "
- "images");
- goto fail_getopt;
- }
-
/* ret is still -EINVAL until here */
ret = bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough);
if (ret < 0) {
@@ -2208,6 +2202,13 @@ static int img_convert(int argc, char **argv)
}
s.target_has_backing = (bool) out_baseimg;
+ if (s.src_num > 1 && out_baseimg) {
+ error_report("Having a backing file for the target makes no sense when
"
+ "concatenating multiple input images");
+ ret = -1;
+ goto out;
+ }
+
/* Check if compression is supported */
if (s.compressed) {
bool encryption =
diff --git a/tests/qemu-iotests/122.out b/tests/qemu-iotests/122.out
index 98814de..9317d80 100644
--- a/tests/qemu-iotests/122.out
+++ b/tests/qemu-iotests/122.out
@@ -61,8 +61,8 @@ read 65536/65536 bytes at offset 4194304
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 65536/65536 bytes at offset 8388608
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-qemu-img: -B makes no sense when concatenating multiple input images
-qemu-img: -B makes no sense when concatenating multiple input images
+qemu-img: Having a backing file for the target makes no sense when
concatenating multiple input images
+qemu-img: Having a backing file for the target makes no sense when
concatenating multiple input images
=== Compression with misaligned allocations and image sizes ===
--
1.8.3.1
- [Qemu-devel] [PULL 12/34] qemu_iotests: Remove _readlink(), (continued)
- [Qemu-devel] [PULL 12/34] qemu_iotests: Remove _readlink(), Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 13/34] block: Remove NULL check in bdrv_co_flush, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 15/34] Issue a deprecation warning if the user specifies the "-hdachs" option., Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 14/34] iotests: Launch qemu-nbd with -e 42, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 16/34] iotests: Fix typo in 026, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 18/34] block: Do not unref bs->file on error in BD's open, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 17/34] iotests: 109: Filter out "len" of failed jobs, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 19/34] block: fix alignment calculations in bdrv_co_do_zero_pwritev, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 20/34] qemu-img/convert: Use @opts for one thing only, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 22/34] qemu-img: Document backing options, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 21/34] qemu-img/convert: Move bs_n > 1 && -B check down,
Kevin Wolf <=
- [Qemu-devel] [PULL 23/34] block/vhdx: Make vhdx_create() always set errp, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 07/34] qemu-iotests: Filter HMP readline escape characters, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 27/34] qcow2: Allow discard of final unaligned cluster, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 26/34] block: Add .bdrv_truncate() error messages, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 28/34] block: fix obvious coding style mistakes in block_int.h, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 25/34] block: Add errp to BD.bdrv_truncate(), Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 24/34] block: Add errp to b{lk,drv}_truncate(), Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 29/34] block: assert no image modification under BDRV_O_INACTIVE, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 30/34] qemu-img: improve convert_iteration_sectors(), Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 31/34] qemu-img: use blk_co_pwrite_zeroes for zero sectors when compressed, Kevin Wolf, 2017/04/28