All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hanna Reitz <hreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Hanna Reitz <hreitz@redhat.com>,
	qemu-devel@nongnu.org
Subject: [PULL 44/56] python/qemu/machine: QEMUMachine: improve qmp() method
Date: Wed,  1 Sep 2021 17:16:07 +0200	[thread overview]
Message-ID: <20210901151619.689075-45-hreitz@redhat.com> (raw)
In-Reply-To: <20210901151619.689075-1-hreitz@redhat.com>

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

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>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20210824083856.17408-25-vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
 python/qemu/machine/machine.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index 3fde73cf10..6ec18570d9 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -578,11 +578,21 @@ def _qmp_args(cls, conv_keys: bool,
         return args
 
     def qmp(self, cmd: str,
-            conv_keys: bool = True,
+            args_dict: Optional[Dict[str, object]] = None,
+            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)
 
-- 
2.31.1



  parent reply	other threads:[~2021-09-01 15:52 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 15:15 [PULL 00/56] Block patches Hanna Reitz
2021-09-01 15:15 ` [PULL 01/56] python: qemu: add timer parameter for qmp.accept socket Hanna Reitz
2021-09-01 15:15 ` [PULL 02/56] python: Reduce strictness of pylint's duplicate-code check Hanna Reitz
2021-09-01 15:15 ` [PULL 03/56] python: qemu: pass the wrapper field from QEMUQtestmachine to QEMUMachine Hanna Reitz
2021-09-01 15:15 ` [PULL 04/56] docs/devel/testing: add debug section to the QEMU iotests chapter Hanna Reitz
2021-09-01 15:15 ` [PULL 05/56] qemu-iotests: add option to attach gdbserver Hanna Reitz
2021-09-01 15:15 ` [PULL 06/56] qemu-iotests: delay QMP socket timers Hanna Reitz
2021-09-01 15:15 ` [PULL 07/56] qemu_iotests: insert gdbserver command line as wrapper for qemu binary Hanna Reitz
2021-09-01 15:15 ` [PULL 08/56] qemu-iotests: add gdbserver option to script tests too Hanna Reitz
2021-09-01 15:15 ` [PULL 09/56] docs/devel/testing: add -gdb option to the debugging section of QEMU iotests Hanna Reitz
2021-09-01 15:15 ` [PULL 10/56] qemu-iotests: extend the check script to prepare supporting valgrind for python tests Hanna Reitz
2021-09-01 15:15 ` [PULL 11/56] qemu-iotests: extend QMP socket timeout when using valgrind Hanna Reitz
2021-09-01 15:15 ` [PULL 12/56] qemu-iotests: allow valgrind to read/delete the generated log file Hanna Reitz
2021-09-01 15:15 ` [PULL 13/56] qemu-iotests: insert valgrind command line as wrapper for qemu binary Hanna Reitz
2021-09-01 15:15 ` [PULL 14/56] docs/devel/testing: add -valgrind option to the debug section of QEMU iotests Hanna Reitz
2021-09-01 15:15 ` [PULL 15/56] qemu-iotests: add option to show qemu binary logs on stdout Hanna Reitz
2021-09-01 15:15 ` [PULL 16/56] docs/devel/testing: add -p option to the debug section of QEMU iotests Hanna Reitz
2021-09-01 15:15 ` [PULL 17/56] block/monitor: Consolidate hmp_handle_error calls to reduce redundant code Hanna Reitz
2021-09-01 15:15 ` [PULL 18/56] raw-format: drop WRITE and RESIZE child perms when possible Hanna Reitz
2021-09-01 15:15 ` [PULL 19/56] iotests: use with-statement for open() calls Hanna Reitz
2021-09-01 15:15 ` [PULL 20/56] iotests: use subprocess.DEVNULL instead of open("/dev/null") Hanna Reitz
2021-09-01 15:15 ` [PULL 21/56] block: introduce bdrv_replace_child_bs() Hanna Reitz
2021-09-01 15:15 ` [PULL 22/56] block: introduce blk_replace_bs Hanna Reitz
2021-09-01 15:15 ` [PULL 23/56] qdev-properties: PropertyInfo: add realized_set_allowed field Hanna Reitz
2021-09-01 15:15 ` [PULL 24/56] qdev: allow setting drive property for realized device Hanna Reitz
2021-09-01 15:15 ` [PULL 25/56] block: rename backup-top to copy-before-write Hanna Reitz
2021-09-01 15:15 ` [PULL 26/56] block-copy: move detecting fleecing scheme to block-copy Hanna Reitz
2021-09-01 15:15 ` [PULL 27/56] block/block-copy: introduce block_copy_set_copy_opts() Hanna Reitz
2021-09-01 15:15 ` [PULL 28/56] block/backup: set copy_range and compress after filter insertion Hanna Reitz
2021-09-01 15:15 ` [PULL 29/56] block/backup: move cluster size calculation to block-copy Hanna Reitz
2021-09-01 15:15 ` [PULL 30/56] block/copy-before-write: relax permission requirements when no parents Hanna Reitz
2021-09-01 15:15 ` [PULL 31/56] block/copy-before-write: drop extra bdrv_unref on failure path Hanna Reitz
2021-09-01 15:15 ` [PULL 32/56] block/copy-before-write: use file child instead of backing Hanna Reitz
2021-09-01 15:15 ` [PULL 33/56] block/copy-before-write: bdrv_cbw_append(): replace child at last Hanna Reitz
2021-09-01 15:15 ` [PULL 34/56] block/copy-before-write: introduce cbw_init() Hanna Reitz
2021-09-01 15:15 ` [PULL 35/56] block/copy-before-write: cbw_init(): rename variables Hanna Reitz
2021-09-01 15:15 ` [PULL 36/56] block/copy-before-write: cbw_init(): use file child after attaching Hanna Reitz
2021-09-01 15:16 ` [PULL 37/56] block/copy-before-write: bdrv_cbw_append(): drop unused compress arg Hanna Reitz
2021-09-01 15:16 ` [PULL 38/56] block/copy-before-write: cbw_init(): use options Hanna Reitz
2021-09-01 15:16 ` [PULL 39/56] block/copy-before-write: initialize block-copy bitmap Hanna Reitz
2021-09-01 15:16 ` [PULL 40/56] block/block-copy: make setting progress optional Hanna Reitz
2021-09-01 15:16 ` [PULL 41/56] block/copy-before-write: make public block driver Hanna Reitz
2021-09-20  9:41   ` Kevin Wolf
2021-09-20 10:08     ` Vladimir Sementsov-Ogievskiy
2021-09-01 15:16 ` [PULL 42/56] qapi: publish copy-before-write filter Hanna Reitz
2021-09-01 15:16 ` [PULL 43/56] python/qemu/machine.py: refactor _qemu_args() Hanna Reitz
2021-09-01 15:16 ` Hanna Reitz [this message]
2021-09-01 15:16 ` [PULL 45/56] python:QEMUMachine: template typing for self returning methods Hanna Reitz
2021-09-01 15:16 ` [PULL 46/56] iotests/222: fix pylint and mypy complains Hanna Reitz
2021-09-01 15:16 ` [PULL 47/56] iotests/222: constantly use single quotes for strings Hanna Reitz
2021-09-01 15:16 ` [PULL 48/56] iotests: move 222 to tests/image-fleecing Hanna Reitz
2021-09-01 15:16 ` [PULL 49/56] iotests.py: hmp_qemu_io: support qdev Hanna Reitz
2021-09-01 15:16 ` [PULL 50/56] iotests/image-fleecing: proper source device Hanna Reitz
2021-09-01 15:16 ` [PULL 51/56] iotests/image-fleecing: rename tgt_node Hanna Reitz
2021-09-01 15:16 ` [PULL 52/56] iotests/image-fleecing: prepare for adding new test-case Hanna Reitz
2021-09-01 15:16 ` [PULL 53/56] iotests/image-fleecing: add test-case for copy-before-write filter Hanna Reitz
2021-09-01 15:16 ` [PULL 54/56] block/block-copy: block_copy_state_new(): drop extra arguments Hanna Reitz
2021-09-01 15:16 ` [PULL 55/56] block/export/fuse.c: fix fuse-lseek on uclibc or musl Hanna Reitz
2021-09-01 15:16 ` [PULL 56/56] block/file-win32: add reopen handlers Hanna Reitz
2021-09-02 11:07 ` [PULL 00/56] Block patches Peter Maydell
2021-09-02 11:21   ` Hanna Reitz
2021-09-02 13:56 ` Peter Maydell

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=20210901151619.689075-45-hreitz@redhat.com \
    --to=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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.