Re: [PATCH 03/20] python/machine.py: reorder __init__

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > Put the init arg handling all at the top, and mostly in order (deviating > when one is dependent on another), and put what is effectively runtime > state declaration at the bottom. > > Signed-off-by: John Snow > --- > python/qemu/machine.py | 4

Re: [PATCH 01/20] python/qemu: use isort to lay out imports

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:57 hat John Snow geschrieben: > Borrowed from the QAPI cleanup series, use the same configuration to > standardize the way we write and sort imports. > > Signed-off-by: John Snow Reviewed-by: Kevin Wolf

Re: [PATCH 07/20] python/machine.py: Add _qmp access shim

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > Like many other Optional[] types, it's not always a given that this > object will be set. Wrap it in a type-shim that raises a meaningful > error and will always return a concrete type. > > Signed-off-by: John Snow > @@ -515,11 +515,13 @@ def s

Re: [PATCH 08/20] python/machine.py: fix _popen access

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > As always, Optional[T] causes problems with unchecked access. Add a > helper that asserts the pipe is present before we attempt to talk with > it. > > Signed-off-by: John Snow First a question about the preexisting state: I see that after initi

Re: [PATCH v10 6/9] copy-on-read: skip non-guest reads if no copy needed

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
29.09.2020 15:38, Andrey Shinkevich wrote: If the flag BDRV_REQ_PREFETCH was set, pass it further to the COR-driver to skip unneeded reading. It can be taken into account for the COR-algorithms optimization. That check is being made during the block stream job by the moment. Signed-off-by: Andre

Re: [PATCH v10 7/9] stream: skip filters when writing backing file name to QCOW2 header

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
29.09.2020 15:38, Andrey Shinkevich wrote: Avoid writing a filter JSON-name to QCOW2 image when the backing file is changed after the block stream job. Signed-off-by: Andrey Shinkevich --- block/stream.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/strea

Re: [PATCH v10 8/9] block: remove unused backing-file name parameter

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
29.09.2020 15:38, Andrey Shinkevich wrote: The block stream QMP parameter backing-file is in use no more. It designates a backing file name to set in QCOW2 image header after the block stream job finished. The base file name is used instead. Signed-off-by: Andrey Shinkevich We can't just remo

Re: [PATCH v2 1/5] qemu-nbd: Honor SIGINT and SIGHUP

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
30.09.2020 15:11, Eric Blake wrote: Honoring just SIGTERM on Linux is too weak; we also want to handle other common signals, and do so even on BSD. Why? Because at least 'qemu-nbd -B bitmap' needs a chance to clean up the in-use bit on bitmaps when the server is shut down via a signal. Probab

Re: [PATCH v2 2/5] nbd/server: Reject embedded NUL in NBD strings

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
30.09.2020 15:11, Eric Blake wrote: The NBD spec is clear that any string sent from the client must not contain embedded NUL characters. If the client passes "a\0", we should reject that option request rather than act on "a". Testing this is not possible with a compliant client, but I was able

Re: [PATCH 11/20] python/qemu: Add mypy type annotations

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > These should all be purely annotations with no changes in behavior at > all. You need to be in the python folder, but you should be able to > confirm that these annotations are correct (or at least self-consistent) > by running `mypy --strict qemu

Re: [PATCH 13/20] python/qemu/console_socket.py: fix typing of settimeout

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > The types and names of the parameters must match the socket.socket interface. > > Signed-off-by: John Snow Reviewed-by: Kevin Wolf

Re: [PATCH 12/20] python/qemu/console_socket.py: Correct type of recv()

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > The type and parameter names of recv() should match socket.socket(). Should this be socket.socket without parentheses (the class name)? socket.socket() is the constructor and it takes very different parameters. > OK, easy enough, but in the case

Re: [PATCH 15/20] python/qemu/console_socket.py: Add type hint annotations

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > Finish the typing of console_socket.py with annotations and no code > changes. > > Signed-off-by: John Snow Reviewed-by: Kevin Wolf

Re: [PATCH 14/20] python/qemu/console_socket.py: Clarify type of drain_thread

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > Mypy needs just a little help to guess the type here. > > Signed-off-by: John Snow Reviewed-by: Kevin Wolf

Re: [PATCH 16/20] python/console_socket: avoid encoding to/from string

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > We can work directly in bytes instead of translating back and forth to > string, which removes the question of which encodings to use. > > Signed-off-by: John Snow Reviewed-by: Kevin Wolf

Re: [PATCH 17/20] python/qemu/qmp.py: Preserve error context on re-raise

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > Use the "from ..." phrasing when re-raising errors to preserve their > initial context, to help aid debugging when things go wrong. > > This also silences a pylint 2.6.0+ error. > > Signed-off-by: John Snow I don't really understand what this

Re: [PATCH 18/20] python/qemu/qmp.py: re-raise OSError when encountered

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > Nested if conditions don't change when the exception block fires; we > need to explicitly re-raise the error if we didn't intend to capture and > suppress it. > > Signed-off-by: John Snow > --- > python/qemu/qmp.py | 6 +++--- > 1 file changed,

Re: [PATCH 20/20] python: add mypy config

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > Formalize the options used for checking the python library. You can run > mypy from the directory that mypy.ini is in by typing `mypy qemu/`. > > Signed-off-by: John Snow > --- > python/mypy.ini | 4 > 1 file changed, 4 insertions(+) > cr

Re: [PATCH v2 3/5] nbd: Simplify meta-context parsing

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
30.09.2020 15:11, Eric Blake wrote: We had a premature optimization of trying to read as little from the wire as possible while handling NBD_OPT_SET_META_CONTEXT in phases. But in reality, we HAVE to read the entire string from the client before we can get to the next command, and it is easier to

[PATCH] qcow2: Document and enforce the QCowL2Meta invariants

2020-10-07 Thread Alberto Garcia
The QCowL2Meta structure is used to store information about a part of a write request that touches clusters that need changes in their L2 entries. This happens with newly-allocated clusters or subclusters. This structure has changed a bit since it was first created and its current documentation is

Re: [PATCH] tests/docker: Add genisoimage to the docker file

2020-10-07 Thread Alex Bennée
Thomas Huth writes: > genisoimage is needed for running the tests/qtest/cdrom-test qtest. Queued to testing/next, thanks. > > Signed-off-by: Thomas Huth > --- > tests/docker/dockerfiles/centos8.docker | 1 + > tests/docker/dockerfiles/debian-amd64.docker | 1 + > tests/docker/dockerfil

[PATCH v8 03/17] qtest: remove qtest_qmp_receive_success

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky The purpose of qtest_qmp_receive_success was mostly to process events that arrived between the issueing of a command and the "return" line from QMP. This is now handled by the buffering of events that libqtest performs automatically. Signed-off-by: Maxim Levitsky [Extracte

[PATCH v8 05/17] qtest: switch users back to qtest_qmp_receive

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky Let test use the new functionality for buffering events. The only remaining users of qtest_qmp_receive_dict are tests that fuzz the QMP protocol. Tested with 'make check-qtest'. Signed-off-by: Maxim Levitsky Message-Id: <20201006123904.610658-4-mlevi...@redhat.com> Signed-

[PATCH v8 00/17] Fix scsi devices plug/unplug races w.r.t virtio-scsi iothread

2020-10-07 Thread Paolo Bonzini
Hopefully the final version of the patches, fixing the remaining testsuite issues. Kevin or Max, please take a look at patches 6 and 7 as they affect qemu-iotests. Paolo Maxim Levitsky (11): qtest: rename qtest_qmp_receive to qtest_qmp_receive_dict qtest: Reintroduce qtest_qmp_receive qtes

[PATCH v8 01/17] qtest: rename qtest_qmp_receive to qtest_qmp_receive_dict

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky In the next patch a new version of qtest_qmp_receive will be reintroduced that will buffer received qmp events for later consumption in qtest_qmp_eventwait_ref No functional change intended. Suggested-by: Paolo Bonzini Signed-off-by: Maxim Levitsky Signed-off-by: Paolo Bo

[PATCH v8 06/17] qtest: check that drives are really appearing and disappearing

2020-10-07 Thread Paolo Bonzini
Do not just trust the HMP commands to create and delete the drive, use query-block to check that this is actually the case. Signed-off-by: Paolo Bonzini --- tests/qtest/drive_del-test.c | 32 +++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/qte

[PATCH v8 08/17] qdev: add "check if address free" callback for buses

2020-10-07 Thread Paolo Bonzini
Check if an address is free on the bus before plugging in the device. This makes it possible to do the check without any side effects, and to detect the problem early without having to do it in the realize callback. Signed-off-by: Paolo Bonzini Message-Id: <20201006123904.610658-5-mlevi...@redha

[PATCH v8 07/17] qemu-iotests, qtest: rewrite test 067 as a qtest

2020-10-07 Thread Paolo Bonzini
Test 067 from qemu-iotests is executing QMP commands to hotplug and hot-unplug disks, devices and blockdevs. Because the power of the text-based test harness is limited, it is actually limiting the checks that it does, for example by skipping DEVICE_DELETED events. tests/qtest already has a simil

[PATCH v8 15/17] scsi/scsi_bus: Add scsi_device_get

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky Add scsi_device_get which finds the scsi device and takes a reference to it. Suggested-by: Stefan Hajnoczi Signed-off-by: Maxim Levitsky Message-Id: <20200913160259.32145-8-mlevi...@redhat.com> Signed-off-by: Paolo Bonzini Message-Id: <20201006123904.610658-12-mlevi...@re

[PATCH v8 09/17] scsi/scsi_bus: switch search direction in scsi_device_find

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky This change will allow us to convert the bus children list to RCU, while not changing the logic of this function Signed-off-by: Maxim Levitsky Reviewed-by: Stefan Hajnoczi Message-Id: <20200913160259.32145-2-mlevi...@redhat.com> Signed-off-by: Paolo Bonzini --- hw/scsi/s

[PATCH v8 13/17] device-core: use atomic_set on .realized property

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky Some code might race with placement of new devices on a bus. We currently first place a (unrealized) device on the bus and then realize it. As a workaround, users that scan the child device list, can check the realized property to see if it is safe to access such a device. U

[PATCH v8 14/17] scsi/scsi-bus: scsi_device_find: don't return unrealized devices

2020-10-07 Thread Paolo Bonzini
The device core first places a device on the bus and then realizes it. Make scsi_device_find avoid returing such devices to avoid races in drivers that use an iothread (currently virtio-scsi) Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1812399 Suggested-by: Paolo Bonzini Signed-off-by:

[PATCH v8 11/17] device-core: use RCU for list of children of a bus

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky This fixes the race between device emulation code that tries to find a child device to dispatch the request to (e.g a scsi disk), and hotplug of a new device to that bus. Note that this doesn't convert all the readers of the list but only these that might go over that list w

[PATCH v8 04/17] device-plug-test: use qtest_qmp to send the device_del command

2020-10-07 Thread Paolo Bonzini
Simplify the code now that events are buffered. There is no need anymore to separate sending the command and retrieving the response. Signed-off-by: Paolo Bonzini --- tests/qtest/device-plug-test.c | 32 +--- 1 file changed, 9 insertions(+), 23 deletions(-) diff --g

[PATCH v8 10/17] device_core: use drain_call_rcu in in qmp_device_add

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky Soon, a device removal might only happen on RCU callback execution. This is okay for device-del which provides a DEVICE_DELETED event, but not for the failure case of device-add. To avoid changing monitor semantics, just drain all pending RCU callbacks on error. Signed-off-

[PATCH v8 12/17] scsi: switch to bus->check_address

2020-10-07 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini Message-Id: <20201006123904.610658-6-mlevi...@redhat.com> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-bus.c | 122 - 1 file changed, 75 insertions(+), 47 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c

[PATCH v8 02/17] qtest: Reintroduce qtest_qmp_receive

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky The new qtest_qmp_receive buffers all the received qmp events, allowing qtest_qmp_eventwait_ref to return them. This is intended to solve the race in regard to ordering of qmp events vs qmp responses, as soon as the callers start using the new interface. In addition to that

[PATCH v8 16/17] virtio-scsi: use scsi_device_get

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky This will help us to avoid the scsi device disappearing after we took a reference to it. It doesn't by itself forbid case when we try to access an unrealized device Suggested-by: Stefan Hajnoczi Signed-off-by: Maxim Levitsky Reviewed-by: Stefan Hajnoczi Message-Id: <2020

[PATCH v8 17/17] scsi/scsi_bus: fix races in REPORT LUNS

2020-10-07 Thread Paolo Bonzini
From: Maxim Levitsky Currently scsi_target_emulate_report_luns iterates over the child device list twice, and there is no guarantee that this list is the same in both iterations. The reason for iterating twice is that the first iteration calculates how much memory to allocate. However if we use

Re: [PATCH v8 00/17] Fix scsi devices plug/unplug races w.r.t virtio-scsi iothread

2020-10-07 Thread no-reply
Patchew URL: https://patchew.org/QEMU/20201007115700.707938-1-pbonz...@redhat.com/ Hi, This series seems to have some coding style problems. See output below for more information: Type: series Message-id: 20201007115700.707938-1-pbonz...@redhat.com Subject: [PATCH v8 00/17] Fix scsi devices p

Re: [PATCH 19/20] python/qemu/qmp.py: Straighten out exception hierarchy

2020-10-07 Thread Kevin Wolf
Am 07.10.2020 um 01:58 hat John Snow geschrieben: > Be a little more rigorous about which exception we use, and when. > Primarily, this makes QMPCapabilitiesError an extension of > QMPprotocolError. > > The family of errors: > > QMPError (generic base) > QMPConnectError (For connection issues)

Re: [PATCH v2 4/5] nbd: Add new qemu:allocation-depth metacontext

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
30.09.2020 15:11, Eric Blake wrote: 'qemu-img map' provides a way to determine which extents of an image come from the top layer vs. inherited from a backing chain. This is useful information worth exposing over NBD. There is a proposal to add a QMP command block-dirty-bitmap-populate which can

Re: [PATCH v5 0/7] vhost-user-blk: fix the migration issue and enhance qtests

2020-10-07 Thread Dima Stepanov
On Tue, Sep 29, 2020 at 12:48:38PM +0300, Dima Stepanov wrote: > On Tue, Sep 29, 2020 at 03:13:09AM -0400, Michael S. Tsirkin wrote: > > On Sun, Sep 27, 2020 at 09:48:28AM +0300, Dima Stepanov wrote: > > > On Thu, Sep 24, 2020 at 07:26:14AM -0400, Michael S. Tsirkin wrote: > > > > On Fri, Sep 11, 2

Re: [PATCH v2 5/5] nbd: Add 'qemu-nbd -A' to expose allocation depth

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
30.09.2020 15:11, Eric Blake wrote: Allow the server to expose an additional metacontext to be requested by savvy clients. qemu-nbd adds a new option -A to expose the qemu:allocation-depth metacontext through NBD_CMD_BLOCK_STATUS; this can also be set via QMP when using block-export-add. qemu a

Re: [PATCH] qcow2: Document and enforce the QCowL2Meta invariants

2020-10-07 Thread Eric Blake
On 10/7/20 6:52 AM, Alberto Garcia wrote: > The QCowL2Meta structure is used to store information about a part of > a write request that touches clusters that need changes in their L2 > entries. This happens with newly-allocated clusters or subclusters. > > This structure has changed a bit since i

Re: [PATCH] qcow2: Document and enforce the QCowL2Meta invariants

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
07.10.2020 14:52, Alberto Garcia wrote: The QCowL2Meta structure is used to store information about a part of a write request that touches clusters that need changes in their L2 entries. This happens with newly-allocated clusters or subclusters. This structure has changed a bit since it was firs

Re: [PATCH] qcow2: Document and enforce the QCowL2Meta invariants

2020-10-07 Thread Alberto Garcia
On Wed 07 Oct 2020 04:42:37 PM CEST, Vladimir Sementsov-Ogievskiy wrote: >> /** >> - * The COW Region between the start of the first allocated cluster and >> the >> - * area the guest actually writes to. >> + * The COW Region immediately before the area the guest actually >> +

Re: [PATCH] qcow2: Document and enforce the QCowL2Meta invariants

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
07.10.2020 18:38, Alberto Garcia wrote: On Wed 07 Oct 2020 04:42:37 PM CEST, Vladimir Sementsov-Ogievskiy wrote: /** - * The COW Region between the start of the first allocated cluster and the - * area the guest actually writes to. + * The COW Region immediately before the are

[PATCH v1 03/22] hw/ide: restore replay support of IDE

2020-10-07 Thread Alex Bennée
A recent change to weak reset handling broke replay due to the use of aio_bh_schedule_oneshot instead of the replay aware replay_bh_schedule_oneshot_event. Fixes: 55adb3c456 ("ide: cancel pending callbacks on SRST") Suggested-by: Pavel Dovgalyuk Signed-off-by: Alex Bennée --- hw/ide/core.c | 4

Re: [PATCH] qcow2: Document and enforce the QCowL2Meta invariants

2020-10-07 Thread Alberto Garcia
On Wed 07 Oct 2020 05:47:32 PM CEST, Vladimir Sementsov-Ogievskiy wrote: > 07.10.2020 18:38, Alberto Garcia wrote: >> On Wed 07 Oct 2020 04:42:37 PM CEST, Vladimir Sementsov-Ogievskiy wrote: /** - * The COW Region between the start of the first allocated cluster and the >

[PATCH v2] qcow2: Document and enforce the QCowL2Meta invariants

2020-10-07 Thread Alberto Garcia
The QCowL2Meta structure is used to store information about a part of a write request that touches clusters that need changes in their L2 entries. This happens with newly-allocated clusters or subclusters. This structure has changed a bit since it was first created and its current documentation is

[PATCH v3 1/4] keyval: Parse help options

2020-10-07 Thread Kevin Wolf
This adds a special meaning for 'help' and '?' as options to the keyval parser. Instead of being an error (because of a missing value) or a value for an implied key, they now request help, which is a new boolean ouput of the parser in addition to the QDict. A new parameter 'p_help' is added to key

[PATCH v3 4/4] qemu-storage-daemon: Remove QemuOpts from --object parser

2020-10-07 Thread Kevin Wolf
The command line parser for --object parses the input twice: Once into QemuOpts just for detecting help options, and then again into a QDict using the keyval parser for actually creating the object. Now that the keyval parser can also detect help options, we can simplify this and remove the QemuOp

Re: [PATCH v1 03/22] hw/ide: restore replay support of IDE

2020-10-07 Thread John Snow
On 10/7/20 12:00 PM, Alex Bennée wrote: A recent change to weak reset handling broke replay due to the use of aio_bh_schedule_oneshot instead of the replay aware replay_bh_schedule_oneshot_event. Fixes: 55adb3c456 ("ide: cancel pending callbacks on SRST") Suggested-by: Pavel Dovgalyuk Signed-of

[PATCH v3 2/4] qom: Factor out helpers from user_creatable_print_help()

2020-10-07 Thread Kevin Wolf
This creates separate helper functions for printing a list of user creatable object types and for printing a list of properties of a given type. This will allow using these parts without having a QemuOpts. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster --- qom

[PATCH v3 0/4] qemu-storage-daemon: Remove QemuOpts from --object parser

2020-10-07 Thread Kevin Wolf
This replaces the QemuOpts-based help code for --object in the storage daemon with code based on the keyval parser. v3: - Always parse help options, no matter if the caller implements help or not. If it doesn't, return an error. [Markus] - Document changes to the keyval parser grammar [Markus] -

[PATCH v3 3/4] qom: Add user_creatable_print_help_from_qdict()

2020-10-07 Thread Kevin Wolf
This adds a function that, given a QDict of non-help options, prints help for user creatable objects. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster --- include/qom/object_interfaces.h | 21 ++--- qom/object_interfaces.c | 9 +

Re: [PATCH v10 9/9] block: apply COR-filter to block-stream jobs

2020-10-07 Thread Andrey Shinkevich
On 29.09.2020 15:38, Andrey Shinkevich wrote: This patch completes the series with the COR-filter insertion for block-stream operations. Adding the filter makes it possible for copied regions to be discarded in backing files during the block-stream job, what will reduce the disk overuse. The CO

Re: [PATCH v3 1/4] keyval: Parse help options

2020-10-07 Thread Eric Blake
On 10/7/20 11:49 AM, Kevin Wolf wrote: > This adds a special meaning for 'help' and '?' as options to the keyval > parser. Instead of being an error (because of a missing value) or a > value for an implied key, they now request help, which is a new boolean > ouput of the parser in addition to the Q

Re: [PATCH v10 9/9] block: apply COR-filter to block-stream jobs

2020-10-07 Thread Andrey Shinkevich
On 07.10.2020 20:27, Andrey Shinkevich wrote: On 29.09.2020 15:38, Andrey Shinkevich wrote: This patch completes the series with the COR-filter insertion for block-stream operations. Adding the filter makes it possible for copied regions to be discarded in backing files during the block-strea

Re: [PATCH v1 03/22] hw/ide: restore replay support of IDE

2020-10-07 Thread Philippe Mathieu-Daudé
On 10/7/20 6:00 PM, Alex Bennée wrote: > A recent change to weak reset handling broke replay due to the use of > aio_bh_schedule_oneshot instead of the replay aware > replay_bh_schedule_oneshot_event. > > Fixes: 55adb3c456 ("ide: cancel pending callbacks on SRST") > Suggested-by: Pavel Dovgalyuk

Re: [PATCH 03/20] python/machine.py: reorder __init__

2020-10-07 Thread John Snow
On 10/7/20 5:43 AM, Kevin Wolf wrote: Am 07.10.2020 um 01:58 hat John Snow geschrieben: Put the init arg handling all at the top, and mostly in order (deviating when one is dependent on another), and put what is effectively runtime state declaration at the bottom. Signed-off-by: John Snow ---

Re: [PATCH 07/20] python/machine.py: Add _qmp access shim

2020-10-07 Thread John Snow
On 10/7/20 5:53 AM, Kevin Wolf wrote: Am 07.10.2020 um 01:58 hat John Snow geschrieben: Like many other Optional[] types, it's not always a given that this object will be set. Wrap it in a type-shim that raises a meaningful error and will always return a concrete type. Signed-off-by: John Snow

Re: [PATCH 08/20] python/machine.py: fix _popen access

2020-10-07 Thread John Snow
On 10/7/20 6:07 AM, Kevin Wolf wrote: Am 07.10.2020 um 01:58 hat John Snow geschrieben: As always, Optional[T] causes problems with unchecked access. Add a helper that asserts the pipe is present before we attempt to talk with it. Signed-off-by: John Snow First a question about the preexisti

Re: [PATCH 11/20] python/qemu: Add mypy type annotations

2020-10-07 Thread John Snow
On 10/7/20 6:46 AM, Kevin Wolf wrote: Am 07.10.2020 um 01:58 hat John Snow geschrieben: These should all be purely annotations with no changes in behavior at all. You need to be in the python folder, but you should be able to confirm that these annotations are correct (or at least self-consisten

Re: [PATCH 12/20] python/qemu/console_socket.py: Correct type of recv()

2020-10-07 Thread John Snow
On 10/7/20 6:59 AM, Kevin Wolf wrote: Am 07.10.2020 um 01:58 hat John Snow geschrieben: The type and parameter names of recv() should match socket.socket(). Should this be socket.socket without parentheses (the class name)? socket.socket() is the constructor and it takes very different paramet

Re: [PATCH v10 6/9] copy-on-read: skip non-guest reads if no copy needed

2020-10-07 Thread Andrey Shinkevich
On 07.10.2020 13:06, Vladimir Sementsov-Ogievskiy wrote: 29.09.2020 15:38, Andrey Shinkevich wrote: If the flag BDRV_REQ_PREFETCH was set, pass it further to the COR-driver to skip unneeded reading. It can be taken into account for the COR-algorithms optimization. That check is being made duri

Re: [PATCH 17/20] python/qemu/qmp.py: Preserve error context on re-raise

2020-10-07 Thread John Snow
On 10/7/20 7:21 AM, Kevin Wolf wrote: Am 07.10.2020 um 01:58 hat John Snow geschrieben: Use the "from ..." phrasing when re-raising errors to preserve their initial context, to help aid debugging when things go wrong. This also silences a pylint 2.6.0+ error. Signed-off-by: John Snow I don'

Re: [PATCH 20/20] python: add mypy config

2020-10-07 Thread John Snow
On 10/7/20 7:35 AM, Kevin Wolf wrote: Am 07.10.2020 um 01:58 hat John Snow geschrieben: Formalize the options used for checking the python library. You can run mypy from the directory that mypy.ini is in by typing `mypy qemu/`. Signed-off-by: John Snow --- python/mypy.ini | 4 1 file c

Re: [PATCH 18/20] python/qemu/qmp.py: re-raise OSError when encountered

2020-10-07 Thread John Snow
On 10/7/20 7:30 AM, Kevin Wolf wrote: Am 07.10.2020 um 01:58 hat John Snow geschrieben: Nested if conditions don't change when the exception block fires; we need to explicitly re-raise the error if we didn't intend to capture and suppress it. Signed-off-by: John Snow --- python/qemu/qmp.py |

Re: [PATCH v10 6/9] copy-on-read: skip non-guest reads if no copy needed

2020-10-07 Thread Vladimir Sementsov-Ogievskiy
07.10.2020 22:01, Andrey Shinkevich wrote: On 07.10.2020 13:06, Vladimir Sementsov-Ogievskiy wrote: 29.09.2020 15:38, Andrey Shinkevich wrote: If the flag BDRV_REQ_PREFETCH was set, pass it further to the COR-driver to skip unneeded reading. It can be taken into account for the COR-algorithms

Re: [PATCH v10 8/9] block: remove unused backing-file name parameter

2020-10-07 Thread Andrey Shinkevich
On 07.10.2020 13:21, Vladimir Sementsov-Ogievskiy wrote: 29.09.2020 15:38, Andrey Shinkevich wrote: The block stream QMP parameter backing-file is in use no more. It designates a backing file name to set in QCOW2 image header after the block stream job finished. The base file name is used inst

Re: [PATCH v2 1/5] qemu-nbd: Honor SIGINT and SIGHUP

2020-10-07 Thread Eric Blake
On 10/7/20 5:32 AM, Vladimir Sementsov-Ogievskiy wrote: > 30.09.2020 15:11, Eric Blake wrote: >> Honoring just SIGTERM on Linux is too weak; we also want to handle >> other common signals, and do so even on BSD.  Why?  Because at least >> 'qemu-nbd -B bitmap' needs a chance to clean up the in-use b

Re: [PATCH v2 3/5] nbd: Simplify meta-context parsing

2020-10-07 Thread Eric Blake
On 10/7/20 6:51 AM, Vladimir Sementsov-Ogievskiy wrote: > 30.09.2020 15:11, Eric Blake wrote: >> We had a premature optimization of trying to read as little from the >> wire as possible while handling NBD_OPT_SET_META_CONTEXT in phases. >> But in reality, we HAVE to read the entire string from the

Re: [PATCH v2 4/5] nbd: Add new qemu:allocation-depth metacontext

2020-10-07 Thread Eric Blake
On 10/7/20 8:40 AM, Vladimir Sementsov-Ogievskiy wrote: > 30.09.2020 15:11, Eric Blake wrote: >> 'qemu-img map' provides a way to determine which extents of an image >> come from the top layer vs. inherited from a backing chain.  This is >> useful information worth exposing over NBD.  There is a pr