Re: [Qemu-block] [Question] How can we confirm hot-plug disk succesfully?

2017-06-21 Thread Xie Changlong
在 6/19/2017 6:49 PM, Kevin Wolf 写道: 'info block' shows nothing, but we can't add drive who's id is'drive-virtio-disk1' too. Yes, the old BlockBackend is only fully freed when the guest actually unplugs the device. Specifically, we would have to free the QemuOpts in DriveInfo that keeps the ID

Re: [Qemu-block] [PATCH v2 1/3] xen-disk: only advertize feature-persistent if grant copy is not available

2017-06-21 Thread Stefano Stabellini
On Wed, 21 Jun 2017, Paul Durrant wrote: > If grant copy is available then it will always be used in preference to > persistent maps. In this case feature-persistent should not be advertized > to the frontend, otherwise it may needlessly copy data into persistently > granted buffers. > >

Re: [Qemu-block] [PATCH v2 2/3] xen-disk: add support for multi-page shared rings

2017-06-21 Thread Stefano Stabellini
On Wed, 21 Jun 2017, Paul Durrant wrote: > The blkif protocol has had provision for negotiation of multi-page shared > rings for some time now and many guest OS have support in their frontend > drivers. > > This patch makes the necessary modifications to xen-disk support a shared > ring up to

Re: [Qemu-block] [PATCH v2 3/4] qcow2: add shrink image support

2017-06-21 Thread Max Reitz
On 2017-06-13 14:16, Pavel Butsykin wrote: > This patch add shrinking of the image file for qcow2. As a result, this allows > us to reduce the virtual image size and free up space on the disk without > copying the image. Image can be fragmented and shrink is done by punching > holes > in the

Re: [Qemu-block] [Qemu-devel] [PATCH v3] live-block-ops.txt: Rename, rewrite, and improve it

2017-06-21 Thread John Snow
On 06/21/2017 06:19 AM, Kashyap Chamarthy wrote: > This edition documents (including their QMP invocations) all four > operations: > > - `block-stream` > - `block-commit` > - `drive-mirror` (& `blockdev-mirror`) > - `drive-backup` (& `blockdev-backup`) > > Things considered while

Re: [Qemu-block] [PATCH v2 2/4] qcow2: add qcow2_cache_discard

2017-06-21 Thread Max Reitz
On 2017-06-13 14:16, Pavel Butsykin wrote: > Whenever l2/refcount table clusters are discarded from the file we can > automatically drop unnecessary content of the cache tables. This reduces > the chance of eviction useful cache data and eliminates inconsistent data > in thecache with the data in

Re: [Qemu-block] [PATCH v2 1/4] qemu-img: add --shrink flag for resize

2017-06-21 Thread Max Reitz
On 2017-06-13 14:16, Pavel Butsykin wrote: > The flag as additional precaution of data loss. Perhaps in the future the > operation shrink without this flag will be banned, but while we need to > maintain compatibility. > > Signed-off-by: Pavel Butsykin > --- >

Re: [Qemu-block] [Qemu-devel] [PATCH v2 2/4] qapi: Add qobject_is_equal()

2017-06-21 Thread Markus Armbruster
Max Reitz writes: > This generic function (along with its implementations for different > types) determines whether two QObjects are equal. > > Signed-off-by: Max Reitz > --- > include/qapi/qmp/qbool.h | 1 + > include/qapi/qmp/qdict.h | 1 + >

Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/4] qapi/qnull: Add own header

2017-06-21 Thread Markus Armbruster
Max Reitz writes: > Reviewed-by: Kevin Wolf > Signed-off-by: Max Reitz > --- > include/qapi/qmp/qnull.h | 26 ++ > include/qapi/qmp/qobject.h | 8 > include/qapi/qmp/types.h | 1 + > qobject/qnull.c

Re: [Qemu-block] [Qemu-devel] [PATCH v2 3/4] block: qobject_is_equal() in bdrv_reopen_prepare()

2017-06-21 Thread Markus Armbruster
Max Reitz writes: > Currently, bdrv_reopen_prepare() assumes that all BDS options are > strings. However, this is not the case if the BDS has been created > through the json: pseudo-protocol or blockdev-add. > > Note that the user-invokable reopen command is an HMP command, so

Re: [Qemu-block] [PATCH v9 13/20] qcow2: add support for LUKS encryption format

2017-06-21 Thread Max Reitz
On 2017-06-21 16:46, Max Reitz wrote: > On 2017-06-21 16:42, Max Reitz wrote: >> On 2017-06-19 19:34, Daniel P. Berrange wrote: >>> This adds support for using LUKS as an encryption format >>> with the qcow2 file, using the new encrypt.format parameter >>> to request "luks" format. e.g. >>> >>>

Re: [Qemu-block] [PATCH v9 13/20] qcow2: add support for LUKS encryption format

2017-06-21 Thread Max Reitz
On 2017-06-19 19:34, Daniel P. Berrange wrote: > This adds support for using LUKS as an encryption format > with the qcow2 file, using the new encrypt.format parameter > to request "luks" format. e.g. > > # qemu-img create --object secret,data=123456,id=sec0 \ >-f qcow2 -o

Re: [Qemu-block] [PATCH v9 09/20] qcow: convert QCow to use QCryptoBlock for encryption

2017-06-21 Thread Max Reitz
On 2017-06-19 19:34, Daniel P. Berrange wrote: > This converts the qcow driver to make use of the QCryptoBlock > APIs for encrypting image content. This is only wired up to > permit use of the legacy QCow encryption format. Users who wish > to have the strong LUKS format should switch to qcow2

[Qemu-block] [PATCH v2 2/4] qapi: Add qobject_is_equal()

2017-06-21 Thread Max Reitz
This generic function (along with its implementations for different types) determines whether two QObjects are equal. Signed-off-by: Max Reitz --- include/qapi/qmp/qbool.h | 1 + include/qapi/qmp/qdict.h | 1 + include/qapi/qmp/qfloat.h | 1 + include/qapi/qmp/qint.h

[Qemu-block] [PATCH v2 4/4] iotests: Add test for non-string option reopening

2017-06-21 Thread Max Reitz
Reviewed-by: Kevin Wolf Signed-off-by: Max Reitz --- tests/qemu-iotests/133 | 9 + tests/qemu-iotests/133.out | 5 + 2 files changed, 14 insertions(+) diff --git a/tests/qemu-iotests/133 b/tests/qemu-iotests/133 index 9d35a6a..af6b3e1 100755

[Qemu-block] [PATCH v2 3/4] block: qobject_is_equal() in bdrv_reopen_prepare()

2017-06-21 Thread Max Reitz
Currently, bdrv_reopen_prepare() assumes that all BDS options are strings. However, this is not the case if the BDS has been created through the json: pseudo-protocol or blockdev-add. Note that the user-invokable reopen command is an HMP command, so you can only specify strings there. Therefore,

[Qemu-block] [PATCH v2 0/4] block: Don't compare strings in bdrv_reopen_prepare()

2017-06-21 Thread Max Reitz
bdrv_reopen_prepare() assumes that all BDS options are strings, which is not necessarily correct. This series introduces a new qobject_is_equal() function which can be used to test whether any options have changed, independently of their type. v2: - Add comments detailing when QDicts and QLists

[Qemu-block] [PATCH v2 1/4] qapi/qnull: Add own header

2017-06-21 Thread Max Reitz
Reviewed-by: Kevin Wolf Signed-off-by: Max Reitz --- include/qapi/qmp/qnull.h | 26 ++ include/qapi/qmp/qobject.h | 8 include/qapi/qmp/types.h | 1 + qobject/qnull.c| 1 + target/i386/cpu.c | 6

[Qemu-block] [PATCH v4 1/2] iotests: Use absolute paths for executables

2017-06-21 Thread Max Reitz
A user may specify a relative path for accessing qemu, qemu-img, etc. through environment variables ($QEMU_PROG and friends) or a symlink. If a test decides to change its working directory, relative paths will cease to work, however. Work around this by making all of the paths to programs that

[Qemu-block] [PATCH v4 0/2] iotests: Add test for colon handling

2017-06-21 Thread Max Reitz
v2 of v3 of "iotests: Add test for colon handling"; thus, basically, v4. This adds an iotest for the original series "block: Fix backing paths for filenames with colons" and fixes common.config so it works if you have specified the qemu binaries through relative paths. As a bonus, it makes

[Qemu-block] [PATCH v4 2/2] iotests: Add test for colon handling

2017-06-21 Thread Max Reitz
Reviewed-by: Eric Blake Signed-off-by: Max Reitz --- tests/qemu-iotests/126 | 105 + tests/qemu-iotests/126.out | 23 ++ tests/qemu-iotests/group | 1 + 3 files changed, 129 insertions(+) create

[Qemu-block] [PATCH] iotests: 181 does not work for all formats

2017-06-21 Thread Max Reitz
Test 181 only works for formats which support live migration (naturally, as it is a live migration test). Disable it for all formats which do not. Signed-off-by: Max Reitz --- tests/qemu-iotests/181 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/181

[Qemu-block] [PATCH v2 3/3] xen-disk: use an IOThread per instance

2017-06-21 Thread Paul Durrant
This patch allocates an IOThread object for each xen_disk instance and sets the AIO context appropriately on connect. This allows processing of I/O to proceed in parallel. The patch also adds tracepoints into xen_disk to make it possible to follow the state transtions of an instance in the log.

[Qemu-block] [PATCH v2 2/3] xen-disk: add support for multi-page shared rings

2017-06-21 Thread Paul Durrant
The blkif protocol has had provision for negotiation of multi-page shared rings for some time now and many guest OS have support in their frontend drivers. This patch makes the necessary modifications to xen-disk support a shared ring up to order 4 (i.e. 16 pages). Signed-off-by: Paul Durrant

[Qemu-block] [PATCH v2 0/3] xen-disk: performance improvements

2017-06-21 Thread Paul Durrant
Paul Durrant (3): xen-disk: only advertize feature-persistent if grant copy is not available xen-disk: add support for multi-page shared rings xen-disk: use an IOThread per instance hw/block/trace-events | 7 ++ hw/block/xen_disk.c | 228

[Qemu-block] [PATCH v5 25/25] block/null: Generate filename even with latency-ns

2017-06-21 Thread Max Reitz
While we cannot represent the latency-ns option in a filename, it is not a significant option so not being able to should not stop us from generating a filename nonetheless. Signed-off-by: Max Reitz --- block/null.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)

[Qemu-block] [PATCH v5 23/25] block: Fix FIXME from "Add BDS.backing_overridden"

2017-06-21 Thread Max Reitz
Said commit introduced a FIXME stating that bdrv_open_backing_file() should set bs->backing_overridden to true not only if the file.filename option was set, but if the "options" QDict contained any option that is significant for any node in the BDS tree emerging from the backing BDS. This behavior

[Qemu-block] [PATCH v5 24/25] block/curl: Implement bdrv_refresh_filename()

2017-06-21 Thread Max Reitz
Signed-off-by: Max Reitz --- block/curl.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/block/curl.c b/block/curl.c index 11318a9..fe57223 100644 --- a/block/curl.c +++ b/block/curl.c @@ -957,6 +957,20 @@ static int64_t curl_getlength(BlockDriverState

[Qemu-block] [PATCH v5 21/25] block: Purify .bdrv_refresh_filename()

2017-06-21 Thread Max Reitz
Currently, BlockDriver.bdrv_refresh_filename() is supposed to both refresh the filename (BDS.exact_filename) and set BDS.full_open_options. Now that we have generic code in the central bdrv_refresh_filename() for creating BDS.full_open_options, we can drop the latter part from all

[Qemu-block] [PATCH v5 15/25] block: Use bdrv_dirname() for relative filenames

2017-06-21 Thread Max Reitz
bdrv_get_full_backing_filename_from_filename() breaks down when it comes to JSON filenames. Using bdrv_dirname() as the basis is better because since we have BDS, we can descend through the BDS tree to the protocol layer, which gives us a greater probability of finding a non-JSON name; also,

[Qemu-block] [PATCH v5 22/25] block: Do not copy exact_filename from format file

2017-06-21 Thread Max Reitz
If the a format BDS's file BDS is in turn a format BDS, we cannot simply use the same filename, because when opening a BDS tree based on a filename alone, qemu will create only one format node on top of one protocol node (disregarding a potential backing file). Signed-off-by: Max Reitz

[Qemu-block] [PATCH v5 20/25] block: Generically refresh runtime options

2017-06-21 Thread Max Reitz
Instead of having every block driver which implements bdrv_refresh_filename() copy all of the significant runtime options over to bs->full_open_options, implement this process generically in bdrv_refresh_filename(). This patch only adds this new generic implementation, it does not remove the old

[Qemu-block] [PATCH v5 18/25] block: Add sgfnt_runtime_opts to BlockDriver

2017-06-21 Thread Max Reitz
This new field can be set by block drivers to list the runtime options they accept that may influence the contents of the respective BDS. As of a follow-up patch, this list will be used by the common bdrv_refresh_filename() implementation to decide which options to put into BDS.full_open_options

[Qemu-block] [PATCH v5 17/25] iotests: Add quorum case to test 110

2017-06-21 Thread Max Reitz
Test 110 tests relative backing filenames for complex BDS trees. Add quorum as an example that can never work automatically (without special-casing if all child nodes have the same base directory), and an example on how to make it work manually (using the base-directory option). Signed-off-by:

[Qemu-block] [PATCH v5 11/25] blkverify: Make bdrv_dirname() return NULL

2017-06-21 Thread Max Reitz
blkverify's BDSs have a file BDS, but we do not want this to be preferred over the raw node. There is no way to decide between the two (and not really a reason to, either), so just return NULL in blkverify's implementation of bdrv_dirname(). Signed-off-by: Max Reitz

[Qemu-block] [PATCH v5 16/25] block: Add 'base-directory' BDS option

2017-06-21 Thread Max Reitz
Using this option, one can directly override what bdrv_dirname() will return. This is useful if one uses e.g. qcow2 on top of quorum (with only protocol BDSs under the quorum BDS) and wants to be able to use relative backing filenames. Signed-off-by: Max Reitz ---

[Qemu-block] [PATCH v5 14/25] block/nfs: Implement bdrv_dirname()

2017-06-21 Thread Max Reitz
While the basic idea is obvious and could be handled by the default bdrv_dirname() implementation, we cannot generate a directory name if the gid or uid are set, so we have to explicitly return NULL in those cases. Signed-off-by: Max Reitz --- block/nfs.c | 14 ++

[Qemu-block] [PATCH v5 08/25] block: Add bdrv_make_absolute_filename()

2017-06-21 Thread Max Reitz
This is a general function for making a filename that is relative to a certain BDS absolute. It calls bdrv_get_full_backing_filename_from_filename() for now, but that will be changed in a follow-up patch. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia

[Qemu-block] [PATCH v5 07/25] block: bdrv_get_full_backing_filename's ret. val.

2017-06-21 Thread Max Reitz
Make bdrv_get_full_backing_filename() return an allocated string instead of placing the result in a caller-provided buffer. Signed-off-by: Max Reitz --- include/block/block.h | 3 +-- block.c | 42 +- block/qapi.c

[Qemu-block] [PATCH v5 09/25] block: Fix bdrv_find_backing_image()

2017-06-21 Thread Max Reitz
bdrv_find_backing_image() should use bdrv_get_full_backing_filename() or bdrv_make_absolute_filename() instead of trying to do what those functions do by itself. path_combine_deprecated() can now be dropped, so let's do that. Signed-off-by: Max Reitz Reviewed-by: Eric Blake

[Qemu-block] [PATCH v5 06/25] block: bdrv_get_full_backing_filename_from_...'s ret. val.

2017-06-21 Thread Max Reitz
Make bdrv_get_full_backing_filename_from_filename() return an allocated string instead of placing the result in a caller-provided buffer. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia --- include/block/block.h | 7 +++ block.c | 32

[Qemu-block] [PATCH v5 12/25] quorum: Make bdrv_dirname() return NULL

2017-06-21 Thread Max Reitz
While the common implementation for bdrv_dirname() should return NULL for quorum BDSs already (because they do not have a file node and their exact_filename field should be empty), there is no reason not to make that explicit. Signed-off-by: Max Reitz Reviewed-by: Eric Blake

[Qemu-block] [PATCH v5 03/25] block: Add BDS.backing_overridden

2017-06-21 Thread Max Reitz
If the backing file is overridden, this most probably does change the guest-visible data of a BDS. Therefore, we will need to consider this in bdrv_refresh_filename(). Adding a new field to the BDS is not nice, but it is very simple and exactly keeps track of whether the backing file has been

[Qemu-block] [PATCH v5 13/25] block/nbd: Make bdrv_dirname() return NULL

2017-06-21 Thread Max Reitz
The generic bdrv_dirname() implementation would be able to generate some form of directory name for many NBD nodes, but it would be always wrong. Therefore, we have to explicitly make it an error (until NBD has some form of specification for export paths, if it ever will). Signed-off-by: Max

[Qemu-block] [PATCH v5 10/25] block: Add bdrv_dirname()

2017-06-21 Thread Max Reitz
This function may be implemented by block drivers to derive a directory name from a BDS. Concatenating this g_free()-able string with a relative filename must result in a valid (not necessarily existing) filename, so this is a function that should generally be not implemented by format drivers,

[Qemu-block] [PATCH v5 02/25] block: Use children list in bdrv_refresh_filename

2017-06-21 Thread Max Reitz
bdrv_refresh_filename() should invoke itself recursively on all children, not just on file. With that change, we can remove the manual invocations in blkverify, quorum, commit, and mirror. Signed-off-by: Max Reitz --- block.c | 9 + block/blkverify.c | 3

[Qemu-block] [PATCH v5 04/25] block: Respect backing bs in bdrv_refresh_filename

2017-06-21 Thread Max Reitz
Basically, bdrv_refresh_filename() should respect all children of a BlockDriverState. However, generally those children are driver-specific, so this function cannot handle the general case. On the other hand, there are only few drivers which use other children than @file and @backing (that being

[Qemu-block] [PATCH v5 05/25] block: Make path_combine() return the path

2017-06-21 Thread Max Reitz
Besides being safe for arbitrary path lengths, after some follow-up patches all callers will want a freshly allocated buffer anyway. In the meantime, path_combine_deprecated() is added which has the same interface as path_combine() had before this patch. All callers to that function will be

[Qemu-block] [PATCH v5 01/25] block/mirror: Small absolute-paths simplification

2017-06-21 Thread Max Reitz
When invoking drive-mirror in absolute-paths mode, the target's backing BDS is assigned to it in mirror_exit(). The current logic only does so if the target does not have that backing BDS already; but it actually cannot have a backing BDS at all (the BDS is opened with O_NO_BACKING in

[Qemu-block] [PATCH v5 00/25] block: Fix some filename generation issues

2017-06-21 Thread Max Reitz
[If you have read the cover letter in x \in [v2, v4], there is nothing new here; feel free to skip to the bottom to read the changes from v4.] There are some issues regarding filename generation right now: - You always get a JSON filename if you set even a single qcow2-specific runtime

Re: [Qemu-block] [Qemu-devel] [PATCH 1/3] xen-disk: only advertize feature-persistent if grant copy is not available

2017-06-21 Thread Roger Pau Monne
On Wed, Jun 21, 2017 at 11:40:00AM +0100, Paul Durrant wrote: > > -Original Message- > > From: Qemu-devel [mailto:qemu-devel- > > bounces+paul.durrant=citrix@nongnu.org] On Behalf Of Paul Durrant > > Sent: 21 June 2017 10:36 > > To: Roger Pau Monne ; Stefano

Re: [Qemu-block] [Qemu-devel] [PATCH] qemu-img: don't shadow opts variable in img_dd()

2017-06-21 Thread Max Reitz
On 2017-06-21 10:24, Stefan Hajnoczi wrote: > On Mon, Jun 19, 2017 at 05:18:18PM +0200, Max Reitz wrote: >> On 2017-06-19 17:00, Stefan Hajnoczi wrote: >>> It's confusing when two different variables have the same name in one >>> function. >>> >>> Cc: Reda Sallahi >>>

Re: [Qemu-block] [PATCH 1/3] xen-disk: only advertize feature-persistent if grant copy is not available

2017-06-21 Thread Roger Pau Monné
On Tue, Jun 20, 2017 at 03:19:33PM -0700, Stefano Stabellini wrote: > On Tue, 20 Jun 2017, Paul Durrant wrote: > > If grant copy is available then it will always be used in preference to > > persistent maps. In this case feature-persistent should not be advertized > > to the frontend, otherwise it

[Qemu-block] ping Re: [PATCH v3 0/3] qemu-img check: format allocation info

2017-06-21 Thread Vladimir Sementsov-Ogievskiy
ping 06.06.2017 19:26, Vladimir Sementsov-Ogievskiy wrote: Hi all. See 01 patch for the doc. v3: - improve docs - rename fields - add 'zero' type of underlying file portions status. It as these areas cannot be presented as 'discarded', but they are not occupying real

Re: [Qemu-block] [Qemu-devel] [PATCH 1/3] xen-disk: only advertize feature-persistent if grant copy is not available

2017-06-21 Thread Paul Durrant
> -Original Message- > From: Roger Pau Monne > Sent: 21 June 2017 11:51 > To: Paul Durrant > Cc: Stefano Stabellini ; Kevin Wolf > ; qemu-block@nongnu.org; qemu-de...@nongnu.org; > Max Reitz ; Anthony

Re: [Qemu-block] [PATCH 2/3] xen-disk: add support for multi-page shared rings

2017-06-21 Thread Paul Durrant
> -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 20 June 2017 23:51 > To: Paul Durrant > Cc: xen-de...@lists.xenproject.org; qemu-de...@nongnu.org; qemu- > bl...@nongnu.org; Stefano Stabellini ;

Re: [Qemu-block] [Qemu-devel] [PATCH 1/3] xen-disk: only advertize feature-persistent if grant copy is not available

2017-06-21 Thread Paul Durrant
> -Original Message- > From: Qemu-devel [mailto:qemu-devel- > bounces+paul.durrant=citrix@nongnu.org] On Behalf Of Paul Durrant > Sent: 21 June 2017 10:36 > To: Roger Pau Monne ; Stefano Stabellini > > Cc: Kevin Wolf ;

[Qemu-block] [PATCH v3] live-block-ops.txt: Rename, rewrite, and improve it

2017-06-21 Thread Kashyap Chamarthy
This edition documents (including their QMP invocations) all four operations: - `block-stream` - `block-commit` - `drive-mirror` (& `blockdev-mirror`) - `drive-backup` (& `blockdev-backup`) Things considered while writing this document: - Use reStructuredText as markup language (with

Re: [Qemu-block] [PATCH 1/3] xen-disk: only advertize feature-persistent if grant copy is not available

2017-06-21 Thread Paul Durrant
> -Original Message- > From: Roger Pau Monne > Sent: 21 June 2017 10:18 > To: Stefano Stabellini > Cc: Paul Durrant ; xen-de...@lists.xenproject.org; > qemu-de...@nongnu.org; qemu-block@nongnu.org; Anthony Perard >

Re: [Qemu-block] [Qemu-devel] [PATCH] qemu-img: don't shadow opts variable in img_dd()

2017-06-21 Thread Stefan Hajnoczi
On Mon, Jun 19, 2017 at 05:56:13PM -0700, no-re...@patchew.org wrote: > collect2: fatal error: ld terminated with signal 9 [Killed] > compilation terminated. > Makefile:201: recipe for target 'qemu-system-x86_64w.exe' failed Spurious CI error - ld(1) out of memory? Not related to this patch.

Re: [Qemu-block] [Qemu-devel] [PATCH] qemu-img: don't shadow opts variable in img_dd()

2017-06-21 Thread Stefan Hajnoczi
On Mon, Jun 19, 2017 at 05:18:18PM +0200, Max Reitz wrote: > On 2017-06-19 17:00, Stefan Hajnoczi wrote: > > It's confusing when two different variables have the same name in one > > function. > > > > Cc: Reda Sallahi > > Signed-off-by: Stefan Hajnoczi