summaryrefslogtreecommitdiffstats
path: root/qemu-img.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell2014-08-151-31/+67
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Block patches # gpg: Signature made Fri 15 Aug 2014 14:07:42 BST using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (59 commits) block: Catch !bs->drv in bdrv_check() iotests: Add test for image header overlap qcow2: Catch !*host_offset for data allocation qcow2: Return useful error code in refcount_init() mirror: Handle failure for potentially large allocations vpc: Handle failure for potentially large allocations vmdk: Handle failure for potentially large allocations vhdx: Handle failure for potentially large allocations vdi: Handle failure for potentially large allocations rbd: Handle failure for potentially large allocations raw-win32: Handle failure for potentially large allocations raw-posix: Handle failure for potentially large allocations qed: Handle failure for potentially large allocations qcow2: Handle failure for potentially large allocations qcow1: Handle failure for potentially large allocations parallels: Handle failure for potentially large allocations nfs: Handle failure for potentially large allocations iscsi: Handle failure for potentially large allocations dmg: Handle failure for potentially large allocations curl: Handle failure for potentially large allocations ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * block: Avoid bdrv_get_geometry() where errors should be detectedMarkus Armbruster2014-08-151-14/+50
| | | | | | | | | | | | | | | | | | | | | | bdrv_get_geometry() hides errors. Use bdrv_nb_sectors() or bdrv_getlength() instead where that's obviously inappropriate. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
| * qemu-img: Make img_convert() get image size just once per imageMarkus Armbruster2014-08-151-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | Chiefly so I don't have to do the error checking in quadruplicate in the next commit. Moreover, replacing the frequently updated bs_sectors by an array assigned just once makes the code easier to understand. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
| * block: Use bdrv_nb_sectors() in img_convert()Markus Armbruster2014-08-151-4/+4
| | | | | | | | | | | | | | | | | | | | Instead of bdrv_getlength(). Replace variable output_length by output_sectors. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* | qemu-img: Check getchar() return value in read_password() for WIN32Chen Gang2014-08-091-2/+7
|/ | | | | | | | | | getchar() is a standard c library function which may return with failure (e.g. -1), so like another platforms, also need check it under WIN32. And make the related code match current qemu code styles, too. Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* qemu-img: Remove redundancy "ret = -1"Chen Gang2014-07-181-1/+0
| | | | | | | In this case, 'ret' is already '-1', so need not do it again. Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* cleanup QEMUOptionParameterChunyan Liu2014-06-161-12/+7
| | | | | | | | | Now that all backend drivers are using QemuOpts, remove all QEMUOptionParameter related codes. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Chunyan Liu <cyliu@suse.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* change block layer to support both QemuOpts and QEMUOptionParamterChunyan Liu2014-06-161-50/+46
| | | | | | | | | | | Change block layer to support both QemuOpts and QEMUOptionParameter. After this patch, it will change backend drivers one by one. At the end, QEMUOptionParameter will be removed and only QemuOpts is kept. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Chunyan Liu <cyliu@suse.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: Document check exit codesMax Reitz2014-06-041-4/+5
| | | | | | | | | | | | | | | The exit code 63 (check not supported by image format) was not even documented in the comment above the check command in the source code; add it, as it does indeed seem useful. Also, document all of check's exit codes in the manpage. Signed-off-by: Max Reitz <mreitz@redhat.com> Reported-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: Report error even with --oformat=jsonMax Reitz2014-06-021-3/+1
| | | | | | | | | | | | | | | | img_check() should report that the format of the given image does not support checks even if JSON output is desired. JSON data is output to stdout, as opposed to error messages, which are (in the case of qemu-img) printed to stderr. Therefore, it is easy to distinguish between the two. Also, img_info() does already use error_report() for human-readable messages even though JSON output is desired (through collect_image_info_list()). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-img: Plug memory leak in convert commandMarkus Armbruster2014-05-301-1/+1
| | | | | | | | Introduced in commit 661a0f7. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-img: Plug memory leak on block option help error pathMarkus Armbruster2014-05-301-0/+1
| | | | | | | | Introduced in commit a283cb6; mostly harmless. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Remove g_sequence_lookup from qemu-img help functionMike Day2014-05-191-5/+2
| | | | | | | | | | | | g_sequence_lookup is not supported by glib < 2.28. The usage of g_sequence_lookup is not essential in this context (it's a safeguard against duplicate values in the help message). Removing the call enables the build on all platforms and does not change the operation of the help function. Signed-off-by: Mike Day <ncmike@ncultra.org> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-img: Convert by cluster size if target is compressedFam Zheng2014-05-091-0/+1
| | | | | | | | | | | If target block driver forces compression, qemu-img convert needs to write by cluster size as well as "-c" option. Particularly, this applies for converting to VMDK streamOptimized format. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: sort block formats in help messageMike Day2014-05-091-3/+25
| | | | | | | | | | | | | | | | The help message for qemu-img lists the supported block formats, of which there are 27 as of version 2.0.50. The formats are printed in the order of their driver's position in a linked list, which appears random. This patch prints the formats in sorted order, making it easier to read and to find a specific format in the list. [Added suggestions from Fam Zheng <famz@redhat.com> to declare variables at the top of the scope in help() and to omit explicit cast for void* opaque. --Stefan] Signed-off-by: Mike Day <ncmike@ncultra.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* block: Add '--version' option to qemu-imgJeff Cody2014-04-291-4/+11
| | | | | | | | | | | | | This allows qemu-img to print out version information, without needing to print the long help wall of text. While there, perform some minor whitespace cleanup, and remove the unused option_index variable in the call to getopt_long(). Reported-by: Eric Blake <eblake@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: fix qemu-img --help invocationJeff Cody2014-04-281-2/+13
| | | | | | | | | | This fixes a bug introduced in commit ac1307ab, that caused the '--help' option to not be recognized as a valid command, and not print any help. Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-img: Consistently name Error * objects err, and not errpMarkus Armbruster2014-04-251-6/+6
| | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: Improve error messagesFam Zheng2014-04-221-28/+46
| | | | | | | | | | | | | | | | | Previously, when there is a user error in argv parsing, qemu-img prints help text and exits. Add an error_exit function to print a helpful error message and a hint to run 'qemu-img --help' for more information. As a bonus, "qemu-img <cmd> --help" now has a more reasonable exit code 0. In the future the help text should be split by sub command, and only print the information for the specified command. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-img: Avoid duplicate block device IDsKevin Wolf2014-04-221-16/+22
| | | | | | | | | | | | | qemu-img used to use "image" as ID for all block devices. This means that e.g. img_convert() ended up with potentially multiple source images and one target image, all with the same ID. The next patch will catch this and fail to open the block device. This patch makes sure that qemu-img uses meaningful unique IDs for the block devices it uses. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* block: Add errp to bdrv_new()Kevin Wolf2014-04-221-3/+3
| | | | | | | | | | | | | This patch adds an errp parameter to bdrv_new() and updates all its callers. The next patches will make use of this in order to check for duplicate IDs. Most of the callers know that their ID is fine, so they can simply assert that there is no error. Behaviour doesn't change with this patch yet as bdrv_new() doesn't actually assign errors to errp. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qemu-img: Release reference to BlockDriverStatePrasad Joshi2014-04-011-0/+1
| | | | | | Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: mandate argument to 'qemu-img check --repair'Prasad Joshi2014-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | qemu-img check --repair option accepts an argument. The argument to --repair switch can either be 'all' or 'leak'. Fix the long option to mandate argument with --repair switch. The patch fixes following segmentation fault Core was generated by `qemu-img check -f qcow2 --repair all t.qcow2'. Program terminated with signal 11, Segmentation fault. 0 in img_check (argc=6, argv=0x7fffab9b8a10) at qemu-img.c:588 588 if (!strcmp(optarg, "leaks")) { (gdb) bt 0 img_check (argc=6, argv=0x7fffab9b8a10) at qemu-img.c:588 1 __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6 2 _start () (gdb) Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com> Reviewed-by: Leandro Dorileo <l@dorileo.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img convert: Fix progress outputKevin Wolf2014-03-051-9/+11
| | | | | | | | | Initialise progress output only when the -p and -q options have already been parsed, otherwise it's always disabled. Reported-by: Peter Lieven <pl@kamp.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qemu-img: Remove unneeded include filesStefan Weil2014-03-031-6/+0
| | | | | | | | | | There is no dependency on windows.h, and the standard include files are already included by qemu-common.h. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell2014-02-251-45/+100
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Block patches # gpg: Signature made Fri 21 Feb 2014 21:42:24 GMT using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (54 commits) iotests: Mixed quorum child device specifications quorum: Simplify quorum_open() quorum: Add unit test. quorum: Add quorum_open() and quorum_close(). quorum: Implement recursive .bdrv_recurse_is_first_non_filter in quorum. quorum: Add quorum_co_flush(). quorum: Add quorum_invalidate_cache(). quorum: Add quorum_getlength(). quorum: Add quorum mechanism. quorum: Add quorum_aio_readv. blkverify: Extract qemu_iovec_clone() and qemu_iovec_compare() from blkverify. quorum: Add quorum_aio_writev and its dependencies. quorum: Create BDRVQuorumState and BlkDriver and do init. quorum: Create quorum.c, add QuorumChildRequest and QuorumAIOCB. check-qdict: Test termination of qdict_array_split() check-qdict: Adjust test for qdict_array_split() qdict: Extract non-QDicts in qdict_array_split() qemu-config: Sections must consist of keys qemu-iotests: Check qemu-img command line parsing qemu-img: Allow -o help with incomplete argument list ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * qemu-img: Allow -o help with incomplete argument listKevin Wolf2014-02-211-23/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows using 'qemu-img $subcmd -o help' for the create, convert and amend subcommands, without specifying the previously required filename arguments. Note that it's still allowed and meaningful to specify a filename: An invocation like 'qemu-img create -o help sheepdog:foo' will also display options that are provided by the Sheepdog driver. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
| * qemu-img amend: Support multiple -o optionsKevin Wolf2014-02-211-2/+15
| | | | | | | | | | | | | | | | | | | | Instead of ignoring all option values but the last one, multiple -o options now have the same meaning as having a single option with all settings in the order of their respective -o options. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
| * qemu-img convert: Support multiple -o optionsKevin Wolf2014-02-211-9/+25
| | | | | | | | | | | | | | | | | | | | Instead of ignoring all option values but the last one, multiple -o options now have the same meaning as having a single option with all settings in the order of their respective -o options. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
| * qemu-img create: Support multiple -o optionsKevin Wolf2014-02-211-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | If you specified multiple -o options for qemu-img create, it would silently ignore all but the last one. This patch fixes the problem. Now multiple -o options has the same meaning as having a single option with all settings in the order of their respective -o options. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
| * block: Add reference parameter to bdrv_open()Max Reitz2014-02-211-4/+4
| | | | | | | | | | | | | | | | Allow bdrv_open() to handle references to existing block devices just as bdrv_file_open() is already capable of. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Change BDS parameter of bdrv_open() to **Max Reitz2014-02-211-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | Make bdrv_open() take a pointer to a BDS pointer, similarly to bdrv_file_open(). If a pointer to a NULL pointer is given, bdrv_open() will create a new BDS with an empty name; if the BDS pointer is not NULL, that existing BDS will be reused (in the same way as bdrv_open() already did). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* | Merge remote-tracking branch 'remotes/bonzini/configure' into stagingPeter Maydell2014-02-241-0/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remotes/bonzini/configure: build: softmmu targets do not have a "main.o" file configure: Disable libtool if -fPIE does not work with it (bug #1257099) block: convert block drivers linked with libs to modules Makefile: introduce common-obj-m and block-obj-m for DSO Makefile: install modules with "make install" module: implement module loading rules.mak: introduce DSO rules darwin: do not use -mdynamic-no-pic block: use per-object cflags and libs rules.mak: allow per object cflags and libs rules.mak: fix $(obj) to a real relative path util: Split out exec_dir from os_find_datadir Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * util: Split out exec_dir from os_find_datadirFam Zheng2014-02-201-0/+1
| | | | | | | | | | | | | | | | | | With this change, main() calls qemu_init_exec_dir and uses argv[0] to init exec_dir. The saved value can be retrieved with qemu_get_exec_dir later. It will be reused by module loading. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* | Use error_is_set() only when necessaryMarkus Armbruster2014-02-171-4/+4
|/ | | | | | | | | | | | | | | | error_is_set(&var) is the same as var != NULL, but it takes whole-program analysis to figure that out. Unnecessarily hard for optimizers, static checkers, and human readers. Dumb it down to obvious. Gets rid of several dozen Coverity false positives. Note that the obvious form is already used in many places. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* qemu-option: Remove qemu_opts_create_nofailPeter Crosthwaite2014-01-061-1/+1
| | | | | | | | | | | | | This is a boiler-plate _nofail variant of qemu_opts_create. Remove and use error_abort in call sites. null/0 arguments needs to be added for the id and fail_if_exists fields in affected callsites due to argument inconsistency between the normal and no_fail variants. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* qemu-img: make progress output more accurate during convertPeter Lieven2013-12-131-5/+21
| | | | | | | | | | the progress output is very bumpy if the input images contains a significant portion of unallocated sectors. This patch checks how much sectors are allocated a priori if progress output is selected. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-img: decrease progress update interval on convertPeter Lieven2013-12-061-1/+1
| | | | | | | | when doing very large jobs updating the progress only every 2% is too rare. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: round down request length to an aligned sectorPeter Lieven2013-12-061-8/+24
| | | | | | | | | | | | | this patch shortens requests to end at an aligned sector so that the next request starts aligned. [Squashed Peter's fix for bdrv_get_info() failure discussed on the mailing list. --Stefan] Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: dynamically adjust iobuffer size during convertPeter Lieven2013-12-051-3/+13
| | | | | | | | | | | | | | since the convert process is basically a sync operation it might be benificial in some case to change the hardcoded I/O buffer size to a greater value. This patch increases the I/O buffer size if the output driver advertises an optimal transfer length or discard alignment that is greater than the default buffer size of 2M. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: fix usage instruction for qemu-img convertPeter Lieven2013-12-051-1/+0
| | | | | | | Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: add support for skipping zeroes in input during convertPeter Lieven2013-12-051-38/+42
| | | | | | | | | | | | | | | | we currently do not check if a sector is allocated during convert. This means if a sector is unallocated that we allocate a bounce buffer of zeroes, find out its zero later and do not write it in the best case. In the worst case this can lead to reading blocks from a raw device (like iSCSI) altough we could easily know via get_block_status that they are zero and simply skip them. This patch also fixes the progress output not being at 100% after a successful conversion. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: add -l for snapshot in convertWenchao Xia2013-12-041-9/+35
| | | | | | | | Now qemu-img convert have similar options as qemu-nbd for internal snapshot. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* snapshot: distinguish id and name in load_tmpWenchao Xia2013-12-041-2/+6
| | | | | | | | | | | | Since later this function will be used so improve it. The only caller of it now is qemu-img, and it is not impacted by introduce function bdrv_snapshot_load_tmp_by_id_or_name() that call bdrv_snapshot_load_tmp() twice to keep old search logic. bdrv_snapshot_load_tmp_by_id_or_name() return int to let caller know the errno, and errno will be used later. Also fix a typo in comments of bdrv_snapshot_delete(). Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: conditionally zero out target on convertPeter Lieven2013-11-281-1/+9
| | | | | | | | | | | | If the target has_zero_init = 0, but supports efficiently writing zeroes by unmapping we call bdrv_make_zero to avoid fully allocating the target. This currently works only for iscsi. It can be extended to raw with BLKDISCARDZEROES for example. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: add support for fully allocated imagesPeter Lieven2013-11-281-3/+7
| | | | | Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: Fix overwriting 'ret' before usingFam Zheng2013-11-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | This patch moves ret assignment after reporting original error. We were lucky to pass qemu-iotests 048 (qemu-img compare case) but when I tried to run with TEST_DIR=/tmp (tmpfs), it fails with a "wrong" mismatch offset. This fixes two bugs. In the first if branch, setting ret to 1 before using it makes dead code in the next line: pnum is never added to mismatch offset even if ret was 0. In the other if branch, currently the output error is always -4: strerror(-4) -> Unknown error -4 Added regression test in case 048. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com>
* qemu-img: add special exit code if bdrv_check is not supportedPeter Lieven2013-10-241-1/+1
| | | | | | | | | | currently it is not possible to distinguish by exitcode if there has been an error or if bdrv_check is not supported by the image format. Change the exitcode from 1 to 63 for the latter case. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-img: fix invalid JSONPaolo Bonzini2013-09-121-1/+1
| | | | | | | | | | Single quotes for JSON are a QMP-ism, use real JSON in qemu-img output. Reported-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-img create: Emit filename on errorMax Reitz2013-09-121-1/+1
| | | | | | | | bdrv_img_create generally does not emit the target filename, although this is pretty important information. Therefore, prepend its error message with the output filename (if an error occurs). Signed-off-by: Max Reitz <mreitz@redhat.com>
OpenPOWER on IntegriCloud