qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 14/14] python: use vm.cmd() instead of vm.qmp() where appr


From: Eric Blake
Subject: Re: [PATCH v6 14/14] python: use vm.cmd() instead of vm.qmp() where appropriate
Date: Thu, 5 Oct 2023 15:29:22 -0500
User-agent: NeoMutt/20230517

On Thu, Oct 05, 2023 at 04:55:50PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> In many cases we just want an effect of qmp command and want to raise on
> failure. Use vm.cmd() method which does exactly this.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
>  tests/avocado/vnc.py                          |  16 +-
>  tests/qemu-iotests/030                        | 168 +++---
>  tests/qemu-iotests/040                        | 172 +++----
>  tests/qemu-iotests/041                        | 483 ++++++++----------
>  tests/qemu-iotests/045                        |  15 +-
>  tests/qemu-iotests/055                        |  62 +--
>  tests/qemu-iotests/056                        |  77 ++-
>  tests/qemu-iotests/093                        |  42 +-
>  tests/qemu-iotests/118                        | 225 ++++----
>  tests/qemu-iotests/124                        | 102 ++--
>  tests/qemu-iotests/129                        |  14 +-
>  tests/qemu-iotests/132                        |   5 +-
>  tests/qemu-iotests/139                        |  45 +-
>  tests/qemu-iotests/147                        |  31 +-
>  tests/qemu-iotests/151                        |  57 +--
>  tests/qemu-iotests/152                        |  10 +-
>  tests/qemu-iotests/155                        |  55 +-
>  tests/qemu-iotests/165                        |   8 +-
>  tests/qemu-iotests/196                        |   3 +-
>  tests/qemu-iotests/205                        |   6 +-
>  tests/qemu-iotests/218                        | 105 ++--
>  tests/qemu-iotests/245                        | 245 ++++-----
>  tests/qemu-iotests/264                        |  31 +-
>  tests/qemu-iotests/281                        |  21 +-
>  tests/qemu-iotests/295                        |  15 +-
>  tests/qemu-iotests/296                        |  15 +-
>  tests/qemu-iotests/298                        |  13 +-
>  tests/qemu-iotests/300                        |  54 +-
>  tests/qemu-iotests/iotests.py                 |   9 +-
>  .../tests/export-incoming-iothread            |   6 +-
>  .../qemu-iotests/tests/graph-changes-while-io |   6 +-
>  tests/qemu-iotests/tests/image-fleecing       |   3 +-
>  .../tests/migrate-bitmaps-postcopy-test       |  31 +-
>  tests/qemu-iotests/tests/migrate-bitmaps-test |  47 +-
>  .../qemu-iotests/tests/migrate-during-backup  |  41 +-
>  .../qemu-iotests/tests/migration-permissions  |   9 +-
>  .../tests/mirror-ready-cancel-error           |  74 ++-
>  tests/qemu-iotests/tests/mirror-top-perms     |  16 +-
>  tests/qemu-iotests/tests/nbd-multiconn        |  12 +-
>  tests/qemu-iotests/tests/reopen-file          |   3 +-
>  .../qemu-iotests/tests/stream-error-on-reset  |   6 +-
>  41 files changed, 951 insertions(+), 1407 deletions(-)

Big but mechanical.  It would be worth amending the commit message to
describe how you found all these spots (in case someone backporting
this patch has to redo the work over a different subset of files based
on what has changed since the two trees diverged).

> 
> diff --git a/tests/avocado/vnc.py b/tests/avocado/vnc.py
> index aeeefc70be..862c8996a8 100644
> --- a/tests/avocado/vnc.py
> +++ b/tests/avocado/vnc.py
> @@ -88,9 +88,8 @@ def test_change_password(self):
>          self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password=on')
>          self.vm.launch()
>          self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
> -        set_password_response = self.vm.qmp('change-vnc-password',
> -                                            password='new_password')
> -        self.assertEqual(set_password_response['return'], {})
> +        self.vm.cmd('change-vnc-password',
> +                    password='new_password')

Indeed a nicer idiom, where you are able to use it (whether by
self.assertEqual or by self.assert_qmp).

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]