summaryrefslogtreecommitdiffstats
path: root/qemu-img.c
diff options
context:
space:
mode:
authorEric Blake2021-07-08 17:52:28 +0200
committerKevin Wolf2021-07-09 13:19:09 +0200
commita7cd44bef3d9380181734a93977c3d1df3eef2cf (patch)
treeb8b49470b14ac797041c137b0d8f38fae444023f /qemu-img.c
parentqemu-img: Require -F with -b backing image (diff)
downloadqemu-a7cd44bef3d9380181734a93977c3d1df3eef2cf.tar.gz
qemu-a7cd44bef3d9380181734a93977c3d1df3eef2cf.tar.xz
qemu-a7cd44bef3d9380181734a93977c3d1df3eef2cf.zip
qemu-img: Improve error for rebase without backing format
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>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c3
1 files changed, 3 insertions, 0 deletions
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));