[Qemu-block] [PATCH] iscsi: Add chap and "initiator-name" etc as per drive options

2015-09-11 Thread Fam Zheng
Previously we use "-iscsi id=target-iqn,user=foo,password=bar,..." to specify iscsi connection parameters, unfortunately it doesn't work with qemu-img. This patch adds per drive options to iscsi driver so that at least qemu-img can use the "json:{...}" filename magic. Signed-off-by: Fam Zheng

Re: [Qemu-block] [PATCH] ide: fix ATAPI command permissions

2015-09-11 Thread Michael Tokarev
09.09.2015 19:28, John Snow wrote: > We're a little too lenient with what we'll let an ATAPI drive handle. > Clamp down on the IDE command execution table to remove CD_OK permissions > from commands that are not and have never been ATAPI commands. FWIW, this issue has been assigned CVE-2015-6855

Re: [Qemu-block] [PATCH v3 1/4] block: rename BlockdevSnapshot to BlockdevSnapshotSync

2015-09-11 Thread Max Reitz
On 10.09.2015 15:39, Alberto Garcia wrote: > We will introduce the 'blockdev-snapshot' command that will require > its own struct for the parameters, so we need to rename this one in > order to avoid name clashes. > > Signed-off-by: Alberto Garcia > Reviewed-by: Eric Blake

Re: [Qemu-block] [PATCH v3 4/4] block: add tests for the 'blockdev-snapshot' command

2015-09-11 Thread Eric Blake
On 09/10/2015 07:39 AM, Alberto Garcia wrote: > Signed-off-by: Alberto Garcia > --- > tests/qemu-iotests/085 | 97 > +++--- > tests/qemu-iotests/085.out | 34 +++- > 2 files changed, 123 insertions(+), 8 deletions(-) >

Re: [Qemu-block] [Qemu-devel] [PATCH v4 29/38] blockdev: Add blockdev-insert-medium

2015-09-11 Thread Max Reitz
On 11.09.2015 09:30, Wen Congyang wrote: > On 09/11/2015 03:09 AM, Max Reitz wrote: >> On 10.09.2015 03:12, Wen Congyang wrote: >>> On 09/09/2015 08:59 PM, Max Reitz wrote: On 09.09.2015 12:01, Wen Congyang wrote: > On 09/09/2015 05:20 AM, Max Reitz wrote: >> On 08.09.2015 11:13, Wen

Re: [Qemu-block] [PATCH v3 2/4] block: Add 'ignore-backing' field to BlockdevOptionsGenericCOWFormat

2015-09-11 Thread Max Reitz
On 10.09.2015 15:39, Alberto Garcia wrote: > If set to true, the image will be opened with the BDRV_O_NO_BACKING > flag. This is useful for creating snapshots using images opened with > blockdev-add, since they are not supposed to have a backing image > before the operation. > > Signed-off-by:

Re: [Qemu-block] [PATCH v3 2/4] block: Add 'ignore-backing' field to BlockdevOptionsGenericCOWFormat

2015-09-11 Thread Eric Blake
On 09/10/2015 07:39 AM, Alberto Garcia wrote: > If set to true, the image will be opened with the BDRV_O_NO_BACKING > flag. This is useful for creating snapshots using images opened with > blockdev-add, since they are not supposed to have a backing image > before the operation. > > Signed-off-by:

Re: [Qemu-block] [PATCH v3 2/4] block: Add 'ignore-backing' field to BlockdevOptionsGenericCOWFormat

2015-09-11 Thread Max Reitz
On 11.09.2015 19:28, Kevin Wolf wrote: > Am 11.09.2015 um 19:21 hat Max Reitz geschrieben: >> On 10.09.2015 15:39, Alberto Garcia wrote: >>> If set to true, the image will be opened with the BDRV_O_NO_BACKING >>> flag. This is useful for creating snapshots using images opened with >>>

Re: [Qemu-block] [PATCH v3 2/4] block: Add 'ignore-backing' field to BlockdevOptionsGenericCOWFormat

2015-09-11 Thread Kevin Wolf
Am 11.09.2015 um 19:21 hat Max Reitz geschrieben: > On 10.09.2015 15:39, Alberto Garcia wrote: > > If set to true, the image will be opened with the BDRV_O_NO_BACKING > > flag. This is useful for creating snapshots using images opened with > > blockdev-add, since they are not supposed to have a

Re: [Qemu-block] [Qemu-devel] [PATCH v2 11/11] block: Only poll block layer fds in bdrv_aio_poll

2015-09-11 Thread Daniel P. Berrange
On Fri, Sep 11, 2015 at 11:36:10AM +0200, Alberto Garcia wrote: > On Fri 11 Sep 2015 11:14:33 AM CEST, Fam Zheng wrote: > > >> > Another advantage for bdrv_aio_poll() is, in main loop we will not > >> > need a separate AioContext in changes like: > >> > > >> >

Re: [Qemu-block] [Qemu-devel] [PATCH v4 29/38] blockdev: Add blockdev-insert-medium

2015-09-11 Thread Wen Congyang
On 09/11/2015 03:09 AM, Max Reitz wrote: > On 10.09.2015 03:12, Wen Congyang wrote: >> On 09/09/2015 08:59 PM, Max Reitz wrote: >>> On 09.09.2015 12:01, Wen Congyang wrote: On 09/09/2015 05:20 AM, Max Reitz wrote: > On 08.09.2015 11:13, Wen Congyang wrote: >> On 07/21/2015 01:45 AM,

Re: [Qemu-block] [Qemu-devel] [PATCH v2 11/11] block: Only poll block layer fds in bdrv_aio_poll

2015-09-11 Thread Alberto Garcia
On Fri 11 Sep 2015 11:14:33 AM CEST, Fam Zheng wrote: >> > Another advantage for bdrv_aio_poll() is, in main loop we will not >> > need a separate AioContext in changes like: >> > >> > http://patchwork.ozlabs.org/patch/514968/ >> > >> > Because nested aio_poll will

Re: [Qemu-block] [Qemu-devel] [PATCH v2 11/11] block: Only poll block layer fds in bdrv_aio_poll

2015-09-11 Thread Fam Zheng
On Fri, 09/11 11:36, Alberto Garcia wrote: > On Fri 11 Sep 2015 11:14:33 AM CEST, Fam Zheng wrote: > > >> > Another advantage for bdrv_aio_poll() is, in main loop we will not > >> > need a separate AioContext in changes like: > >> > > >> >

Re: [Qemu-block] [Qemu-devel] [PATCH v2 11/11] block: Only poll block layer fds in bdrv_aio_poll

2015-09-11 Thread Fam Zheng
On Fri, 09/11 10:15, Paolo Bonzini wrote: > > > On 09/09/2015 05:22, Fam Zheng wrote: > > Another advantage for bdrv_aio_poll() is, in main loop we will not need > > a separate AioContext in changes like: > > > > http://patchwork.ozlabs.org/patch/514968/ > > > > Because nested aio_poll will

Re: [Qemu-block] [Qemu-devel] [PATCH v2 11/11] block: Only poll block layer fds in bdrv_aio_poll

2015-09-11 Thread Paolo Bonzini
On 11/09/2015 11:36, Alberto Garcia wrote: > > > > Because nested aio_poll will automatically be limited to only > > > > process block layer events. My idea is to eventually let main loop > > > > use aio_poll > > > > > > That would be a step back. Using GSource is useful because it lets > > >

Re: [Qemu-block] [Qemu-devel] [PATCH v2 11/11] block: Only poll block layer fds in bdrv_aio_poll

2015-09-11 Thread Paolo Bonzini
On 09/09/2015 05:22, Fam Zheng wrote: > Another advantage for bdrv_aio_poll() is, in main loop we will not need > a separate AioContext in changes like: > > http://patchwork.ozlabs.org/patch/514968/ > > Because nested aio_poll will automatically be limited to only process block > layer events.

[Qemu-block] [PULL 22/23] vmdk: Fix next_cluster_sector for compressed write

2015-09-11 Thread Kevin Wolf
From: Radoslav Gerganov When the VMDK is streamOptimized (or compressed), the next_cluster_sector must not be incremented by a fixed number of sectors. Instead of this, it must be rounded up to the next consecutive sector. Fixing this results in much smaller compressed

[Qemu-block] [PULL 23/23] qcow2: Make qcow2_alloc_bytes() more explicit

2015-09-11 Thread Kevin Wolf
From: Max Reitz In case of -EAGAIN returned by update_refcount(), we should discard the cluster offset we were trying to allocate and request a new one, because in theory that old offset might now be taken by a refcount block. In practice, this was not the case due to

[Qemu-block] [PULL 12/23] qcow2: Move qcow2_update_options() call up

2015-09-11 Thread Kevin Wolf
qcow2_update_options() only updates some variables in BDRVQcowState and doesn't really depend on other parts of it being initialised yet, so it can be moved so that it immediately follows the other half of option handling code in qcow2_open(). Signed-off-by: Kevin Wolf

[Qemu-block] [PULL 05/23] block: Drop bdrv_find_whitelisted_format()

2015-09-11 Thread Kevin Wolf
From: Max Reitz It is unused by now, so we can drop it. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block.c | 7 --- include/block/block.h | 2 -- 2 files

[Qemu-block] [PULL 10/23] qcow2: Improve error message

2015-09-11 Thread Kevin Wolf
Eric says that "any" sounds better than "either", and my non-native feeling says the same, so let's change it. Suggested-by: Eric Blake Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/qcow2.c | 2 +- 1 file changed, 1

[Qemu-block] [PULL 03/23] block: Drop drv parameter from bdrv_open_inherit()

2015-09-11 Thread Kevin Wolf
From: Max Reitz Now that this parameter is effectively unused, we can drop it and just pass NULL to bdrv_fill_options(). Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block.c | 17

[Qemu-block] [PULL 11/23] qcow2: Factor out qcow2_update_options()

2015-09-11 Thread Kevin Wolf
Eventually we want to be able to change options at runtime. As a first step towards that goal, separate some option handling code from the general initialisation code in qcow2_open(). Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Max Reitz

[Qemu-block] [PULL 02/23] block: Drop drv parameter from bdrv_open()

2015-09-11 Thread Kevin Wolf
From: Max Reitz Now that this parameter is effectively unused, we can drop it and just pass NULL on to bdrv_open_inherit(). Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block.c

[Qemu-block] [PULL 09/23] qemu-io: Add command 'reopen'

2015-09-11 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- qemu-io-cmds.c | 90 ++ 1 file changed, 90 insertions(+) diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index 53477e1..d6572a8 100644 ---

[Qemu-block] [PULL 00/23] Block layer patches

2015-09-11 Thread Kevin Wolf
The following changes since commit 30c38c90bd3f1bb105ebc069ac1821067c980b7c: scripts/qemu-gdb: Add brief comment describing usage (2015-09-11 17:14:50 +0100) are available in the git repository at: git://repo.or.cz/qemu/kevin.git tags/for-upstream for you to fetch changes up to

[Qemu-block] [PULL 21/23] iotests: Add test for checking large image files

2015-09-11 Thread Kevin Wolf
From: Max Reitz Add a test for checking a qcow2 file with a multiple of 2^32 clusters. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- tests/qemu-iotests/138 | 73

[Qemu-block] [PULL 13/23] qcow2: Move rest of option handling to qcow2_update_options()

2015-09-11 Thread Kevin Wolf
With this commit, the handling of driver-specific options in qcow2_open() is completely separated out into qcow2_update_options(). Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/qcow2.c | 134

[Qemu-block] [PULL 06/23] qcow2: Rename BDRVQcowState to BDRVQcow2State

2015-09-11 Thread Kevin Wolf
BDRVQcowState is already used by qcow1, and gdb is always confused which one to use. Rename the qcow2 one so they can be distinguished. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Stefan Hajnoczi Reviewed-by: Alberto

[Qemu-block] [PULL 15/23] qcow2: Fix memory leak in qcow2_update_options() error path

2015-09-11 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Max Reitz --- block/qcow2.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index c61d996..374a56d 100644 ---

[Qemu-block] [PULL 14/23] qcow2: Leave s unchanged on qcow2_update_options() failure

2015-09-11 Thread Kevin Wolf
On return, either all new options should be applied to BDRVQcowState (on success), or all of the old settings should be preserved (on failure). Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/qcow2.c | 57

[Qemu-block] [PULL 07/23] block: Allow specifying driver-specific options to reopen

2015-09-11 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block.c | 42 +++--- block/commit.c| 4 ++-- include/block/block.h | 4 +++- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git

[Qemu-block] [PULL 01/23] block: Always pass NULL as drv for bdrv_open()

2015-09-11 Thread Kevin Wolf
From: Max Reitz Change all callers of bdrv_open() to pass the driver name in the options QDict instead of passing its BlockDriver pointer. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf

[Qemu-block] [PULL 20/23] qcow2: Make size_to_clusters() return uint64_t

2015-09-11 Thread Kevin Wolf
From: Max Reitz Sadly, some images may have more clusters than what can be represented using a plain int. We should be prepared for that case (in qcow2_check_refcounts() we actually were trying to catch that case, but since size_to_clusters() truncated the returned value, that

[Qemu-block] [PULL 17/23] qcow2: Support updating driver-specific options in reopen

2015-09-11 Thread Kevin Wolf
For updating the cache sizes, disabling lazy refcounts and updating the clean_cache_timer there is a bit more to do than just changing the variables, but otherwise we're all set for changing options during bdrv_reopen(). Just implement the missing pieces and hook the functions up in

[Qemu-block] [PULL 16/23] qcow2: Make qcow2_update_options() suitable for transactions

2015-09-11 Thread Kevin Wolf
Before we can allow updating options at runtime with bdrv_reopen(), we need to split the function into prepare/commit/abort parts. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/qcow2.c | 113

[Qemu-block] [PULL 18/23] qemu-iotests: Reopen qcow2 with lazy-refcounts change

2015-09-11 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- tests/qemu-iotests/039 | 27 +++ tests/qemu-iotests/039.out | 18 ++ 2 files changed, 45 insertions(+) diff --git a/tests/qemu-iotests/039

[Qemu-block] [PULL 08/23] qemu-io: Remove duplicate 'open' error message

2015-09-11 Thread Kevin Wolf
qemu_opts_parse_noisily() already prints an error message with the exact reason why the parsing failed. No need to add another less specific one. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- qemu-io.c | 1 - 1 file changed, 1 deletion(-) diff --git

Re: [Qemu-block] [PATCH v4 16/38] block: Add BlockBackendRootState

2015-09-11 Thread Eric Blake
On 07/20/2015 11:45 AM, Max Reitz wrote: > This structure will store some of the state of the root BDS if the BDS > tree is removed, so that state can be restored once a new BDS tree is > inserted. > > Signed-off-by: Max Reitz > --- > block/block-backend.c | 37

Re: [Qemu-block] [PATCH v3 2/4] block: Add 'ignore-backing' field to BlockdevOptionsGenericCOWFormat

2015-09-11 Thread Eric Blake
On 09/11/2015 11:28 AM, Eric Blake wrote: > But design-wise, would it make sense to support: > > "backing":null Just read Max's response; it sounds like we already have "backing":"" (and don't need "backing":null) for what we want. So maybe we don't need this patch after all. -- Eric Blake

Re: [Qemu-block] [PATCH v3 3/4] block: add a 'blockdev-snapshot' QMP command

2015-09-11 Thread Max Reitz
On 10.09.2015 15:39, Alberto Garcia wrote: > One of the limitations of the 'blockdev-snapshot-sync' command is that > it does not allow passing BlockdevOptions to the newly created > snapshots, so they are always opened using the default values. > > Extending the command to allow passing options

Re: [Qemu-block] [Qemu-devel] [PATCH v2 00/11] aio: Introduce handler type to fix nested aio_poll for dataplane

2015-09-11 Thread Fam Zheng
On Fri, 09/11 12:39, Kevin Wolf wrote: > Am 29.07.2015 um 06:42 hat Fam Zheng geschrieben: > > v2: Switch to disable/enable model. [Paolo] > > > > Most existing nested aio_poll()'s in block layer are inconsiderate of > > dispatching potential new r/w requests from ioeventfds and nbd exports, > >

Re: [Qemu-block] [Qemu-devel] [PATCH v2 00/11] aio: Introduce handler type to fix nested aio_poll for dataplane

2015-09-11 Thread Kevin Wolf
Am 11.09.2015 um 13:46 hat Fam Zheng geschrieben: > On Fri, 09/11 12:39, Kevin Wolf wrote: > > Am 29.07.2015 um 06:42 hat Fam Zheng geschrieben: > > > v2: Switch to disable/enable model. [Paolo] > > > > > > Most existing nested aio_poll()'s in block layer are inconsiderate of > > > dispatching

Re: [Qemu-block] [Qemu-devel] [PATCH] iscsi: Add chap and "initiator-name" etc as per drive options

2015-09-11 Thread Eric Blake
On 09/11/2015 12:00 AM, Fam Zheng wrote: > Previously we use "-iscsi id=target-iqn,user=foo,password=bar,..." to > specify iscsi connection parameters, unfortunately it doesn't work with > qemu-img. > > This patch adds per drive options to iscsi driver so that at least > qemu-img can use the