summaryrefslogtreecommitdiffstats
path: root/qemu-img.c
Commit message (Collapse)AuthorAgeFilesLines
* async: aio_context_new(): Handle event_notifier_init failureChrysostomos Nanakos2014-09-221-1/+7
| | | | | | | | | | | | | | | | | | | | | On a system with a low limit of open files the initialization of the event notifier could fail and QEMU exits without printing any error information to the user. The problem can be easily reproduced by enforcing a low limit of open files and start QEMU with enough I/O threads to hit this limit. The same problem raises, without the creation of I/O threads, while QEMU initializes the main event loop by enforcing an even lower limit of open files. This commit adds an error message on failure: # qemu [...] -object iothread,id=iothread0 -object iothread,id=iothread1 qemu: Failed to initialize event notifier: Too many open files in system Signed-off-by: Chrysostomos Nanakos <cnanakos@grnet.gr> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img: clarify src_cache option documentationStefan Hajnoczi2014-09-081-1/+2
| | | | | | | | | | | | | The source cache option takes the same values as the cache option. The documentation reads a little strange because it starts with "In contrast the src_cache option ...". The fact that this is comparing with the previous documented option (the 'cache' option) is implicit. Readers may be confused, especially if they jump to src_cache without reading cache documentation first. Suggested-by: Jeff Nelson <jenelson@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* qemu-img: always goto out in img_snapshot() error pathsStefan Hajnoczi2014-08-291-9/+6
| | | | | | | | | | | | | | | | | | | The out label has the qemu_progress_end() and other cleanup calls. Always goto out in error paths so the cleanup happens. These error paths now return 1 instead of -1. Note that bdrv_unref(NULL) is safe. We just need to initialize bs to NULL at the top of the function. We can now remove the obsolete bs_old_backing = NULL and bs_new_backing = NULL for safe mode. Originally it was necessary in commit 3e85c6fd ("qemu-img rebase") but became useless in commit c2abcce ("qemu-img: avoid calling exit(1) to release resources properly") because the variables are already initialized during declaration. Reported-by: John Snow <jsnow@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* qemu-img: fix img_compare() flags error pathStefan Hajnoczi2014-08-291-3/+3
| | | | | | | | | | If img_compare() fails to parse the cache flags the goto out3 code path will call qemu_progress_end(). Make sure we actually call qemu_progress_init() first. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* qemu-img: fix img_commit() error return valueStefan Hajnoczi2014-08-291-1/+1
| | | | | | | | The img_commit() return value is a process exit code. Use 1 for failure instead of -1. The other failure paths in this function already use 1. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* Revert "qemu-img: sort block formats in help message"Stefan Hajnoczi2014-08-281-22/+3
| | | | | | | | | | | | | | This reverts commit 1a443c1b8b4314d365e82bddeb1de5b4b1c15fb3 and the later commit 395071a76328189f50c778f4dee6dabb90503dd9. GSequence was introduced in glib 2.14. RHEL 5 fails to compile since it uses glib 2.12.3. Now that bdrv_iterate_format() invokes the iteration callback in sorted order these commits are unnecessary. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
* qemu-img: Allow cache mode specification for amendMax Reitz2014-08-221-4/+15
| | | | | | | | | | | qemu-img amend may extensively modify the target image, depending on the options to be amended (e.g. conversion to qcow2 compat level 0.10 from 1.1 for an image with many unallocated zero clusters). Therefore it makes sense to allow the user to specify the cache mode to be used. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-img: Allow source cache mode specificationMax Reitz2014-08-221-16/+62
| | | | | | | | | | | | | | | | | | | Many qemu-img subcommands only read the source file(s) once. For these use cases, a full write-back cache is unnecessary and mainly clutters host cache memory. Though this is generally no concern as cache memory is freely available and can be scaled by the host OS, it may become a concern with thin provisioning. For these cases, it makes sense to allow users to freely specify the source cache mode (e.g. use no cache at all). This commit adds a new switch (-T) for the qemu-img subcommands check, compare, convert and rebase to specify the cache to be used for source images (the backing file in case of rebase). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* 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>
OpenPOWER on IntegriCloud