[PATCH v7 29/33] iotests.py: hmp_qemu_io: support qdev

Vladimir Sementsov-Ogievskiy posted 33 patches 4 years, 6 months ago
There is a newer version of this series
[PATCH v7 29/33] iotests.py: hmp_qemu_io: support qdev
Posted by Vladimir Sementsov-Ogievskiy 4 years, 6 months ago
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/iotests.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 025e288ddd..9d0031a0e8 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -655,9 +655,10 @@ def resume_drive(self, drive: str) -> None:
         self.hmp(f'qemu-io {drive} "remove_break bp_{drive}"')
 
     def hmp_qemu_io(self, drive: str, cmd: str,
-                    use_log: bool = False) -> QMPMessage:
+                    use_log: bool = False, qdev: bool = False) -> QMPMessage:
         """Write to a given drive using an HMP command"""
-        return self.hmp(f'qemu-io {drive} "{cmd}"', use_log=use_log)
+        d = '-d ' if qdev else ''
+        return self.hmp(f'qemu-io {d}{drive} "{cmd}"', use_log=use_log)
 
     def flatten_qmp_object(self, obj, output=None, basestr=''):
         if output is None:
-- 
2.29.2


Re: [PATCH v7 29/33] iotests.py: hmp_qemu_io: support qdev
Posted by John Snow 4 years, 6 months ago
On Wed, Aug 4, 2021 at 5:39 AM Vladimir Sementsov-Ogievskiy <
vsementsov@virtuozzo.com> wrote:

> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Reviewed-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/iotests.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 025e288ddd..9d0031a0e8 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -655,9 +655,10 @@ def resume_drive(self, drive: str) -> None:
>          self.hmp(f'qemu-io {drive} "remove_break bp_{drive}"')
>
>      def hmp_qemu_io(self, drive: str, cmd: str,
> -                    use_log: bool = False) -> QMPMessage:
> +                    use_log: bool = False, qdev: bool = False) ->
> QMPMessage:
>          """Write to a given drive using an HMP command"""
> -        return self.hmp(f'qemu-io {drive} "{cmd}"', use_log=use_log)
> +        d = '-d ' if qdev else ''
> +        return self.hmp(f'qemu-io {d}{drive} "{cmd}"', use_log=use_log)
>
>      def flatten_qmp_object(self, obj, output=None, basestr=''):
>          if output is None:
> --
> 2.29.2
>
>
Guess that's really the only flag that this HMP command supports. I was
gonna suggest abstracting to {args} ... but, uh, that's the only one, so...
sure!

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