Re: [Qemu-block] [PATCH v2 0/9] iotests: Make them work for both Python 2 and 3

2018-10-19 Thread Cleber Rosa
On 10/19/18 3:15 PM, Max Reitz wrote: > This series prepares the iotests to work with both Python 2 and 3. In > some places, it adds version-specific code and decides what to do based > on the version (for instance, whether to import the StringIO or the > BytesIO class from 'io' for use with

Re: [Qemu-block] [PATCH v2 9/9] iotests: Unify log outputs between Python 2 and 3

2018-10-19 Thread Cleber Rosa
On 10/19/18 3:15 PM, Max Reitz wrote: > When dumping an object into the log, there are differences between > Python 2 and 3. First, unicode strings are prefixed by 'u' in Python 2 > (they are no longer in 3, because unicode strings are the default > there). Second, the order of keys in dicts

Re: [Qemu-block] [PATCH v2 8/9] iotests: Modify imports for Python 3

2018-10-19 Thread Cleber Rosa
On 10/19/18 3:15 PM, Max Reitz wrote: > There are two imports that need to be modified when running the iotests > under Python 3: One is StringIO, which no longer exists; instead, the > StringIO class comes from the io module, so import it from there (and > use the BytesIO class for Python 2).

Re: [Qemu-block] [PATCH v2 7/9] iotests: 'new' module replacement in 169

2018-10-19 Thread Cleber Rosa
On 10/19/18 3:15 PM, Max Reitz wrote: > iotest 169 uses the 'new' module to add methods to a class. This module > no longer exists in Python 3. Instead, we can use a lambda. Best of > all, this works in 2.7 just as well. > > Signed-off-by: Max Reitz > Reviewed-by: Eduardo Habkost

Re: [Qemu-block] [PATCH v2 6/9] iotests: Explicitly inherit FDs in Python

2018-10-19 Thread Cleber Rosa
On 10/19/18 3:15 PM, Max Reitz wrote: > Python 3.4 introduced the inheritable attribute for FDs. At the same > time, it changed the default so that all FDs are not inheritable by > default, that only inheritable FDs are inherited to subprocesses, and > only if close_fds is explicitly set to

Re: [Qemu-block] [PATCH v2 5/9] iotests: Different iterator behavior in Python 3

2018-10-19 Thread Cleber Rosa
On 10/19/18 3:15 PM, Max Reitz wrote: > In Python 3, several functions now return iterators instead of lists. > This includes range(), items(), map(), and filter(). This means that if > we really want a list, we have to wrap those instances with list(). But > then again, the two instances

Re: [Qemu-block] [Qemu-devel] [PATCH v2 4/9] iotests: Use // for Python integer division

2018-10-19 Thread Cleber Rosa
On 10/19/18 3:15 PM, Max Reitz wrote: > In Python 3, / is always a floating-point division. We usually do not > want this, and as Python 2.7 understands // as well, change all integer > divisions to use that. > > Signed-off-by: Max Reitz Reviewed-by: Cleber Rosa

[Qemu-block] [PATCH v4 8/8] kvm: Potential NULL pointer dereference in kvm_arch_init_vcpu()

2018-10-19 Thread Liam Merwick
In kvm_arch_init_vcpu() a call to cpuid_find_entry() can return NULL so the pointer returned should be checked before dereferencing it. Signed-off-by: Liam Merwick --- target/i386/kvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c

[Qemu-block] [PATCH v4 5/8] block: Fix potential Null pointer dereferences in vvfat.c

2018-10-19 Thread Liam Merwick
The calls to find_mapping_for_cluster() may return NULL but it isn't always checked for before dereferencing the value returned. Additionally, add some asserts to cover cases where NULL can't be returned but which might not be obvious at first glance. Signed-off-by: Liam Merwick ---

[Qemu-block] [PATCH v4 7/8] qcow2: Read outside array bounds in qcow2_pre_write_overlap_check()

2018-10-19 Thread Liam Merwick
The commit for 0e4e4318eaa5 increments QCOW2_OL_MAX_BITNR but does not add an array entry for QCOW2_OL_BITMAP_DIRECTORY_BITNR to metadata_ol_names[]. As a result, an array dereference of metadata_ol_names[8] in qcow2_pre_write_overlap_check() could result in a read outside of the array bounds.

[Qemu-block] [PATCH v4 6/8] block: dump_qlist() may dereference a Null pointer

2018-10-19 Thread Liam Merwick
A NULL 'list' passed into function dump_qlist() isn't correctly validated and can be passed to qlist_first() where it is dereferenced. Given that dump_qlist() is static, and callers already do the right thing, just add an assert to catch future potential bugs (plus the added benefit of

[Qemu-block] [PATCH v4 1/8] configure: Provide option to explicitly disable AVX2

2018-10-19 Thread Liam Merwick
The configure script detects if the compiler has AVX2 support and automatically sets avx2_opt="yes" which in turn defines CONFIG_AVX2_OPT. There is no way of explicitly overriding this setting so this commit adds two command-line options: --enable-avx2 and --disable-avx2. The default behaviour,

[Qemu-block] [PATCH v4 4/8] qemu-img: assert block_job_get() does not return NULL in img_commit()

2018-10-19 Thread Liam Merwick
Although the function block_job_get() can return NULL, it would be a serious bug if it did so (because the job yields before executing anything (if it started successfully); but otherwise, commit_active_start() would have returned an error). However, as a precaution, before dereferencing the

[Qemu-block] [PATCH v4 0/8] off-by-one and NULL pointer accesses detected by static analysis

2018-10-19 Thread Liam Merwick
Below are a number of fixes to some off-by-one, read outside array bounds, and NULL pointer accesses detected by an internal Oracle static analysis tool (Parfait). https://labs.oracle.com/pls/apex/f?p=labs:49:P49_PROJECT_ID:13 I have also included a patch to add a command-line option to

[Qemu-block] [PATCH v4 3/8] block: Null pointer dereference in blk_root_get_parent_desc()

2018-10-19 Thread Liam Merwick
The dev_id returned by the call to blk_get_attached_dev_id() in blk_root_get_parent_desc() can be NULL (an internal call to object_get_canonical_path may have returned NULL). Instead of just checking this case before before dereferencing, adjust blk_get_attached_dev_id() to return the empty

[Qemu-block] [PATCH v4 2/8] job: Fix off-by-one assert checks for JobSTT and JobVerbTable

2018-10-19 Thread Liam Merwick
In the assert checking the array dereference of JobVerbTable[verb] in job_apply_verb() the check of the index, verb, allows an overrun because an index equal to the array size is permitted. Similarly, in the assert check of JobSTT[s0][s1] with index s1 in job_state_transition(), an off-by-one

Re: [Qemu-block] [Qemu-devel] [PATCH v3 3/8] block: Null pointer dereference in blk_root_get_parent_desc()

2018-10-19 Thread Liam Merwick
On 12/10/18 15:48, Max Reitz wrote: Hi, On 31.08.18 20:16, Liam Merwick wrote: The dev_id returned by the call to blk_get_attached_dev_id() in blk_root_get_parent_desc() can be NULL (an internal call to object_get_canonical_path may have returned NULL) so it should be checked before

Re: [Qemu-block] [PATCH v2 8/9] iotests: Modify imports for Python 3

2018-10-19 Thread Eduardo Habkost
On Fri, Oct 19, 2018 at 09:15:22PM +0200, Max Reitz wrote: > There are two imports that need to be modified when running the iotests > under Python 3: One is StringIO, which no longer exists; instead, the > StringIO class comes from the io module, so import it from there (and > use the BytesIO

Re: [Qemu-block] [PATCH v2 6/9] iotests: Explicitly inherit FDs in Python

2018-10-19 Thread Eduardo Habkost
On Fri, Oct 19, 2018 at 09:15:20PM +0200, Max Reitz wrote: > Python 3.4 introduced the inheritable attribute for FDs. At the same > time, it changed the default so that all FDs are not inheritable by > default, that only inheritable FDs are inherited to subprocesses, and > only if close_fds is

Re: [Qemu-block] [PATCH v2 4/9] iotests: Use // for Python integer division

2018-10-19 Thread Eduardo Habkost
On Fri, Oct 19, 2018 at 09:15:18PM +0200, Max Reitz wrote: > In Python 3, / is always a floating-point division. We usually do not > want this, and as Python 2.7 understands // as well, change all integer > divisions to use that. > > Signed-off-by: Max Reitz Reviewed-by: Eduardo Habkost --

Re: [Qemu-block] [PATCH v2 5/9] iotests: Different iterator behavior in Python 3

2018-10-19 Thread Eduardo Habkost
On Fri, Oct 19, 2018 at 09:15:19PM +0200, Max Reitz wrote: > In Python 3, several functions now return iterators instead of lists. > This includes range(), items(), map(), and filter(). This means that if > we really want a list, we have to wrap those instances with list(). But > then again, the

[Qemu-block] [PATCH v2 0/9] iotests: Make them work for both Python 2 and 3

2018-10-19 Thread Max Reitz
This series prepares the iotests to work with both Python 2 and 3. In some places, it adds version-specific code and decides what to do based on the version (for instance, whether to import the StringIO or the BytesIO class from 'io' for use with the test runner), but most of the time, it just

[Qemu-block] [PATCH v2 9/9] iotests: Unify log outputs between Python 2 and 3

2018-10-19 Thread Max Reitz
When dumping an object into the log, there are differences between Python 2 and 3. First, unicode strings are prefixed by 'u' in Python 2 (they are no longer in 3, because unicode strings are the default there). Second, the order of keys in dicts may differ. Third, especially long numbers are

[Qemu-block] [PATCH v2 6/9] iotests: Explicitly inherit FDs in Python

2018-10-19 Thread Max Reitz
Python 3.4 introduced the inheritable attribute for FDs. At the same time, it changed the default so that all FDs are not inheritable by default, that only inheritable FDs are inherited to subprocesses, and only if close_fds is explicitly set to False. Adhere to this by setting close_fds to

[Qemu-block] [PATCH v2 5/9] iotests: Different iterator behavior in Python 3

2018-10-19 Thread Max Reitz
In Python 3, several functions now return iterators instead of lists. This includes range(), items(), map(), and filter(). This means that if we really want a list, we have to wrap those instances with list(). But then again, the two instances where this is the case for map() and filter(), there

[Qemu-block] [PATCH v2 3/9] iotests: Use Python byte strings where appropriate

2018-10-19 Thread Max Reitz
Since byte strings are no longer the default in Python 3, we have to explicitly use them where we need to, which is mostly when working with structures. It also means that we need to open a file in binary mode when we want to use structures. On the other hand, we have to accomodate for the fact

[Qemu-block] [PATCH v2 8/9] iotests: Modify imports for Python 3

2018-10-19 Thread Max Reitz
There are two imports that need to be modified when running the iotests under Python 3: One is StringIO, which no longer exists; instead, the StringIO class comes from the io module, so import it from there (and use the BytesIO class for Python 2). The other is the ConfigParser, which has just

[Qemu-block] [PATCH v2 7/9] iotests: 'new' module replacement in 169

2018-10-19 Thread Max Reitz
iotest 169 uses the 'new' module to add methods to a class. This module no longer exists in Python 3. Instead, we can use a lambda. Best of all, this works in 2.7 just as well. Signed-off-by: Max Reitz Reviewed-by: Eduardo Habkost --- tests/qemu-iotests/169 | 3 +-- 1 file changed, 1

[Qemu-block] [PATCH v2 4/9] iotests: Use // for Python integer division

2018-10-19 Thread Max Reitz
In Python 3, / is always a floating-point division. We usually do not want this, and as Python 2.7 understands // as well, change all integer divisions to use that. Signed-off-by: Max Reitz --- tests/qemu-iotests/030| 2 +- tests/qemu-iotests/040| 4 ++--

[Qemu-block] [PATCH v2 1/9] iotests: Make nbd-fault-injector flush

2018-10-19 Thread Max Reitz
When closing a connection, make the nbd-fault-injector flush the socket. Without this, the output is a bit unreliable with Python 3. Signed-off-by: Max Reitz Reviewed-by: Eduardo Habkost Reviewed-by: Cleber Rosa Reviewed-by: Eric Blake --- tests/qemu-iotests/083.out | 9

[Qemu-block] [PATCH v2 2/9] iotests: Flush in iotests.py's QemuIoInteractive

2018-10-19 Thread Max Reitz
After issuing a command, flush the pipe. This does not change anything in Python 2, but it makes a difference in Python 3. Signed-off-by: Max Reitz Reviewed-by: Eduardo Habkost Reviewed-by: Cleber Rosa --- tests/qemu-iotests/iotests.py | 1 + 1 file changed, 1 insertion(+) diff --git

Re: [Qemu-block] [PATCH v4 03/11] rbd: Close image in qemu_rbd_open() error path

2018-10-19 Thread Eric Blake
On 10/19/18 11:30 AM, Kevin Wolf wrote: Commit e2b8247a322 introduced an error path in qemu_rbd_open() after calling rbd_open(), but neglected to close the image again in this error path. The error path should contain everything that the regular close function qemu_rbd_close() contains. This

[Qemu-block] [PATCH v2 0/5] Various option help readability improvement suggestions

2018-10-19 Thread Max Reitz
I noticed that with the (more or less) recent series from Marc-André the output of qemu-img amend -f qcow2 -o help changed to this: $ ./qemu-img amend -f qcow2 -o help Creation options for 'qcow2': qcow2-create-opts.backing_file=str - File name of a base image qcow2-create-opts.backing_fmt=str -

[Qemu-block] [PATCH v2 1/5] option: Make option help nicer to read

2018-10-19 Thread Max Reitz
This adds some whitespace into the option help (including indentation) and puts angle brackets around the type names. Furthermore, the list name is no longer printed as part of every line, but only once in advance, and only if the caller did not print a caption already. This patch also restores

[Qemu-block] [PATCH v2 2/5] chardev: Indent list of chardevs

2018-10-19 Thread Max Reitz
Following the example of qemu_opts_print_help(), indent all entries in the list of character devices. Signed-off-by: Max Reitz --- chardev/char.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chardev/char.c b/chardev/char.c index e115166995..10d44aaefc 100644 ---

[Qemu-block] [PATCH v2 5/5] fw_cfg: Drop newline in @file description

2018-10-19 Thread Max Reitz
There is no good reason why there should be a newline in this description, so remove it. Signed-off-by: Max Reitz Reviewed-by: Philippe Mathieu-Daudé --- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vl.c b/vl.c index ecddbb6b8e..6604648570 100644 --- a/vl.c +++

[Qemu-block] [PATCH v2 4/5] object: Make option help nicer to read

2018-10-19 Thread Max Reitz
Just like in qemu_opts_print_help(), print the object name as a caption instead of on every single line, indent all options, add angle brackets around types, and align the descriptions after 24 characters. Also, indent every object name in the list of available objects. Signed-off-by: Max Reitz

[Qemu-block] [PATCH v2 3/5] qdev-monitor: Make device options help nicer

2018-10-19 Thread Max Reitz
Just like in qemu_opts_print_help(), print the device name as a caption instead of on every single line, indent all options, add angle brackets around types, and align the descriptions after 24 characters. Also, separate the descriptions with " - " instead of putting them in parentheses, because

[Qemu-block] [PATCH v4 03/11] rbd: Close image in qemu_rbd_open() error path

2018-10-19 Thread Kevin Wolf
Commit e2b8247a322 introduced an error path in qemu_rbd_open() after calling rbd_open(), but neglected to close the image again in this error path. The error path should contain everything that the regular close function qemu_rbd_close() contains. This adds the missing rbd_close() call.

[Qemu-block] [PATCH v4 09/11] iscsi: Support auto-read-only option

2018-10-19 Thread Kevin Wolf
If read-only=off, but auto-read-only=on is given, open the volume read-write if we have the permissions, but instead of erroring out for read-only volumes, just degrade to read-only. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/iscsi.c | 8 +--- 1 file changed, 5

[Qemu-block] [PATCH v4 08/11] gluster: Support auto-read-only option

2018-10-19 Thread Kevin Wolf
If read-only=off, but auto-read-only=on is given, open the file read-write if we have the permissions, but instead of erroring out for read-only files, just degrade to read-only. Signed-off-by: Kevin Wolf Reviewed-by: Niels de Vos --- block/gluster.c | 12 ++-- 1 file changed, 10

[Qemu-block] [PATCH v4 05/11] nbd: Support auto-read-only option

2018-10-19 Thread Kevin Wolf
If read-only=off, but auto-read-only=on is given, open a read-write NBD connection if the server provides a read-write export, but instead of erroring out for read-only exports, just degrade to read-only. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/nbd-client.c | 10 +-

[Qemu-block] [PATCH v4 04/11] block: Require auto-read-only for existing fallbacks

2018-10-19 Thread Kevin Wolf
Some block drivers have traditionally changed their node to read-only mode without asking the user. This behaviour has been marked deprecated since 2.11, expecting users to provide an explicit read-only=on option. Now that we have auto-read-only=on, enable these drivers to make use of the option.

[Qemu-block] [PATCH v4 02/11] block: Add auto-read-only option

2018-10-19 Thread Kevin Wolf
If a management application builds the block graph node by node, the protocol layer doesn't inherit its read-only option from the format layer any more, so it must be set explicitly. Backing files should work on read-only storage, but at the same time, a block job like commit should be able to

[Qemu-block] [PATCH v4 06/11] file-posix: Support auto-read-only option

2018-10-19 Thread Kevin Wolf
If read-only=off, but auto-read-only=on is given, open the file read-write if we have the permissions, but instead of erroring out for read-only files, just degrade to read-only. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/file-posix.c | 19 --- 1 file changed,

[Qemu-block] [PATCH v4 00/11] block: Add auto-read-only option

2018-10-19 Thread Kevin Wolf
See patch 2 for an explanation of the motivation. v4: - Split fix for missing rbd_close() into a separate patch [Eric] - Added qemu-iotests case v3: - Clarified QAPI schema documentation that auto-read-only can only degrade read-write to read-only, not the other way round [Eric] - Don't refuse

[Qemu-block] [PATCH v4 07/11] curl: Support auto-read-only option

2018-10-19 Thread Kevin Wolf
If read-only=off, but auto-read-only=on is given, just degrade to read-only. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/curl.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/block/curl.c b/block/curl.c index fabb2b4da7..db5d2bd8ef 100644 ---

[Qemu-block] [PATCH v4 01/11] block: Update flags in bdrv_set_read_only()

2018-10-19 Thread Kevin Wolf
To fully change the read-only state of a node, we must not only change bs->read_only, but also update bs->open_flags. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia --- block.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/block.c b/block.c index

Re: [Qemu-block] [Qemu-devel] [PATCH 1/9] iotests: Make nbd-fault-injector flush

2018-10-19 Thread Eric Blake
On 10/19/18 4:48 AM, Max Reitz wrote: On 16.10.18 20:07, Eric Blake wrote: On 10/15/18 9:14 AM, Max Reitz wrote: When closing a connection, make the nbd-fault-injector flush the socket. Without this, the output is a bit unreliable with Python 3. Signed-off-by: Max Reitz ---  

Re: [Qemu-block] [Qemu-devel] [PATCH 7/9] iotests: 'new' module replacement in 169

2018-10-19 Thread Eduardo Habkost
On Fri, Oct 19, 2018 at 11:46:59AM +0200, Max Reitz wrote: [...] > I mean, my personal goal is not to touch this beyond what I need to > because it's black magic to me anyway, so I'm happy with what works. I agree with this approach, and your original patch looks good enough to me. -- Eduardo

[Qemu-block] [PATCH v3 15/15] block: Assert that flags are up-to-date in bdrv_reopen_prepare()

2018-10-19 Thread Alberto Garcia
Towards the end of bdrv_reopen_queue_child(), before starting to process the children, the update_flags_from_options() function is called in order to have BDRVReopenState.flags in sync with the options from the QDict. This is necessary because during the reopen process flags must be updated for

[Qemu-block] [PATCH v3 13/15] block: Stop passing flags to bdrv_reopen_queue_child()

2018-10-19 Thread Alberto Garcia
Now that all callers are passing the new options using the QDict we no longer need the 'flags' parameter. This patch makes the following changes: 1) The update_options_from_flags() call is no longer necessary so it can be removed. 2) The update_flags_from_options() call is now used

[Qemu-block] [PATCH v3 00/15] Don't pass flags to bdrv_reopen_queue()

2018-10-19 Thread Alberto Garcia
Hi all, when reopening a BlockDriverState using bdrv_reopen() and friends the new options can be specified either with a QDict or with flags. Both methods overlap and that makes the semantics and the implementation unnecessarily complicated. This series removes the 'flags' parameter from these

[Qemu-block] [PATCH v3 12/15] block: Remove flags parameter from bdrv_reopen_queue()

2018-10-19 Thread Alberto Garcia
Now that all callers are passing all flag changes as QDict options, the flags parameter is no longer necessary, so we can get rid of it. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block.c | 5 +++-- block/replication.c | 6 ++ include/block/block.h | 3 +--

[Qemu-block] [PATCH v3 05/15] block: Use bdrv_reopen_set_read_only() in stream_start/complete()

2018-10-19 Thread Alberto Garcia
This patch replaces the bdrv_reopen() calls that set and remove the BDRV_O_RDWR flag with the new bdrv_reopen_set_read_only() function. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block/stream.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff

[Qemu-block] [PATCH v3 10/15] qemu-io: Put flag changes in the options QDict in reopen_f()

2018-10-19 Thread Alberto Garcia
When reopen_f() puts a block device in the reopen queue, some of the new options are passed using a QDict, but others ("read-only" and the cache options) are passed as flags. This patch puts those flags in the QDict. This way the flags parameter becomes redundant and we'll be able to get rid of

[Qemu-block] [PATCH v3 06/15] block: Use bdrv_reopen_set_read_only() in qmp_change_backing_file()

2018-10-19 Thread Alberto Garcia
This patch replaces the bdrv_reopen() calls that set and remove the BDRV_O_RDWR flag with the new bdrv_reopen_set_read_only() function. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- blockdev.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/blockdev.c

[Qemu-block] [PATCH v3 11/15] block: Clean up reopen_backing_file() in block/replication.c

2018-10-19 Thread Alberto Garcia
This function is used to put the hidden and secondary disks in read-write mode before launching the backup job, and back in read-only mode afterwards. This patch does the following changes: - Use an options QDict with the "read-only" option instead of passing the changes as flags only.

[Qemu-block] [PATCH v3 07/15] block: Use bdrv_reopen_set_read_only() in external_snapshot_commit()

2018-10-19 Thread Alberto Garcia
This patch replaces the bdrv_reopen() call that set and remove the BDRV_O_RDWR flag with the new bdrv_reopen_set_read_only() function. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- blockdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/blockdev.c

[Qemu-block] [PATCH v3 04/15] block: Use bdrv_reopen_set_read_only() in bdrv_commit()

2018-10-19 Thread Alberto Garcia
This patch replaces the bdrv_reopen() calls that set and remove the BDRV_O_RDWR flag with the new bdrv_reopen_set_read_only() function. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block/commit.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git

[Qemu-block] [PATCH v3 03/15] block: Use bdrv_reopen_set_read_only() in commit_start/complete()

2018-10-19 Thread Alberto Garcia
This patch replaces the bdrv_reopen() calls that set and remove the BDRV_O_RDWR flag with the new bdrv_reopen_set_read_only() function. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block/commit.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git

[Qemu-block] [PATCH v3 14/15] block: Remove assertions from update_flags_from_options()

2018-10-19 Thread Alberto Garcia
This function takes three options (cache.direct, cache.no-flush and read-only) from a QemuOpts object and updates the flags accordingly. If any of those options is not set (because it was missing from the original QDict or because it had an invalid value) then the function aborts with a failed

[Qemu-block] [PATCH v3 08/15] block: Use bdrv_reopen_set_read_only() in the mirror driver

2018-10-19 Thread Alberto Garcia
The 'block-commit' QMP command is implemented internally using two different drivers. If the source image is the active layer then the mirror driver is used (commit_active_start()), otherwise the commit driver is used (commit_start()). In both cases the destination image must be put temporarily

[Qemu-block] [PATCH v3 02/15] block: Use bdrv_reopen_set_read_only() in bdrv_backing_update_filename()

2018-10-19 Thread Alberto Garcia
This patch replaces the bdrv_reopen() calls that set and remove the BDRV_O_RDWR flag with the new bdrv_reopen_set_read_only() function. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block.c

[Qemu-block] [PATCH v3 09/15] block: Drop bdrv_reopen()

2018-10-19 Thread Alberto Garcia
No one is using this function anymore, so we can safely remove it. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block.c | 21 - include/block/block.h | 1 - 2 files changed, 22 deletions(-) diff --git a/block.c b/block.c index

[Qemu-block] [PATCH v3 01/15] block: Add bdrv_reopen_set_read_only()

2018-10-19 Thread Alberto Garcia
Most callers of bdrv_reopen() only use it to switch a BlockDriverState between read-only and read-write, so this patch adds a new function that does just that. We also want to get rid of the flags parameter in the bdrv_reopen() API, so this function sets the "read-only" option and passes the

Re: [Qemu-block] [Qemu-devel] [PATCH] block: drop moderated sheepdog mailing list from MAINTAINERS file

2018-10-19 Thread Philippe Mathieu-Daudé
On 19/10/2018 13:25, Daniel P. Berrangé wrote: > Paolo, I think this is a patch for your misc patches queue. It looks to me than this is more block/trivial than the busy misc queue. > > On Wed, Mar 21, 2018 at 03:31:24PM +, Daniel P. Berrangé wrote: >> The sheepdog mailing list is setup to

[Qemu-block] [PATCH] block: Make more block drivers compile-time configurable

2018-10-19 Thread Markus Armbruster
From: Jeff Cody This adds configure options to control the following block drivers: * Bochs * Cloop * Dmg * Qcow (V1) * Vdi * Vvfat * qed * parallels * sheepdog Each of these defaults to being enabled. Signed-off-by: Jeff Cody Signed-off-by: Markus Armbruster --- Hmm, we got quite a few

Re: [Qemu-block] [PATCH] block: drop moderated sheepdog mailing list from MAINTAINERS file

2018-10-19 Thread Daniel P . Berrangé
Paolo, I think this is a patch for your misc patches queue. On Wed, Mar 21, 2018 at 03:31:24PM +, Daniel P. Berrangé wrote: > The sheepdog mailing list is setup to stop and queue messages from > non-subscribers, pending moderator approval. Unfortunately it seems > that the moderation queue is

Re: [Qemu-block] [Qemu-devel] [PATCH 1/5] option: Make option help nicer to read

2018-10-19 Thread Max Reitz
On 17.10.18 08:50, Markus Armbruster wrote: > Max Reitz writes: > >> This adds some whitespace into the option help (including indentation) >> and replaces '=' by ': ' (not least because '=' should be used for >> values, not types). Furthermore, the list name is no longer printed as >> part of

Re: [Qemu-block] [PATCH 1/5] option: Make option help nicer to read

2018-10-19 Thread Max Reitz
On 16.10.18 14:12, Kevin Wolf wrote: > Am 15.10.2018 um 19:28 hat Max Reitz geschrieben: >> This adds some whitespace into the option help (including indentation) >> and replaces '=' by ': ' (not least because '=' should be used for >> values, not types). Furthermore, the list name is no longer

Re: [Qemu-block] [Qemu-devel] [PATCH 1/5] option: Make option help nicer to read

2018-10-19 Thread Max Reitz
On 16.10.18 08:46, Marc-André Lureau wrote: > Hi > > On Mon, Oct 15, 2018 at 9:34 PM Max Reitz wrote: >> >> This adds some whitespace into the option help (including indentation) >> and replaces '=' by ': ' (not least because '=' should be used for >> values, not types). > > Without strong

Re: [Qemu-block] [Qemu-devel] [PATCH 1/9] iotests: Make nbd-fault-injector flush

2018-10-19 Thread Max Reitz
On 16.10.18 20:07, Eric Blake wrote: > On 10/15/18 9:14 AM, Max Reitz wrote: >> When closing a connection, make the nbd-fault-injector flush the socket. >> Without this, the output is a bit unreliable with Python 3. >> >> Signed-off-by: Max Reitz >> --- >>   tests/qemu-iotests/083.out 

Re: [Qemu-block] [Qemu-devel] [PATCH 7/9] iotests: 'new' module replacement in 169

2018-10-19 Thread Max Reitz
On 16.10.18 03:01, Cleber Rosa wrote: > > > On 10/15/18 7:57 PM, Eduardo Habkost wrote: >> On Mon, Oct 15, 2018 at 07:38:45PM -0400, Cleber Rosa wrote: >>> >>> >>> On 10/15/18 10:14 AM, Max Reitz wrote: iotest 169 uses the 'new' module to add methods to a class. This module no longer

Re: [Qemu-block] [Qemu-devel] [PATCH 6/9] iotests: Explicitly inherit FDs in Python

2018-10-19 Thread Max Reitz
On 16.10.18 01:18, Cleber Rosa wrote: > > > On 10/15/18 10:14 AM, Max Reitz wrote: >> Python 3.2 introduced the inheritable attribute for FDs. At the same >> time, it changed the default so that all FDs are not inheritable by >> default, that only inheritable FDs are inherited to subprocesses,

Re: [Qemu-block] [Qemu-devel] [PATCH 5/9] iotests: Different iterator behavior in Python 3

2018-10-19 Thread Max Reitz
On 16.10.18 00:39, Cleber Rosa wrote: > > > On 10/15/18 10:14 AM, Max Reitz wrote: >> In Python 3, several functions now return iterators instead of lists. >> This includes range(), items(), map(), and filter(). This means that if >> we really want a list, we have to wrap those instances with

Re: [Qemu-block] [Qemu-devel] [PATCH 9/9] iotests: Unify log outputs between Python 2 and 3

2018-10-19 Thread Max Reitz
On 16.10.18 00:26, Eduardo Habkost wrote: > On Mon, Oct 15, 2018 at 04:14:53PM +0200, Max Reitz wrote: >> When dumping an object into the log, there are differences between >> Python 2 and 3. First, unicode strings are prefixed by 'u' in Python 2 >> (they are no longer in 3, because unicode

Re: [Qemu-block] [PATCH 8/9] iotests: Modify imports for Python 3

2018-10-19 Thread Max Reitz
On 16.10.18 02:12, Eduardo Habkost wrote: > On Mon, Oct 15, 2018 at 08:05:02PM -0400, Cleber Rosa wrote: >> >> >> On 10/15/18 5:17 PM, Eduardo Habkost wrote: >>> On Mon, Oct 15, 2018 at 04:14:52PM +0200, Max Reitz wrote: There are two imports that need to be modified when running the iotests

Re: [Qemu-block] [Qemu-devel] [PATCH 0/9] iotests: Make them work for both Python 2 and 3

2018-10-19 Thread Max Reitz
On 16.10.18 00:19, Philippe Mathieu-Daudé wrote: > Hi Max, > > On 15/10/2018 16:14, Max Reitz wrote: >> This series prepares the iotests to work with both Python 2 and 3. In >> some places, it adds version-specific code and decides what to do based >> on the version (for instance, whether to

Re: [Qemu-block] [Qemu-devel] [PATCH 4/9] iotests: Use // for Python integer division

2018-10-19 Thread Max Reitz
On 15.10.18 23:13, Cleber Rosa wrote: > > > On 10/15/18 10:14 AM, Max Reitz wrote: >> In Python 3, / is always a floating-point division. We usually do not >> want this, and as Python 2.7 understands // as well, change all integer >> divisions to use that. >> >> Signed-off-by: Max Reitz >> ---

Re: [Qemu-block] [PATCH 6/9] iotests: Explicitly inherit FDs in Python

2018-10-19 Thread Max Reitz
On 15.10.18 22:30, Eduardo Habkost wrote: > On Mon, Oct 15, 2018 at 04:14:50PM +0200, Max Reitz wrote: >> Python 3.2 introduced the inheritable attribute for FDs. At the same >> time, it changed the default so that all FDs are not inheritable by >> default, that only inheritable FDs are inherited

Re: [Qemu-block] [PATCH 5/9] iotests: Different iterator behavior in Python 3

2018-10-19 Thread Max Reitz
On 15.10.18 22:07, Eduardo Habkost wrote: > On Mon, Oct 15, 2018 at 04:14:49PM +0200, Max Reitz wrote: >> In Python 3, several functions now return iterators instead of lists. >> This includes range(), items(), map(), and filter(). This means that if >> we really want a list, we have to wrap

Re: [Qemu-block] [PATCH 3/9] iotests: Use Python byte strings where appropriate

2018-10-19 Thread Max Reitz
On 15.10.18 21:53, Eduardo Habkost wrote: > On Mon, Oct 15, 2018 at 04:14:47PM +0200, Max Reitz wrote: >> Since byte strings are no longer the default in Python 3, we have to >> explicitly use them where we need to, which is mostly when working with >> structures. It also means that we need to

Re: [Qemu-block] [PATCH 8/9] iotests: Modify imports for Python 3

2018-10-19 Thread Max Reitz
On 15.10.18 20:59, Cleber Rosa wrote: > > > On 10/15/18 10:14 AM, Max Reitz wrote: >> There are two imports that need to be modified when running the iotests >> under Python 3: One is StringIO, which no longer exists; instead, the >> StringIO class comes from the io module, so import it from