aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2020-07-06 15:39:50 -0500
committerKevin Wolf <kwolf@redhat.com>2020-07-14 15:18:59 +0200
commitadd8200dd14041d059cc376eff91461fadd93ec5 (patch)
tree8822b99922a34276ef31cbd8d76b1f8d157c916f /block.c
parent344acbd62ffdbeb7f803644ad46a8129059f6823 (diff)
block: Error if backing file fails during creation without -u
Back in commit 6e6e55f5 (Jul 2017, v2.10), we tweaked the code to warn if the backing file could not be opened but the user gave a size, unless the user also passes the -u option to bypass the open of the backing file. As one common reason for failure to open the backing file is when there is mismatch in the requested backing format in relation to what the backing file actually contains, we actually want to open the backing file and ensure that it has the right format in as many cases as possible. iotest 301 for qcow demonstrates how detecting explicit format mismatch is useful to prevent the creation of an image that would probe differently than the user requested. Now is the time to finally turn the warning an error, as promised. Note that the original warning was added prior to our documentation of an official deprecation policy (eb22aeca, also Jul 2017), and because the warning didn't mention the word "deprecated", we never actually remembered to document it as such. But the warning has been around long enough that I don't see prolonging it another two releases. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20200706203954.341758-7-eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/block.c b/block.c
index 98cad57cda..6925e57d7c 100644
--- a/block.c
+++ b/block.c
@@ -6128,16 +6128,8 @@ void bdrv_img_create(const char *filename, const char *fmt,
bs = bdrv_open(full_backing, NULL, backing_options, back_flags,
&local_err);
g_free(full_backing);
- if (!bs && size != -1) {
- /* Couldn't open BS, but we have a size, so it's nonfatal */
- warn_reportf_err(local_err,
- "Could not verify backing image. "
- "This may become an error in future versions.\n");
- local_err = NULL;
- } else if (!bs) {
- /* Couldn't open bs, do not have size */
- error_append_hint(&local_err,
- "Could not open backing image to determine size.\n");
+ if (!bs) {
+ error_append_hint(&local_err, "Could not open backing image.\n");
goto out;
} else {
if (size == -1) {