[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 48/65] qemu-img: Fix qemu-img convert -n
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 48/65] qemu-img: Fix qemu-img convert -n |
Date: |
Fri, 13 Feb 2015 16:24:44 +0000 |
From: Max Reitz <address@hidden>
If -n is specified, it does not matter whether the output format and
protocol support image creation; building the creation options should
simply be skipped.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
qemu-img.c | 50 ++++++++++++++++++++++++++------------------------
1 file changed, 26 insertions(+), 24 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index e148af8..26ec3c1 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1531,34 +1531,36 @@ static int img_convert(int argc, char **argv)
goto out;
}
- if (!drv->create_opts) {
- error_report("Format driver '%s' does not support image creation",
- drv->format_name);
- ret = -1;
- goto out;
- }
+ if (!skip_create) {
+ if (!drv->create_opts) {
+ error_report("Format driver '%s' does not support image creation",
+ drv->format_name);
+ ret = -1;
+ goto out;
+ }
- if (!proto_drv->create_opts) {
- error_report("Protocol driver '%s' does not support image creation",
- proto_drv->format_name);
- ret = -1;
- goto out;
- }
+ if (!proto_drv->create_opts) {
+ error_report("Protocol driver '%s' does not support image
creation",
+ proto_drv->format_name);
+ ret = -1;
+ goto out;
+ }
- create_opts = qemu_opts_append(create_opts, drv->create_opts);
- create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
+ create_opts = qemu_opts_append(create_opts, drv->create_opts);
+ create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
- opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
- if (options && qemu_opts_do_parse(opts, options, NULL)) {
- error_report("Invalid options for file format '%s'", out_fmt);
- ret = -1;
- goto out;
- }
+ opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
+ if (options && qemu_opts_do_parse(opts, options, NULL)) {
+ error_report("Invalid options for file format '%s'", out_fmt);
+ ret = -1;
+ goto out;
+ }
- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, total_sectors * 512);
- ret = add_old_style_options(out_fmt, opts, out_baseimg, NULL);
- if (ret < 0) {
- goto out;
+ qemu_opt_set_number(opts, BLOCK_OPT_SIZE, total_sectors * 512);
+ ret = add_old_style_options(out_fmt, opts, out_baseimg, NULL);
+ if (ret < 0) {
+ goto out;
+ }
}
/* Get backing file name if -o backing_file was used */
--
2.1.0
- [Qemu-devel] [PULL 40/65] savevm: Improve error message for blocked migration, (continued)
- [Qemu-devel] [PULL 40/65] savevm: Improve error message for blocked migration, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 38/65] qtest/ahci: Adding simple dma read-write test, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 35/65] libqos/ahci: add ahci_io, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 41/65] block: vmdk - fixed sizeof() error, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 39/65] nbd: fix the co_queue multi-adding bug, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 43/65] qemu-io: Account IO by aio_read and aio_write, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 44/65] qtest: Add scripts/qtest.py, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 45/65] qemu-iotests: Add VM method qtest() to iotests.py, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 42/65] qtest: Fix deadloop by running main loop AIO context's timers, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 46/65] qemu-iotests: Allow caller to disable underscore convertion for qmp, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 48/65] qemu-img: Fix qemu-img convert -n,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 50/65] block: Lift some BDS functions to the BlockBackend, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 49/65] iotests: Add test for qemu-img convert to NBD, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 51/65] block: Add blk_new_open(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 47/65] qemu-iotests: Add 093 for IO throttling, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 52/65] block: Add Error parameter to bdrv_find_protocol(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 56/65] qemu-img: Use blk_new_open() in img_open(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 57/65] qemu-img: Use blk_new_open() in img_rebase(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 53/65] iotests: Add test for driver=qcow2, format=qcow2, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 60/65] qemu-io: Use blk_new_open() in openfile(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 58/65] qemu-img: Use BlockBackend as far as possible, Stefan Hajnoczi, 2015/02/13