All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-block@nongnu.org
Cc: kwolf@redhat.com, berrange@redhat.com, ehabkost@redhat.com,
	qemu-devel@nongnu.org, armbru@redhat.com, crosa@redhat.com,
	pbonzini@redhat.com, mreitz@redhat.com
Subject: Re: [PATCH v4 26/35] python/qemu/machine: QEMUMachine: improve qmp() method
Date: Wed, 2 Jun 2021 19:43:31 -0400	[thread overview]
Message-ID: <8795df19-c215-c6c1-365c-4aa914f45704@redhat.com> (raw)
In-Reply-To: <20210602131108.74979-27-vsementsov@virtuozzo.com>

On 6/2/21 9:10 AM, Vladimir Sementsov-Ogievskiy wrote:
> We often call qmp() with unpacking dict, like qmp('foo', **{...}).
> mypy don't really like it, it thinks that passed unpacked dict is a
> positional argument and complains that it type should be bool (because
> second argument of qmp() is conv_keys: bool).
> 
> Allow passing dict directly, simplifying interface, and giving a way to
> satisfy mypy.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Reviewed-by: Max Reitz <mreitz@redhat.com>
> ---
>   python/qemu/machine.py | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/python/qemu/machine.py b/python/qemu/machine.py
> index ff35f2cd6c..7a14605040 100644
> --- a/python/qemu/machine.py
> +++ b/python/qemu/machine.py
> @@ -549,11 +549,21 @@ def _qmp_args(cls, conv_keys: bool,
>               return args
>   
>       def qmp(self, cmd: str,
> -            conv_keys: bool = True,
> +            args_dict: Optional[Dict[str, Any]] = None,

try using object here, too.

> +            conv_keys: Optional[bool] = None,
>               **args: Any) -> QMPMessage:
>           """
>           Invoke a QMP command and return the response dict
>           """
> +        if args_dict is not None:
> +            assert not args
> +            assert conv_keys is None
> +            args = args_dict
> +            conv_keys = False
> +
> +        if conv_keys is None:
> +            conv_keys = True
> +
>           qmp_args = self._qmp_args(conv_keys, args)
>           return self._qmp.cmd(cmd, args=qmp_args)
>   
> 

With the comment addressed:

Reviewed-by: John Snow <jsnow@redhat.com>

Thanks,
--js



  reply	other threads:[~2021-06-02 23:44 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 13:10 [PATCH v4 00/35] block: publish backup-top filter Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 01/35] block: rename bdrv_replace_child to bdrv_replace_child_tran Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 02/35] block: comment graph-modifying function not updating permissions Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 03/35] block: introduce bdrv_replace_child_bs() Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 04/35] block: introduce blk_replace_bs Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 05/35] qdev-properties: PropertyInfo: add realized_set_allowed field Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 06/35] qdev: allow setting drive property for realized device Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 07/35] block: rename backup-top to copy-before-write Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 08/35] block-copy: always set BDRV_REQ_SERIALISING flag Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 09/35] block/block-copy: introduce block_copy_set_copy_opts() Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 10/35] block/backup: set copy_range and compress after filter insertion Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 11/35] block/backup: move cluster size calculation to block-copy Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 12/35] block/copy-before-write: relax permission requirements when no parents Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 13/35] block/copy-before-write: drop extra bdrv_unref on failure path Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 14/35] block/copy-before-write: use file child instead of backing Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 15/35] block/copy-before-write: bdrv_cbw_append(): replace child at last Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 16/35] block/copy-before-write: introduce cbw_init() Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 17/35] block/copy-before-write: cbw_init(): rename variables Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 18/35] block/copy-before-write: cbw_init(): use file child after attaching Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 19/35] block/copy-before-write: bdrv_cbw_append(): drop unused compress arg Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 20/35] block/copy-before-write: cbw_init(): use options Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 21/35] block/copy-before-write: initialize block-copy bitmap Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 22/35] block/block-copy: make setting progress optional Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 23/35] block/copy-before-write: make public block driver Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 24/35] qapi: publish copy-before-write filter Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 25/35] python/qemu/machine.py: refactor _qemu_args() Vladimir Sementsov-Ogievskiy
2021-06-02 23:38   ` John Snow
2021-06-03 13:26     ` Vladimir Sementsov-Ogievskiy
2021-06-02 13:10 ` [PATCH v4 26/35] python/qemu/machine: QEMUMachine: improve qmp() method Vladimir Sementsov-Ogievskiy
2021-06-02 23:43   ` John Snow [this message]
2021-06-02 13:11 ` [PATCH v4 27/35] iotests.py: VM: add own __enter__ method Vladimir Sementsov-Ogievskiy
2021-06-02 13:11 ` [PATCH v4 28/35] iotests/222: fix pylint and mypy complains Vladimir Sementsov-Ogievskiy
2021-06-02 13:11 ` [PATCH v4 29/35] iotests/222: constantly use single quotes for strings Vladimir Sementsov-Ogievskiy
2021-06-02 13:11 ` [PATCH v4 30/35] iotests: move 222 to tests/image-fleecing Vladimir Sementsov-Ogievskiy
2021-06-02 13:11 ` [PATCH v4 31/35] iotests.py: hmp_qemu_io: support qdev Vladimir Sementsov-Ogievskiy
2021-06-02 13:11 ` [PATCH v4 32/35] iotests/image-fleecing: proper source device Vladimir Sementsov-Ogievskiy
2021-06-02 13:11 ` [PATCH v4 33/35] iotests/image-fleecing: rename tgt_node Vladimir Sementsov-Ogievskiy
2021-06-02 13:11 ` [PATCH v4 34/35] iotests/image-fleecing: prepare for adding new test-case Vladimir Sementsov-Ogievskiy
2021-06-02 13:11 ` [PATCH v4 35/35] iotests/image-fleecing: add test-case for copy-before-write filter Vladimir Sementsov-Ogievskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8795df19-c215-c6c1-365c-4aa914f45704@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.