[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/53] block: Avoid error accumulation in bdrv_img_create()
From: |
Markus Armbruster |
Subject: |
[PULL 15/53] block: Avoid error accumulation in bdrv_img_create() |
Date: |
Tue, 7 Jul 2020 23:24:25 +0200 |
When creating an image fails because the format doesn't support option
"backing_file" or "backing_fmt", bdrv_img_create() first has
qemu_opt_set() put a generic error into @local_err, then puts the real
error into @errp with error_setg(), and then propagates the former to
the latter, which throws away the generic error. A bit complicated,
but works.
Now that qemu_opt_set() returns a useful value, we can simply ignore
the generic error instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200707160613.848843-16-armbru@redhat.com>
---
block.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index 8d478bdc51..b396f32a51 100644
--- a/block.c
+++ b/block.c
@@ -6090,7 +6090,7 @@ void bdrv_img_create(const char *filename, const char
*fmt,
if (base_filename) {
if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename,
- &local_err)) {
+ NULL)) {
error_setg(errp, "Backing file not supported for file format '%s'",
fmt);
goto out;
@@ -6098,7 +6098,7 @@ void bdrv_img_create(const char *filename, const char
*fmt,
}
if (base_fmt) {
- if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &local_err)) {
+ if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, NULL)) {
error_setg(errp, "Backing file format not supported for file "
"format '%s'", fmt);
goto out;
--
2.26.2
- [PULL 53/53] xen: Use ERRP_GUARD(), (continued)
- [PULL 53/53] xen: Use ERRP_GUARD(), Markus Armbruster, 2020/07/08
- [PULL 26/53] qom: Put name parameter before value / visitor parameter, Markus Armbruster, 2020/07/08
- [PULL 40/53] qapi: Smooth visitor error checking in generated code, Markus Armbruster, 2020/07/08
- [PULL 39/53] qapi: Smooth another visitor error checking pattern, Markus Armbruster, 2020/07/08
- [PULL 18/53] qapi: Use returned bool to check for failure, Coccinelle part, Markus Armbruster, 2020/07/08
- [PULL 12/53] qemu-option: Replace opt_set() by cleaner opt_validate(), Markus Armbruster, 2020/07/08
- [PULL 01/53] error: Fix examples in error.h's big comment, Markus Armbruster, 2020/07/08
- [PULL 10/53] qemu-option: Simplify around find_default_by_name(), Markus Armbruster, 2020/07/08
- [PULL 17/53] qapi: Make visitor functions taking Error ** return bool, not void, Markus Armbruster, 2020/07/08
- [PULL 37/53] error: Reduce unnecessary error propagation, Markus Armbruster, 2020/07/08
- [PULL 15/53] block: Avoid error accumulation in bdrv_img_create(),
Markus Armbruster <=
- [PULL 48/53] sd: Use ERRP_GUARD(), Markus Armbruster, 2020/07/08
- [PULL 14/53] qemu-option: Use returned bool to check for failure, Markus Armbruster, 2020/07/08
- [PULL 21/53] qom: Use error_reportf_err() instead of g_printerr() in examples, Markus Armbruster, 2020/07/08
- [PULL 20/53] s390x/pci: Fix harmless mistake in zpci's property fid's setter, Markus Armbruster, 2020/07/08
- [PULL 29/53] qom: Use returned bool to check for failure, manual part, Markus Armbruster, 2020/07/08
- [PULL 03/53] error: Document Error API usage rules, Markus Armbruster, 2020/07/08
- Re: [PULL 00/53] Error reporting patches patches for 2020-07-07, Markus Armbruster, 2020/07/10