summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* char: move QemuOpts->ChardevBackend translation to a separate funcAnton Nefedov2017-07-141-30/+51
| | | | | | | | | parse function will be used by the following patch Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Message-Id: <1499342940-56739-2-git-send-email-anton.nefedov@virtuozzo.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* chardev: block during sync readMarc-André Lureau2017-07-141-0/+2
| | | | | | | | | | | A sync read should block until all requested data is available (instead of retrying in qemu_chr_fe_read_all). Change the channel to blocking during sync_read. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170706170353.32601-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* MAINTAINERS: add entry for "Unimplemented" devicePhilippe Mathieu-Daudé2017-07-141-0/+7
| | | | | | | | Also voluntary myself as reviewer Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20170629150308.22766-6-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* MAINTAINERS: update TCI entryPhilippe Mathieu-Daudé2017-07-141-1/+1
| | | | | | | | | moved in 244f1441 to tcg/ Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20170629150308.22766-5-f4bug@amsat.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* MAINTAINERS: update Xen entriesPhilippe Mathieu-Daudé2017-07-141-1/+0Star
| | | | | | | | | moved in 56e2cd24..28b99f47 to hw/xen/ and hw/i386/xen/ Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Acked-by: Anthony PERARD <anthony.perard@citrix.com> Message-Id: <20170629150308.22766-4-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* MAINTAINERS: update KVM entriesPhilippe Mathieu-Daudé2017-07-141-1/+1
| | | | | | | | moved in 92229a57 to accel/ Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20170629150308.22766-3-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* MAINTAINERS: update TCG entriesPhilippe Mathieu-Daudé2017-07-141-5/+1Star
| | | | | | | | | moved in a9ded601..244f1441 to accel/ Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20170629150308.22766-2-f4bug@amsat.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* build: add -Wexpansion-to-definedPaolo Bonzini2017-07-141-1/+1
| | | | | | | | This warning is included in -Wall by clang, but not by GCC (which only enables it for -Wextra). Include it in the list of warnings we enable to minimize the differences between the compilers: Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-07-12' into ↵Peter Maydell2017-07-136-13/+19
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | staging QAPI patches for 2017-07-12 # gpg: Signature made Wed 12 Jul 2017 17:07:20 BST # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2017-07-12: scripts: use build_ prefix for string not piped through cgen() qobject: Update coccinelle script to catch Q{INC, DEC}REF qobject: Catch another straggler for use of qdict_put_str() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * scripts: use build_ prefix for string not piped through cgen()Marc-André Lureau2017-07-123-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The gen_ prefix is awkward. Generated C should go through cgen() exactly once (see commit 1f9a7a1). The common way to get this wrong is passing a foo=gen_foo() keyword argument to mcgen(). I'd like us to adopt a naming convention where gen_ means "something that's been piped through cgen(), and thus must not be passed to cgen() or mcgen()". Requires renaming gen_params(), gen_marshal_proto() and gen_event_send_proto(). Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170601124143.10915-1-marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
| * qobject: Update coccinelle script to catch Q{INC, DEC}REFEric Blake2017-07-122-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The recent commit b097efc0 used qobject_decref(QOBJECT(E)), even though we already have QDECREF(E) for that purpose. We can update our coccinelle script to catch any future relapses; with that in place, the rest of the patch is generated with: spatch --sp-file scripts/coccinelle/qobject.cocci \ --macro-file scripts/cocci-macro-file.h --dir . --in-place Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20170624181008.25497-3-eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
| * qobject: Catch another straggler for use of qdict_put_str()Eric Blake2017-07-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dan's addition of key-secret improvements in commit 29cf9336 was developed prior to the addition of QDict scalar insertion macros, but merged after the general cleanup in commit 46f5ac20. Patch created mechanically by rerunning: spatch --sp-file scripts/coccinelle/qobject.cocci \ --macro-file scripts/cocci-macro-file.h --dir . --in-place Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-Id: <20170624181008.25497-2-eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* | Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into ↵Peter Maydell2017-07-1310-99/+140
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | staging trivial patches for 2017-07-12 # gpg: Signature made Wed 12 Jul 2017 14:58:43 BST # gpg: using RSA key 0x701B4F6B1A693E59 # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" # Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5 # Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931 4B22 701B 4F6B 1A69 3E59 * remotes/mjt/tags/trivial-patches-fetch: include/hw/ptimer.h: Add documentation comments hxtool: remove dead -q option qga-win32: Fix memory leak of device information set hw/core: fix missing return value in load_image_targphys_as() elf-loader: warn about invalid endianness configure: Handle having no c++ compiler in FORTIFY_SOURCE check hw/pci: define msi_nonbroken in pci-stub hw/misc: add missing includes configure: Fix build with pkg-config and --static --enable-sdl util/qemu-sockets: Drop unused helper socket_address_to_string() target/xtensa: gdbstub: drop dead return statement Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | include/hw/ptimer.h: Add documentation commentsPeter Maydell2017-07-111-0/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add documentation comments describing the public API of the ptimer countdown timer. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| * | hxtool: remove dead -q optionPaolo Bonzini2017-07-111-45/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was used to extract .txt documentation for QMP. This was changed to use the QAPI schema instead, so zap it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| * | qga-win32: Fix memory leak of device information setLi Ping2017-07-111-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The caller of SetupDiGetClassDevs must delete the returned device information set when it is no longer needed by calling SetupDiDestroyDeviceInfoList. Signed-off-by: Li Ping <li.ping288@zte.com.cn> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| * | hw/core: fix missing return value in load_image_targphys_as()Philippe Mathieu-Daudé2017-07-111-1/+3
| | | | | | | | | | | | | | | | | | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| * | elf-loader: warn about invalid endiannessPhilippe Mathieu-Daudé2017-07-111-0/+1
| | | | | | | | | | | | | | | | | | | | | fprintf(stderr) is how errors are reported in this file. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| * | configure: Handle having no c++ compiler in FORTIFY_SOURCE checkPeter Maydell2017-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our FORTIFY_SOURCE check assumes that $cxx refers to a working C++ compiler, with the result that if you don't happen to have one then configure will spuriously print configure: line 4685: c++: command not found Fix this by adding a 'has $cxx' check. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| * | hw/pci: define msi_nonbroken in pci-stubPhilippe Mathieu-Daudé2017-07-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The kludged field 'msi_nonbroken' is declared in "hw/pci/msi.h" and defined in hw/pci/msi.c. When using an ARM config with CONFIG_PCI disabled, hw/pci/msi.c is not included. Without being PCI-related, the files hw/intc/arm_gicv[23*].c do access this field (to enable the kludge if PCI is enabled). The final link fails since hw/pci/msi.c is not included. Defining this field in pci-stub is safe enough for configs without CONFIG_PCI. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| * | hw/misc: add missing includesPhilippe Mathieu-Daudé2017-07-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | inlined create_unimplemented_device() calls sysbus_mmio_map_overlap(). Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| * | configure: Fix build with pkg-config and --static --enable-sdlThomas Huth2017-07-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The configure script prefers pkg-config over sdl-config, but the "--static-libs" parameter only exists for the latter. With pkg-config, "--static --libs" have to be used instead. Buglink: https://bugs.launchpad.net/qemu/+bug/984516 Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| * | util/qemu-sockets: Drop unused helper socket_address_to_string()Mao Zhongyi2017-07-112-49/+0Star
| | | | | | | | | | | | | | | | | | Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| * | target/xtensa: gdbstub: drop dead return statementMax Filippov2017-07-111-1/+0Star
| | | | | | | | | | | | | | | | | | Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* | | Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2017-07-11' ↵Peter Maydell2017-07-13123-1646/+7555
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into staging Block layer patches # gpg: Signature made Tue 11 Jul 2017 17:05:56 BST # gpg: using RSA key 0xF407DB0061D5CF40 # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1 1829 F407 DB00 61D5 CF40 * remotes/maxreitz/tags/pull-block-2017-07-11: (85 commits) iotests: Add preallocated growth test for qcow2 iotests: Add preallocated resize test for raw block/qcow2: falloc/full preallocating growth block/qcow2: Rename "fail_block" to just "fail" block/qcow2: Add qcow2_refcount_area() block/qcow2: Metadata preallocation for truncate block/qcow2: Lock s->lock in preallocate() block/qcow2: Generalize preallocate() block/file-posix: Preallocation for truncate block/file-posix: Generalize raw_regular_truncate block/file-posix: Extract raw_regular_truncate() block/file-posix: Small fixes in raw_create() qemu-img: Expose PreallocMode for resizing block: Add PreallocMode to blk_truncate() block: Add PreallocMode to bdrv_truncate() block: Add PreallocMode to BD.bdrv_truncate() iotests: add test 178 for qemu-img measure qemu-iotests: support per-format golden output files qemu-img: add measure subcommand qcow2: add bdrv_measure() support ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | | iotests: Add preallocated growth test for qcow2Max Reitz2017-07-113-0/+517
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-17-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | iotests: Add preallocated resize test for rawMax Reitz2017-07-113-0/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-16-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block/qcow2: falloc/full preallocating growthMax Reitz2017-07-113-9/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement the preallocation modes falloc and full for growing qcow2 images. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20170613202107.10125-15-mreitz@redhat.com Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block/qcow2: Rename "fail_block" to just "fail"Max Reitz2017-07-111-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now alloc_refcount_block() only contains a single fail label, so it makes more sense to just name it "fail" instead of "fail_block". Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-14-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block/qcow2: Add qcow2_refcount_area()Max Reitz2017-07-114-89/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function creates a collection of self-describing refcount structures (including a new refcount table) at the end of a qcow2 image file. Optionally, these structures can also describe a number of additional clusters beyond themselves; this will be important for preallocated truncation, which will place the data clusters and L2 tables there. For now, we can use this function to replace the part of alloc_refcount_block() that grows the refcount table (from which it is actually derived). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-13-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block/qcow2: Metadata preallocation for truncateMax Reitz2017-07-111-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can support PREALLOC_MODE_METADATA by invoking preallocate() in qcow2_truncate(). Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20170613202107.10125-12-mreitz@redhat.com Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block/qcow2: Lock s->lock in preallocate()Max Reitz2017-07-111-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | preallocate() is and will be called only from places that do not otherwise need to lock s->lock: Currently that is qcow2_create2(), as of a future patch it will be called from qcow2_truncate(), too. It therefore makes sense to move locking that mutex into preallocate() itself. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-11-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block/qcow2: Generalize preallocate()Max Reitz2017-07-111-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds two new parameters to the preallocate() function so we will be able to use it not just for preallocating a new image but also for preallocated image growth. The offset parameter allows the caller to specify a virtual offset from which to start preallocating. For newly created images this is always 0, but for preallocating growth this will be the old image length. The new_length parameter specifies the supposed new length of the image (basically the "end offset" for preallocation). During image truncation, bdrv_getlength() will return the old image length so we cannot rely on its return value then. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-10-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block/file-posix: Preallocation for truncateMax Reitz2017-07-111-12/+10Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By using raw_regular_truncate() in raw_truncate(), we can now easily support preallocation. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-9-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block/file-posix: Generalize raw_regular_truncateMax Reitz2017-07-111-11/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, raw_regular_truncate() is intended for setting the size of a newly created file. However, we also want to use it for truncating an existing file in which case only the newly added space (when growing) should be preallocated. This also means that if resizing failed, we should try to restore the original file size. This is important when using preallocation. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-8-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block/file-posix: Extract raw_regular_truncate()Max Reitz2017-07-111-66/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This functionality is part of raw_create() which we will be able to reuse nicely in raw_truncate(). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20170613202107.10125-7-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block/file-posix: Small fixes in raw_create()Max Reitz2017-07-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Variables should be declared at the start of a block, and if a certain parameter value is not supported it may be better to return -ENOTSUP instead of -EINVAL. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20170613202107.10125-6-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | qemu-img: Expose PreallocMode for resizingMax Reitz2017-07-112-4/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a --preallocation command line option to qemu-img resize which can be used to set the PreallocMode parameter of blk_truncate(). While touching this code, fix the fact that we did not handle errors returned by blk_getlength(). Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20170613202107.10125-5-mreitz@redhat.com Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block: Add PreallocMode to blk_truncate()Max Reitz2017-07-1115-21/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | blk_truncate() itself will pass that value to bdrv_truncate(), and all callers of blk_truncate() just set the parameter to PREALLOC_MODE_OFF for now. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-4-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block: Add PreallocMode to bdrv_truncate()Max Reitz2017-07-1112-36/+26Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For block drivers that just pass a truncate request to the underlying protocol, we can now pass the preallocation mode instead of aborting if it is not PREALLOC_MODE_OFF. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-3-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block: Add PreallocMode to BD.bdrv_truncate()Max Reitz2017-07-1114-15/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a PreallocMode parameter to the bdrv_truncate() function implemented by each block driver. Currently, we always pass PREALLOC_MODE_OFF and no driver accepts anything else. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-2-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | iotests: add test 178 for qemu-img measureStefan Hajnoczi2017-07-114-0/+615
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 20170705125738.8777-10-stefanha@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | qemu-iotests: support per-format golden output filesStefan Hajnoczi2017-07-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some tests produce format-dependent output. Either the difference is filtered out and ignored, or the test case is format-specific so we don't need to worry about per-format output differences. There is a third case: the test script is the same for all image formats and the format-dependent output is relevant. An ugly workaround is to copy-paste the test into multiple per-format test cases. This duplicates code and is not maintainable. This patch allows test cases to add per-format golden output files so a single test case can work correctly when format-dependent output must be checked: 123.out.qcow2 123.out.raw 123.out.vmdk ... This naming scheme is not composable with 123.out.nocache or 123.pc.out, two other scenarios where output files are split. I don't think it matters since few test cases need these features. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 20170705125738.8777-9-stefanha@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | qemu-img: add measure subcommandStefan Hajnoczi2017-07-113-0/+270
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The measure subcommand calculates the size required by a new image file. This can be used by users or management tools that need to allocate space on an LVM volume, SAN LUN, etc before creating or converting an image file. Suggested-by: Maor Lipchuk <mlipchuk@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 20170705125738.8777-8-stefanha@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | qcow2: add bdrv_measure() supportStefan Hajnoczi2017-07-111-0/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use qcow2_calc_prealloc_size() to get the required file size. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 20170705125738.8777-7-stefanha@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | qcow2: extract image creation option parsingStefan Hajnoczi2017-07-111-36/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The image creation options parsed by qcow2_create() are also needed to implement .bdrv_measure(). Extract the parsing code, including input validation. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 20170705125738.8777-6-stefanha@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | qcow2: make refcount size calculation conservativeStefan Hajnoczi2017-07-111-41/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The refcount metadata size calculation is inaccurate and can produce numbers that are too small. This is bad because we should calculate a conservative number - one that is guaranteed to be large enough. This patch switches the approach to a fixed point calculation because the existing equation is hard to solve when inaccuracies are taken care of. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 20170705125738.8777-5-stefanha@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | qcow2: extract preallocation calculation functionStefan Hajnoczi2017-07-111-59/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calculating the preallocated image size will be needed to implement .bdrv_measure(). Extract the code out into a separate function. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 20170705125738.8777-4-stefanha@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | raw-format: add bdrv_measure() supportStefan Hajnoczi2017-07-111-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Maximum size calculation is trivial for the raw format: it's just the requested image size (because there is no metadata). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 20170705125738.8777-3-stefanha@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
| * | | block: add bdrv_measure() APIStefan Hajnoczi2017-07-114-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bdrv_measure() provides a conservative maximum for the size of a new image. This information is handy if storage needs to be allocated (e.g. a SAN or an LVM volume) ahead of time. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 20170705125738.8777-2-stefanha@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>