Re: [Qemu-block] [Qemu-devel] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Markus Armbruster
Eduardo Habkost writes: > On Mon, Oct 15, 2018 at 05:55:27PM +0100, Peter Maydell wrote: >> On 15 October 2018 at 17:33, Markus Armbruster wrote: >> > Kevin Wolf writes: >> > >> >> Am 15.10.2018 um 12:02 hat Peter Maydell geschrieben: >> >> It's easier to port stuff to Python 3 though than

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

2018-10-15 Thread Cleber Rosa
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 exists in Python 3. Instead, we can use a

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

2018-10-15 Thread Eduardo Habkost
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 > >> under Python 3: One is StringIO, which

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

2018-10-15 Thread Cleber Rosa
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 >> under Python 3: One is StringIO, which no longer exists; instead, the >> StringIO class comes from the io

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

2018-10-15 Thread Eduardo Habkost
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 exists in Python 3. Instead, we can use a lambda. Best of > > all, this works in 2.7 just as

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

2018-10-15 Thread Cleber Rosa
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 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 > --- > tests/qemu-iotests/169 | 3 +--

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

2018-10-15 Thread Cleber Rosa
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, and > only if close_fds is explicitly set to

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

2018-10-15 Thread Cleber Rosa
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 list(). On > the other hand, sometimes we do

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

2018-10-15 Thread Philippe Mathieu-Daudé
On 15/10/2018 19:28, Max Reitz wrote: > 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

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

2018-10-15 Thread Eduardo Habkost
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 strings are the default > there). [...] This could

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

2018-10-15 Thread Philippe Mathieu-Daudé
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 import the StringIO class from > the 'io' or the 'StringIO'

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

2018-10-15 Thread Philippe Mathieu-Daudé
On 15/10/2018 16:14, 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 open a file in binary mode > when we want to use structures. > > On

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

2018-10-15 Thread Eduardo Habkost
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 > under Python 3: One is StringIO, which no longer exists; instead, the > StringIO class comes from the io module, so import it from there. The > other is the

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

2018-10-15 Thread Eduardo Habkost
On Mon, Oct 15, 2018 at 04:14:51PM +0200, 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 > --- >

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

2018-10-15 Thread Cleber Rosa
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 > --- > tests/qemu-iotests/040| 4 ++-- >

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

2018-10-15 Thread Cleber Rosa
On 10/15/18 10:14 AM, Max Reitz wrote: > 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: Cleber Rosa

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

2018-10-15 Thread Eduardo Habkost
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 to subprocesses, and > only if close_fds is

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

2018-10-15 Thread Cleber Rosa
On 10/15/18 10: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 Reviewed-by: Cleber Rosa

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

2018-10-15 Thread Eduardo Habkost
On Mon, Oct 15, 2018 at 02:59:28PM -0400, 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

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

2018-10-15 Thread Eduardo Habkost
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 those instances with list(). On > the other hand,

[Qemu-block] [RFC PATCH] iotests: make 083 specific to raw

2018-10-15 Thread Cleber Rosa
While testing the Python 3 changes which touch the 083 test, I noticed that it would fail with qcow2. Expanding the testing, I noticed it had nothing to do with the Python 3 changes, and in fact, it would not pass on anything but raw: raw: pass bochs: not generic cloop: not generic

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

2018-10-15 Thread Eduardo Habkost
On Mon, Oct 15, 2018 at 04:14:48PM +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 3/9] iotests: Use Python byte strings where appropriate

2018-10-15 Thread Eduardo Habkost
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 open a file in binary mode > when we want to use

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

2018-10-15 Thread Eduardo Habkost
On Mon, Oct 15, 2018 at 04:14:46PM +0200, Max Reitz wrote: > 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 -- Eduardo

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

2018-10-15 Thread Cleber Rosa
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 there. The > other is the ConfigParser, which

Re: [Qemu-block] [Qemu-devel] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Christian Borntraeger
On 10/15/2018 08:33 PM, Eduardo Habkost wrote: > On Mon, Oct 15, 2018 at 08:19:18PM +0200, Christian Borntraeger wrote: [...] It's easier to port stuff to Python 3 though than making them work with both. I think Eduardo's RFC is in part motivated by a patch from Philippe

Re: [Qemu-block] [Qemu-devel] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Eduardo Habkost
On Mon, Oct 15, 2018 at 08:19:18PM +0200, Christian Borntraeger wrote: > > > On 10/15/2018 06:33 PM, Markus Armbruster wrote: > > Kevin Wolf writes: > > > >> Am 15.10.2018 um 12:02 hat Peter Maydell geschrieben: > >>> On 15 October 2018 at 10:32, Daniel P. Berrangé > >>> wrote: > On

Re: [Qemu-block] [Qemu-devel] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Christian Borntraeger
On 10/15/2018 06:33 PM, Markus Armbruster wrote: > Kevin Wolf writes: > >> Am 15.10.2018 um 12:02 hat Peter Maydell geschrieben: >>> On 15 October 2018 at 10:32, Daniel P. Berrangé wrote: On Sat, Oct 13, 2018 at 02:02:27AM -0300, Eduardo Habkost wrote: > Signed-off-by: Eduardo

Re: [Qemu-block] [Qemu-devel] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Eduardo Habkost
On Mon, Oct 15, 2018 at 05:55:27PM +0100, Peter Maydell wrote: > On 15 October 2018 at 17:33, Markus Armbruster wrote: > > Kevin Wolf writes: > > > >> Am 15.10.2018 um 12:02 hat Peter Maydell geschrieben: > >> It's easier to port stuff to Python 3 though than making them work with > >> both. I

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

2018-10-15 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 --- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vl.c b/vl.c index f9ed053eab..19f8cc67ff 100644 --- a/vl.c +++ b/vl.c @@ -529,7 +529,7 @@ static

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

2018-10-15 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, and replace the '=' by ': '. Signed-off-by: Max Reitz --- qdev-monitor.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qdev-monitor.c

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

2018-10-15 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, and replace the '=' by ': '. Also, indent every object name in the list of available objects. Signed-off-by: Max Reitz --- vl.c | 12 1 file changed, 8

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

2018-10-15 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 1/5] option: Make option help nicer to read

2018-10-15 Thread Max Reitz
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 every line, but only once in advance, and only if the caller did not print a

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

2018-10-15 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 ---

Re: [Qemu-block] [Qemu-devel] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Peter Maydell
On 15 October 2018 at 17:33, Markus Armbruster wrote: > Kevin Wolf writes: > >> Am 15.10.2018 um 12:02 hat Peter Maydell geschrieben: >> It's easier to port stuff to Python 3 though than making them work with >> both. I think Eduardo's RFC is in part motivated by a patch from >> Philippe that

[Qemu-block] [PATCH v5 1/3] qapi: add x-debug-query-block-graph

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Add a new command, returning block nodes (and their users) graph. Signed-off-by: Vladimir Sementsov-Ogievskiy --- qapi/block-core.json | 108 include/block/block.h | 1 + include/sysemu/block-backend.h | 2 + block.c| 147

[Qemu-block] [PATCH v5 2/3] scripts: add render_block_graph function for QEMUMachine

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Render block nodes graph with help of graphviz. This new function is for debugging, so there is no sense to put it into qemu.py as a method of QEMUMachine. Let's instead put it separately. Signed-off-by: Vladimir Sementsov-Ogievskiy Acked-by: Eduardo Habkost Reviewed-by: Max Reitz ---

[Qemu-block] [PATCH v5 3/3] not-for-commit: example of new command usage for debugging

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/222 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/222 b/tests/qemu-iotests/222 index 0ead56d574..91d88aa5c0 100644 --- a/tests/qemu-iotests/222 +++ b/tests/qemu-iotests/222 @@ -137,6 +137,8 @@ with

[Qemu-block] [PATCH v5 0/3] block nodes graph visualization

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Hi all! On the way of backup schemes development (and in general any complicated developments in Qemu block layer) it would be good to have an ability to print out graph of block nodes with their permissions. v4: 01: fix !name -> !*name for checking the result of blk_name rename BlockGraph

Re: [Qemu-block] [PATCH] qcow2: Get the request alignment for encrypted images from QCryptoBlock

2018-10-15 Thread Max Reitz
On 11.10.18 12:58, Alberto Garcia wrote: > This doesn't have any practical effect at the moment because the > values of BDRV_SECTOR_SIZE, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE and > QCRYPTO_BLOCK_QCOW_SECTOR_SIZE are all the same (512 bytes), but > future encryption methods could have different

Re: [Qemu-block] [Qemu-devel] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Markus Armbruster
Kevin Wolf writes: > Am 15.10.2018 um 12:02 hat Peter Maydell geschrieben: >> On 15 October 2018 at 10:32, Daniel P. Berrangé wrote: >> > On Sat, Oct 13, 2018 at 02:02:27AM -0300, Eduardo Habkost wrote: >> >> Signed-off-by: Eduardo Habkost >> >> --- >> >> I'd like to do this in QEMU 3.1. I

[Qemu-block] [PATCH v4 07/11] iotests: prepare 055 to graph changes during backup job

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Backup will append fleecing-hook node above source node, so, we can't resume by device name (because resume don't search recursively through backing chain). Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/055 | 23 +-- 1 file changed, 13 insertions(+), 10

[Qemu-block] [PATCH v4 08/11] block: introduce backup-top filter driver

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Backup-top filter does copy-before-write operation. It should be inserted above active disk and has a target node for CBW, like the following: +---+ | Guest | +---+---+ |r,w v +---+---+ target +---+ | backup_top|-->|

[Qemu-block] [PATCH v4 06/11] iotests: allow resume_drive by node name

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
After node graph changes, we may not be able to resume_drive by device name (backing files are not recursively searched). So, lets allow to resume by node-name. Set constant name for breakpoints, to avoid introducing extra parameters. Signed-off-by: Vladimir Sementsov-Ogievskiy ---

[Qemu-block] [PATCH v4 11/11] block/backup: use backup-top instead of write notifiers

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Drop write notifiers and use filter node instead. Changes: 1. copy-before-writes now handled by filter node, so, drop all is_write_notifier arguments. 2. we don't have intersecting requests, so their handling is dropped. Instead, synchronization works as follows: when backup or backup-top

[Qemu-block] [PATCH v4 04/11] block: improve should_update_child

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
As it already said in the comment, we don't want to create loops in parent->child relations. So, when we try to append @to to @c, we should check that @c is not in @to children subtree, and we should check it recursively, not only the first level. The patch provides BFS-based search, to check the

[Qemu-block] [PATCH v4 02/11] block/backup: move to copy_bitmap with granularity

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
We are going to share this bitmap between backup and backup-top filter driver, so let's share something more meaningful. It also simplifies some calculations. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/backup.c | 48 +++- 1 file changed, 23

[Qemu-block] [PATCH v4 09/11] block: add lock/unlock range functions

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
From: Vladimir Sementsov-Ogievskiy Introduce lock/unlock range functionality, based on serialized requests. This is needed to refactor backup, dropping local tracked-request-like synchronization. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 3 +++ block/io.c

[Qemu-block] [PATCH v4 10/11] block/backup: tiny refactor backup_job_create

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Move copy-bitmap find/create code. It's needed for the following commit, as we'll need copy_bitmap before actual block job creation. Do it in a separate commit to simplify review. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/backup.c | 67

[Qemu-block] [PATCH v4 03/11] block: allow serialized reads to intersect

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Otherwise, if we have serialized read-part in copy_range from backing file to its parent if CoW take place, this CoW's sub-reads will intersect with firstly created serialized read request. Anyway, reads should not influence on disk view, let's allow them to intersect. Signed-off-by: Vladimir

[Qemu-block] [PATCH v4 01/11] block/backup: simplify backup_incremental_init_copy_bitmap

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Simplify backup_incremental_init_copy_bitmap using the function bdrv_dirty_bitmap_next_dirty_area. Note: move to job->len instead of bitmap size: it should not matter but less code. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/backup.c | 40 1

[Qemu-block] [PATCH v4 05/11] iotests: handle -f argument correctly for qemu_io_silent

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Correctly rewrite default argument. After the patch, the function can be used for other (not only default test-chosen) image format. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

[Qemu-block] [PATCH v4 00/11] backup-top filter driver for backup

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
Hi all! These series introduce backup-top driver. It's a filter-node, which do copy-before-write operation. Mirror uses filter-node for handling guest writes, let's move to filter-node (from write-notifiers) for backup too (patch 16) v4: fixes, rewrite driver to be implicit, drop new interfaces

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

2018-10-15 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 8/9] iotests: Modify imports for Python 3

2018-10-15 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. The other is the ConfigParser, which has just been renamed to configparser.

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

2018-10-15 Thread Max Reitz
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, and only if close_fds is explicitly set to False. Adhere to this by setting close_fds to

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

2018-10-15 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 --- tests/qemu-iotests/169 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

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

2018-10-15 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 5/9] iotests: Different iterator behavior in Python 3

2018-10-15 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(). On the other hand, sometimes we do just want an iterator, in which case we have

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

2018-10-15 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 --- tests/qemu-iotests/iotests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qemu-iotests/iotests.py

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

2018-10-15 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/040| 4 ++-- tests/qemu-iotests/044| 2 +-

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

2018-10-15 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 class from the 'io' or the 'StringIO' module), but most of the time, it just makes code work

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

2018-10-15 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 --- tests/qemu-iotests/083.out | 9 + tests/qemu-iotests/nbd-fault-injector.py | 1 + 2 files changed, 10

Re: [Qemu-block] [Qemu-devel] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Max Reitz
On 15.10.18 13:01, Max Reitz wrote: > On 15.10.18 07:55, Markus Armbruster wrote: >> Max Reitz writes: >> >>> On 13.10.18 22:36, Eduardo Habkost wrote: On Sat, Oct 13, 2018 at 08:20:25PM +0200, Max Reitz wrote: > On 13.10.18 07:02, Eduardo Habkost wrote: >> Signed-off-by: Eduardo

Re: [Qemu-block] [Qemu-devel] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Max Reitz
On 15.10.18 07:55, Markus Armbruster wrote: > Max Reitz writes: > >> On 13.10.18 22:36, Eduardo Habkost wrote: >>> On Sat, Oct 13, 2018 at 08:20:25PM +0200, Max Reitz wrote: On 13.10.18 07:02, Eduardo Habkost wrote: > Signed-off-by: Eduardo Habkost > --- > I'd like to do this

Re: [Qemu-block] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Kevin Wolf
Am 15.10.2018 um 12:02 hat Peter Maydell geschrieben: > On 15 October 2018 at 10:32, Daniel P. Berrangé wrote: > > On Sat, Oct 13, 2018 at 02:02:27AM -0300, Eduardo Habkost wrote: > >> Signed-off-by: Eduardo Habkost > >> --- > >> I'd like to do this in QEMU 3.1. I think it's time to drop > >>

Re: [Qemu-block] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Daniel P . Berrangé
On Mon, Oct 15, 2018 at 11:02:03AM +0100, Peter Maydell wrote: > On 15 October 2018 at 10:32, Daniel P. Berrangé wrote: > > On Sat, Oct 13, 2018 at 02:02:27AM -0300, Eduardo Habkost wrote: > >> Signed-off-by: Eduardo Habkost > >> --- > >> I'd like to do this in QEMU 3.1. I think it's time to

Re: [Qemu-block] [PATCH] block: change some function return type to bool

2018-10-15 Thread Kevin Wolf
Am 13.10.2018 um 10:52 hat Li Qiang geschrieben: > Signed-off-by: Li Qiang Thanks, applied to the block branch. Kevin

Re: [Qemu-block] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Peter Maydell
On 15 October 2018 at 10:32, Daniel P. Berrangé wrote: > On Sat, Oct 13, 2018 at 02:02:27AM -0300, Eduardo Habkost wrote: >> Signed-off-by: Eduardo Habkost >> --- >> I'd like to do this in QEMU 3.1. I think it's time to drop >> support for old systems that have only Python 2. >> >> We still

[Qemu-block] ping Re: [Qemu-devel] [PATCH 4/6] dirty-bitmaps: clean-up bitmaps loading and migration logic

2018-10-15 Thread Vladimir Sementsov-Ogievskiy
ping 18.09.2018 13:37, Vladimir Sementsov-Ogievskiy wrote: > 17.09.2018 21:33, John Snow wrote: >> >> On 09/17/2018 11:51 AM, Vladimir Sementsov-Ogievskiy wrote: >>> Hmm, ping, anybody here ?) >>> >> Was preparing to stage on Friday, working on it now. >> >> I never understood why you forbid the

Re: [Qemu-block] [PATCH v2 2/8] block: Add auto-read-only option

2018-10-15 Thread Kevin Wolf
Am 12.10.2018 um 18:47 hat Eric Blake geschrieben: > On 10/12/18 6:55 AM, Kevin Wolf wrote: > > 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. > > > > >

Re: [Qemu-block] [RFC] Require Python 3 for building QEMU

2018-10-15 Thread Daniel P . Berrangé
On Sat, Oct 13, 2018 at 02:02:27AM -0300, Eduardo Habkost wrote: > Signed-off-by: Eduardo Habkost > --- > I'd like to do this in QEMU 3.1. I think it's time to drop > support for old systems that have only Python 2. > > We still have a few scripts that are not required for building > QEMU that

Re: [Qemu-block] [PATCH] block: change some function return type to bool

2018-10-15 Thread Alberto Garcia
On Sat 13 Oct 2018 10:52:31 AM CEST, Li Qiang wrote: > Signed-off-by: Li Qiang Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH 2/3] Introduce attributes to qemu timer subsystem

2018-10-15 Thread Paolo Bonzini
On 14/10/2018 16:55, Artem Pisarenko wrote: > Attributes are simple flags, associated with individual timers for their > whole lifetime. > They intended to be used to mark individual timers for special handling by > various qemu features operating at qemu core level. > Existing timer, aio and