[Qemu-devel] [RFC PATCH v2 0/3] python: refactor qemu/__init__.py

John Snow posted 3 patches 4 years, 10 months ago
Test docker-clang@ubuntu passed
Test s390x passed
Test asan passed
Test docker-mingw@fedora passed
Test FreeBSD passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190627212816.27298-1-jsnow@redhat.com
Maintainers: Fam Zheng <fam@euphon.net>, "Alex Bennée" <alex.bennee@linaro.org>, Eduardo Habkost <ehabkost@redhat.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Cleber Rosa <crosa@redhat.com>
python/qemu/__init__.py                   | 502 +-------------------
python/qemu/machine.py                    | 536 ++++++++++++++++++++++
python/qemu/qtest.py                      |   2 +-
scripts/device-crash-test                 |   2 +-
scripts/render_block_graph.py             |   2 +-
tests/acceptance/avocado_qemu/__init__.py |   2 +-
tests/acceptance/virtio_version.py        |   2 +-
tests/migration/guestperf/engine.py       |  22 +-
tests/qemu-iotests/235                    |   2 +-
tests/vm/basevm.py                        |   3 +-
10 files changed, 556 insertions(+), 519 deletions(-)
create mode 100644 python/qemu/machine.py
[Qemu-devel] [RFC PATCH v2 0/3] python: refactor qemu/__init__.py
Posted by John Snow 4 years, 10 months ago
There's a lot of code hiding in what is ostensibly a package
configuration file. Let's break that out into something more visible.

V2:
 - Retain python 2.7+ compatibility :(
 - Refactor shutdown a little more aggressively

John Snow (3):
  python/qemu: split QEMUMachine out from underneath __init__.py
  machine.py: minor delinting
  QEMUMachine: Don't suppress stack traces on close

 python/qemu/__init__.py                   | 502 +-------------------
 python/qemu/machine.py                    | 536 ++++++++++++++++++++++
 python/qemu/qtest.py                      |   2 +-
 scripts/device-crash-test                 |   2 +-
 scripts/render_block_graph.py             |   2 +-
 tests/acceptance/avocado_qemu/__init__.py |   2 +-
 tests/acceptance/virtio_version.py        |   2 +-
 tests/migration/guestperf/engine.py       |  22 +-
 tests/qemu-iotests/235                    |   2 +-
 tests/vm/basevm.py                        |   3 +-
 10 files changed, 556 insertions(+), 519 deletions(-)
 create mode 100644 python/qemu/machine.py

-- 
2.21.0


Re: [Qemu-devel] [RFC PATCH v2 0/3] python: refactor qemu/__init__.py
Posted by John Snow 4 years, 10 months ago
I didn't actually mean to retain the RFC tag, but oh well.

On 6/27/19 5:28 PM, John Snow wrote:
> There's a lot of code hiding in what is ostensibly a package
> configuration file. Let's break that out into something more visible.
> 
> V2:
>  - Retain python 2.7+ compatibility :(
>  - Refactor shutdown a little more aggressively
> 
> John Snow (3):
>   python/qemu: split QEMUMachine out from underneath __init__.py
>   machine.py: minor delinting
>   QEMUMachine: Don't suppress stack traces on close
> 
>  python/qemu/__init__.py                   | 502 +-------------------
>  python/qemu/machine.py                    | 536 ++++++++++++++++++++++
>  python/qemu/qtest.py                      |   2 +-
>  scripts/device-crash-test                 |   2 +-
>  scripts/render_block_graph.py             |   2 +-
>  tests/acceptance/avocado_qemu/__init__.py |   2 +-
>  tests/acceptance/virtio_version.py        |   2 +-
>  tests/migration/guestperf/engine.py       |  22 +-
>  tests/qemu-iotests/235                    |   2 +-
>  tests/vm/basevm.py                        |   3 +-
>  10 files changed, 556 insertions(+), 519 deletions(-)
>  create mode 100644 python/qemu/machine.py
> 

Re: [Qemu-devel] [RFC PATCH v2 0/3] python: refactor qemu/__init__.py
Posted by Eduardo Habkost 4 years, 10 months ago
On Thu, Jun 27, 2019 at 05:32:17PM -0400, John Snow wrote:
> I didn't actually mean to retain the RFC tag, but oh well.

I'm queueing patch 1-2 for QEMU 4.1.

Patch 3 will require more careful review.  If you can demonstrate
it fixes a problem in some use cases, we can call it a bug fix
and include it after soft freeze.  ;)

> 
> On 6/27/19 5:28 PM, John Snow wrote:
> > There's a lot of code hiding in what is ostensibly a package
> > configuration file. Let's break that out into something more visible.
> > 
> > V2:
> >  - Retain python 2.7+ compatibility :(
> >  - Refactor shutdown a little more aggressively
> > 
> > John Snow (3):
> >   python/qemu: split QEMUMachine out from underneath __init__.py
> >   machine.py: minor delinting
> >   QEMUMachine: Don't suppress stack traces on close
> > 
> >  python/qemu/__init__.py                   | 502 +-------------------
> >  python/qemu/machine.py                    | 536 ++++++++++++++++++++++
> >  python/qemu/qtest.py                      |   2 +-
> >  scripts/device-crash-test                 |   2 +-
> >  scripts/render_block_graph.py             |   2 +-
> >  tests/acceptance/avocado_qemu/__init__.py |   2 +-
> >  tests/acceptance/virtio_version.py        |   2 +-
> >  tests/migration/guestperf/engine.py       |  22 +-
> >  tests/qemu-iotests/235                    |   2 +-
> >  tests/vm/basevm.py                        |   3 +-
> >  10 files changed, 556 insertions(+), 519 deletions(-)
> >  create mode 100644 python/qemu/machine.py
> > 
> 

-- 
Eduardo

Re: [Qemu-devel] [RFC PATCH v2 0/3] python: refactor qemu/__init__.py
Posted by John Snow 4 years, 10 months ago

On 7/1/19 5:27 PM, Eduardo Habkost wrote:
> On Thu, Jun 27, 2019 at 05:32:17PM -0400, John Snow wrote:
>> I didn't actually mean to retain the RFC tag, but oh well.
> 
> I'm queueing patch 1-2 for QEMU 4.1.
> 
> Patch 3 will require more careful review.  If you can demonstrate
> it fixes a problem in some use cases, we can call it a bug fix
> and include it after soft freeze.  ;)
> 

Right.

Mostly, it's that it ignores things like ctrl^c -- it ignores ANY
failure. I don't think that it should.

In cases where QEMU crashes, the caller will now get an exception -- but
the cleanup will still faithfully execute. There are some exceptions we
may genuinely wish to suppress here, but it's hard to enumerate which
ones without going too broadly.

It's fine to exclude this for now, but I think it's still something we
want eventually.

Re: [Qemu-devel] [RFC PATCH v2 0/3] python: refactor qemu/__init__.py
Posted by Eduardo Habkost 4 years, 10 months ago
On Mon, Jul 01, 2019 at 07:17:39PM -0400, John Snow wrote:
> 
> 
> On 7/1/19 5:27 PM, Eduardo Habkost wrote:
> > On Thu, Jun 27, 2019 at 05:32:17PM -0400, John Snow wrote:
> >> I didn't actually mean to retain the RFC tag, but oh well.
> > 
> > I'm queueing patch 1-2 for QEMU 4.1.
> > 
> > Patch 3 will require more careful review.  If you can demonstrate
> > it fixes a problem in some use cases, we can call it a bug fix
> > and include it after soft freeze.  ;)
> > 
> 
> Right.
> 
> Mostly, it's that it ignores things like ctrl^c -- it ignores ANY
> failure. I don't think that it should.

Agreed.

> 
> In cases where QEMU crashes, the caller will now get an exception -- but
> the cleanup will still faithfully execute. There are some exceptions we
> may genuinely wish to suppress here, but it's hard to enumerate which
> ones without going too broadly.
> 
> It's fine to exclude this for now, but I think it's still something we
> want eventually.

We just need to ensure all callers of shutdown() are ready for
this change.  I know that scripts/device-crash-test expects
shutdown() to not raise an exception if QEMU crashed, inside
checkOneTestCase().  Maybe that's the only caller that needs to
change.

-- 
Eduardo