[RFC 0/2] introduce QEMUMachind.cmd()

Vladimir Sementsov-Ogievskiy posted 2 patches 2 years, 1 month ago
Failed in applying to current master (apply log)
There is a newer version of this series
python/qemu/machine/machine.py                |  16 +-
tests/qemu-iotests/030                        | 168 +++----
tests/qemu-iotests/040                        | 167 +++---
tests/qemu-iotests/041                        | 474 ++++++++----------
tests/qemu-iotests/045                        |  15 +-
tests/qemu-iotests/055                        |  61 +--
tests/qemu-iotests/056                        |  23 +-
tests/qemu-iotests/093                        |  41 +-
tests/qemu-iotests/118                        | 221 ++++----
tests/qemu-iotests/124                        |  69 ++-
tests/qemu-iotests/129                        |  13 +-
tests/qemu-iotests/132                        |   5 +-
tests/qemu-iotests/139                        |  43 +-
tests/qemu-iotests/147                        |  30 +-
tests/qemu-iotests/151                        |  40 +-
tests/qemu-iotests/155                        |  53 +-
tests/qemu-iotests/165                        |   7 +-
tests/qemu-iotests/196                        |   3 +-
tests/qemu-iotests/205                        |   6 +-
tests/qemu-iotests/245                        | 245 ++++-----
tests/qemu-iotests/256                        |  34 +-
tests/qemu-iotests/257                        |  36 +-
tests/qemu-iotests/264                        |  31 +-
tests/qemu-iotests/281                        |  21 +-
tests/qemu-iotests/295                        |  27 +-
tests/qemu-iotests/296                        |  14 +-
tests/qemu-iotests/298                        |  13 +-
tests/qemu-iotests/300                        |  50 +-
tests/qemu-iotests/iotests.py                 |   6 +-
.../tests/migrate-bitmaps-postcopy-test       |  31 +-
tests/qemu-iotests/tests/migrate-bitmaps-test |  37 +-
.../qemu-iotests/tests/migrate-during-backup  |  40 +-
.../qemu-iotests/tests/migration-permissions  |   9 +-
tests/qemu-iotests/tests/mirror-top-perms     |  15 +-
34 files changed, 821 insertions(+), 1243 deletions(-)
[RFC 0/2] introduce QEMUMachind.cmd()
Posted by Vladimir Sementsov-Ogievskiy 2 years, 1 month ago
Hi all!

I always dreamed about getting rid of pattern

    result = self.vm.qmp(...)
    self.assert_qmp(result, 'return', {})

Here is a suggestion to switch to

    self.vm.cmd(...)

pattern instead.

I'm not sure we really want to update so many tests. May be just commit
patch 01, and use new interface for new code. On the other hand, old
code always used as an example to write the new one.

The series is based on John's python branch.

Vladimir Sementsov-Ogievskiy (2):
  python/machine.py: upgrade vm.command() method
  iotests: use vm.cmd() instead of vm.qmp() where appropriate

 python/qemu/machine/machine.py                |  16 +-
 tests/qemu-iotests/030                        | 168 +++----
 tests/qemu-iotests/040                        | 167 +++---
 tests/qemu-iotests/041                        | 474 ++++++++----------
 tests/qemu-iotests/045                        |  15 +-
 tests/qemu-iotests/055                        |  61 +--
 tests/qemu-iotests/056                        |  23 +-
 tests/qemu-iotests/093                        |  41 +-
 tests/qemu-iotests/118                        | 221 ++++----
 tests/qemu-iotests/124                        |  69 ++-
 tests/qemu-iotests/129                        |  13 +-
 tests/qemu-iotests/132                        |   5 +-
 tests/qemu-iotests/139                        |  43 +-
 tests/qemu-iotests/147                        |  30 +-
 tests/qemu-iotests/151                        |  40 +-
 tests/qemu-iotests/155                        |  53 +-
 tests/qemu-iotests/165                        |   7 +-
 tests/qemu-iotests/196                        |   3 +-
 tests/qemu-iotests/205                        |   6 +-
 tests/qemu-iotests/245                        | 245 ++++-----
 tests/qemu-iotests/256                        |  34 +-
 tests/qemu-iotests/257                        |  36 +-
 tests/qemu-iotests/264                        |  31 +-
 tests/qemu-iotests/281                        |  21 +-
 tests/qemu-iotests/295                        |  27 +-
 tests/qemu-iotests/296                        |  14 +-
 tests/qemu-iotests/298                        |  13 +-
 tests/qemu-iotests/300                        |  50 +-
 tests/qemu-iotests/iotests.py                 |   6 +-
 .../tests/migrate-bitmaps-postcopy-test       |  31 +-
 tests/qemu-iotests/tests/migrate-bitmaps-test |  37 +-
 .../qemu-iotests/tests/migrate-during-backup  |  40 +-
 .../qemu-iotests/tests/migration-permissions  |   9 +-
 tests/qemu-iotests/tests/mirror-top-perms     |  15 +-
 34 files changed, 821 insertions(+), 1243 deletions(-)

-- 
2.35.1
Re: [RFC 0/2] introduce QEMUMachind.cmd()
Posted by John Snow 2 years ago
On Fri, Apr 8, 2022 at 1:02 PM Vladimir Sementsov-Ogievskiy
<vladimir.sementsov-ogievskiy@openvz.org> wrote:
>
> Hi all!
>
> I always dreamed about getting rid of pattern
>
>     result = self.vm.qmp(...)
>     self.assert_qmp(result, 'return', {})
>
> Here is a suggestion to switch to
>
>     self.vm.cmd(...)
>
> pattern instead.

Yeah, I am absolutely on board for this!

>
> I'm not sure we really want to update so many tests. May be just commit
> patch 01, and use new interface for new code. On the other hand, old
> code always used as an example to write the new one.

I think it's worth updating all the old tests ... especially if you've
already done it here. We could even do something like what I did with
qemu_img() and qemu_io() and have the uncaught exception print a bunch
of information to the screen to help make it extremely obvious as to
what failed and why.

If you can rebase this, I'd love to review it more carefully - it
aligns with my own selfish goals and interests :) The Python branch
was merged recently and so we should be all set.

>
> The series is based on John's python branch.
>
> Vladimir Sementsov-Ogievskiy (2):
>   python/machine.py: upgrade vm.command() method
>   iotests: use vm.cmd() instead of vm.qmp() where appropriate
>
>  python/qemu/machine/machine.py                |  16 +-
>  tests/qemu-iotests/030                        | 168 +++----
>  tests/qemu-iotests/040                        | 167 +++---
>  tests/qemu-iotests/041                        | 474 ++++++++----------
>  tests/qemu-iotests/045                        |  15 +-
>  tests/qemu-iotests/055                        |  61 +--
>  tests/qemu-iotests/056                        |  23 +-
>  tests/qemu-iotests/093                        |  41 +-
>  tests/qemu-iotests/118                        | 221 ++++----
>  tests/qemu-iotests/124                        |  69 ++-
>  tests/qemu-iotests/129                        |  13 +-
>  tests/qemu-iotests/132                        |   5 +-
>  tests/qemu-iotests/139                        |  43 +-
>  tests/qemu-iotests/147                        |  30 +-
>  tests/qemu-iotests/151                        |  40 +-
>  tests/qemu-iotests/155                        |  53 +-
>  tests/qemu-iotests/165                        |   7 +-
>  tests/qemu-iotests/196                        |   3 +-
>  tests/qemu-iotests/205                        |   6 +-
>  tests/qemu-iotests/245                        | 245 ++++-----
>  tests/qemu-iotests/256                        |  34 +-
>  tests/qemu-iotests/257                        |  36 +-
>  tests/qemu-iotests/264                        |  31 +-
>  tests/qemu-iotests/281                        |  21 +-
>  tests/qemu-iotests/295                        |  27 +-
>  tests/qemu-iotests/296                        |  14 +-
>  tests/qemu-iotests/298                        |  13 +-
>  tests/qemu-iotests/300                        |  50 +-
>  tests/qemu-iotests/iotests.py                 |   6 +-
>  .../tests/migrate-bitmaps-postcopy-test       |  31 +-
>  tests/qemu-iotests/tests/migrate-bitmaps-test |  37 +-
>  .../qemu-iotests/tests/migrate-during-backup  |  40 +-
>  .../qemu-iotests/tests/migration-permissions  |   9 +-
>  tests/qemu-iotests/tests/mirror-top-perms     |  15 +-
>  34 files changed, 821 insertions(+), 1243 deletions(-)

Is there anything missing, to your knowledge?

--js
Re: [RFC 0/2] introduce QEMUMachind.cmd()
Posted by Vladimir Sementsov-Ogievskiy 2 years ago
27.04.2022 22:29, John Snow wrote:
> On Fri, Apr 8, 2022 at 1:02 PM Vladimir Sementsov-Ogievskiy
> <vladimir.sementsov-ogievskiy@openvz.org> wrote:
>>
>> Hi all!
>>
>> I always dreamed about getting rid of pattern
>>
>>      result = self.vm.qmp(...)
>>      self.assert_qmp(result, 'return', {})
>>
>> Here is a suggestion to switch to
>>
>>      self.vm.cmd(...)
>>
>> pattern instead.
> 
> Yeah, I am absolutely on board for this!
> 
>>
>> I'm not sure we really want to update so many tests. May be just commit
>> patch 01, and use new interface for new code. On the other hand, old
>> code always used as an example to write the new one.
> 
> I think it's worth updating all the old tests ... especially if you've
> already done it here. We could even do something like what I did with
> qemu_img() and qemu_io() and have the uncaught exception print a bunch
> of information to the screen to help make it extremely obvious as to
> what failed and why.
> 
> If you can rebase this, I'd love to review it more carefully - it
> aligns with my own selfish goals and interests :) The Python branch
> was merged recently and so we should be all set.
> 
>>
>> The series is based on John's python branch.
>>
>> Vladimir Sementsov-Ogievskiy (2):
>>    python/machine.py: upgrade vm.command() method
>>    iotests: use vm.cmd() instead of vm.qmp() where appropriate
>>
>>   python/qemu/machine/machine.py                |  16 +-
>>   tests/qemu-iotests/030                        | 168 +++----
>>   tests/qemu-iotests/040                        | 167 +++---
>>   tests/qemu-iotests/041                        | 474 ++++++++----------
>>   tests/qemu-iotests/045                        |  15 +-
>>   tests/qemu-iotests/055                        |  61 +--
>>   tests/qemu-iotests/056                        |  23 +-
>>   tests/qemu-iotests/093                        |  41 +-
>>   tests/qemu-iotests/118                        | 221 ++++----
>>   tests/qemu-iotests/124                        |  69 ++-
>>   tests/qemu-iotests/129                        |  13 +-
>>   tests/qemu-iotests/132                        |   5 +-
>>   tests/qemu-iotests/139                        |  43 +-
>>   tests/qemu-iotests/147                        |  30 +-
>>   tests/qemu-iotests/151                        |  40 +-
>>   tests/qemu-iotests/155                        |  53 +-
>>   tests/qemu-iotests/165                        |   7 +-
>>   tests/qemu-iotests/196                        |   3 +-
>>   tests/qemu-iotests/205                        |   6 +-
>>   tests/qemu-iotests/245                        | 245 ++++-----
>>   tests/qemu-iotests/256                        |  34 +-
>>   tests/qemu-iotests/257                        |  36 +-
>>   tests/qemu-iotests/264                        |  31 +-
>>   tests/qemu-iotests/281                        |  21 +-
>>   tests/qemu-iotests/295                        |  27 +-
>>   tests/qemu-iotests/296                        |  14 +-
>>   tests/qemu-iotests/298                        |  13 +-
>>   tests/qemu-iotests/300                        |  50 +-
>>   tests/qemu-iotests/iotests.py                 |   6 +-
>>   .../tests/migrate-bitmaps-postcopy-test       |  31 +-
>>   tests/qemu-iotests/tests/migrate-bitmaps-test |  37 +-
>>   .../qemu-iotests/tests/migrate-during-backup  |  40 +-
>>   .../qemu-iotests/tests/migration-permissions  |   9 +-
>>   tests/qemu-iotests/tests/mirror-top-perms     |  15 +-
>>   34 files changed, 821 insertions(+), 1243 deletions(-)
> 
> Is there anything missing, to your knowledge?
> 

Don't remember) I hope, I'd write in commit message, if there was something :) Will rebase soon.

-- 
Best regards,
Vladimir