[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 22/28] qemu-img: Improve error for rebase without backing format
From: |
Kevin Wolf |
Subject: |
[PULL 22/28] qemu-img: Improve error for rebase without backing format |
Date: |
Fri, 9 Jul 2021 14:50:29 +0200 |
From: Eric Blake <eblake@redhat.com>
When removeing support for qemu-img being able to create backing
chains without embedded backing formats, we caused a poor error
message as caught by iotest 114. Improve the situation to inform the
user what went wrong.
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210708155228.2666172-1-eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-img.c | 3 +++
tests/qemu-iotests/114.out | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/qemu-img.c b/qemu-img.c
index ec0e2fabe5..7c4fc60312 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3767,6 +3767,9 @@ static int img_rebase(int argc, char **argv)
if (ret == -ENOSPC) {
error_report("Could not change the backing file to '%s': No "
"space left in the file header", out_baseimg);
+ } else if (ret == -EINVAL && out_baseimg && !out_basefmt) {
+ error_report("Could not change the backing file to '%s': backing "
+ "format must be specified", out_baseimg);
} else if (ret < 0) {
error_report("Could not change the backing file to '%s': %s",
out_baseimg, strerror(-ret));
diff --git a/tests/qemu-iotests/114.out b/tests/qemu-iotests/114.out
index 6d638da266..f51dd9d20a 100644
--- a/tests/qemu-iotests/114.out
+++ b/tests/qemu-iotests/114.out
@@ -14,7 +14,7 @@ qemu-io: can't open device TEST_DIR/t.qcow2: Could not open
backing file: Unknow
no file open, try 'help open'
read 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-qemu-img: Could not change the backing file to 'TEST_DIR/t.qcow2.base':
Invalid argument
+qemu-img: Could not change the backing file to 'TEST_DIR/t.qcow2.base':
backing format must be specified
read 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
--
2.31.1
- [PULL 12/28] export/fuse: Give SET_ATTR_SIZE its own branch, (continued)
- [PULL 12/28] export/fuse: Give SET_ATTR_SIZE its own branch, Kevin Wolf, 2021/07/09
- [PULL 13/28] export/fuse: Let permissions be adjustable, Kevin Wolf, 2021/07/09
- [PULL 14/28] iotests/308: Test +w on read-only FUSE exports, Kevin Wolf, 2021/07/09
- [PULL 15/28] iotests/fuse-allow-other: Test allow-other, Kevin Wolf, 2021/07/09
- [PULL 17/28] MAINTAINERS: add block/rbd.c reviewer, Kevin Wolf, 2021/07/09
- [PULL 16/28] block/rbd: fix type of task->complete, Kevin Wolf, 2021/07/09
- [PULL 19/28] blockdev: fix drive-backup transaction endless drained section, Kevin Wolf, 2021/07/09
- [PULL 20/28] qcow2: Prohibit backing file changes in 'qemu-img amend', Kevin Wolf, 2021/07/09
- [PULL 18/28] vhost-user: Fix backends without multiqueue support, Kevin Wolf, 2021/07/09
- [PULL 21/28] qemu-img: Require -F with -b backing image, Kevin Wolf, 2021/07/09
- [PULL 22/28] qemu-img: Improve error for rebase without backing format,
Kevin Wolf <=
- [PULL 23/28] qcow2: Fix dangling pointer after reopen for 'file', Kevin Wolf, 2021/07/09
- [PULL 24/28] block: Add bdrv_reopen_queue_free(), Kevin Wolf, 2021/07/09
- [PULL 25/28] block: Acquire AioContexts during bdrv_reopen_multiple(), Kevin Wolf, 2021/07/09
- [PULL 26/28] block: Support multiple reopening with x-blockdev-reopen, Kevin Wolf, 2021/07/09
- [PULL 27/28] iotests: Test reopening multiple devices at the same time, Kevin Wolf, 2021/07/09
- [PULL 28/28] block: Make blockdev-reopen stable API, Kevin Wolf, 2021/07/09
- Re: [PULL 00/28] Block layer patches, Peter Maydell, 2021/07/10