[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 04/29] qemu-img: Amendment support implies create_opt
From: |
Max Reitz |
Subject: |
[Qemu-block] [PULL 04/29] qemu-img: Amendment support implies create_opts |
Date: |
Mon, 11 Jun 2018 16:25:46 +0200 |
Instead of checking whether a driver has a non-NULL create_opts we
should check whether it supports image amendment in the first place. If
it does, it must have create_opts.
On the other hand, if it does not have create_opts (so it does not
support amendment either), the error message "does not support any
options" is a bit useless. Stating clearly that the driver has no
amendment support whatsoever is probably better.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
qemu-img.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 75f1610aa0..0be11b3852 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3789,13 +3789,16 @@ static int img_amend(int argc, char **argv)
goto out;
}
- if (!bs->drv->create_opts) {
- error_report("Format driver '%s' does not support any options to
amend",
+ if (!bs->drv->bdrv_amend_options) {
+ error_report("Format driver '%s' does not support option amendment",
fmt);
ret = -1;
goto out;
}
+ /* Every driver supporting amendment must have create_opts */
+ assert(bs->drv->create_opts);
+
create_opts = qemu_opts_append(create_opts, bs->drv->create_opts);
opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
qemu_opts_do_parse(opts, options, NULL, &err);
--
2.17.1
- [Qemu-block] [PULL 00/29] Block patches, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 01/29] block/file-posix: Pass FD to locking helpers, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 02/29] block/file-posix: File locking during creation, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 04/29] qemu-img: Amendment support implies create_opts,
Max Reitz <=
- [Qemu-block] [PULL 03/29] iotests: Add creation test to 153, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 07/29] qemu-img: Add print_amend_option_help(), Max Reitz, 2018/06/11
- [Qemu-block] [PULL 05/29] block: Add Error parameter to bdrv_amend_options, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 06/29] qemu-option: Pull out "Supported options" print, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 09/29] iotests: Test help option for unsupporting formats, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 10/29] iotests: Rework 113, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 11/29] qcow2: Repair OFLAG_COPIED when fixing leaks, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 08/29] qemu-img: Recognize no creation support in -o help, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 12/29] iotests: Repairing error during snapshot deletion, Max Reitz, 2018/06/11
- [Qemu-block] [PULL 15/29] qemu-io: Exit with error when a command failed, Max Reitz, 2018/06/11