qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 439125: python: introduce qmp-shell-wrap conv


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 439125: python: introduce qmp-shell-wrap convenience tool
Date: Fri, 25 Feb 2022 03:27:45 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 439125293cc9cfb684eb4db23db04199f5f435a2
      
https://github.com/qemu/qemu/commit/439125293cc9cfb684eb4db23db04199f5f435a2
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M python/qemu/aqmp/qmp_shell.py
    M python/setup.cfg
    A scripts/qmp/qmp-shell-wrap

  Log Message:
  -----------
  python: introduce qmp-shell-wrap convenience tool

With the current 'qmp-shell' tool developers must first spawn QEMU with
a suitable -qmp arg and then spawn qmp-shell in a separate terminal
pointing to the right socket.

With 'qmp-shell-wrap' developers can ignore QMP sockets entirely and
just pass the QEMU command and arguments they want. The program will
listen on a UNIX socket and tell QEMU to connect QMP to that.

For example, this:

 # qmp-shell-wrap -- qemu-system-x86_64 -display none

Is roughly equivalent of running:

 # qemu-system-x86_64 -display none -qmp qmp-shell-1234 &
 # qmp-shell qmp-shell-1234

Except that 'qmp-shell-wrap' switches the socket peers around so that
it is the UNIX socket server and QEMU is the socket client. This makes
QEMU reliably go away when qmp-shell-wrap exits, closing the server
socket.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20220128161157.36261-2-berrange@redhat.com
[Edited for rebase. --js]
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 5c66d7d8de9a00460199669d26cd83fba135bee5
      
https://github.com/qemu/qemu/commit/5c66d7d8de9a00460199669d26cd83fba135bee5
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M python/qemu/aqmp/qmp_shell.py
    M python/setup.cfg

  Log Message:
  -----------
  python: support recording QMP session to a file

When running QMP commands with very large response payloads, it is often
not easy to spot the info you want. If we can save the response to a
file then tools like 'grep' or 'jq' can be used to extract information.

For convenience of processing, we merge the QMP command and response
dictionaries together:

  {
      "arguments": {},
      "execute": "query-kvm",
      "return": {
          "enabled": false,
          "present": true
      }
  }

Example usage

  $ ./scripts/qmp/qmp-shell-wrap -l q.log -p -- ./build/qemu-system-x86_64 
-display none
  Welcome to the QMP low-level shell!
  Connected
  (QEMU) query-kvm
  {
      "return": {
          "enabled": false,
          "present": true
      }
  }
  (QEMU) query-mice
  {
      "return": [
          {
              "absolute": false,
              "current": true,
              "index": 2,
              "name": "QEMU PS/2 Mouse"
          }
      ]
  }

 $ jq --slurp '. | to_entries[] | select(.value.execute == "query-kvm") |
               .value.return.enabled' < q.log
   false

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20220128161157.36261-3-berrange@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 2ddaeb7b090ecec0debbb73bdfb18a0d9080f56d
      
https://github.com/qemu/qemu/commit/2ddaeb7b090ecec0debbb73bdfb18a0d9080f56d
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M python/setup.py

  Log Message:
  -----------
  Python: discourage direct setup.py install

When invoking setup.py directly, the default behavior for 'install' is
to run the bdist_egg installation hook, which is ... actually deprecated
by setuptools. It doesn't seem to work quite right anymore.

By contrast, 'pip install' will invoke the bdist_wheel hook
instead. This leads to differences in behavior for the two approaches. I
advocate using pip in the documentation in this directory, but the
'setup.py' which has been used for quite a long time in the Python world
may deceptively appear to work at first glance.

Add an error message that will save a bit of time and frustration
that points the user towards using the supported installation
invocation.

Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Beraldo Leal <bleal@redhat.com>
Message-id: 20220207213039.2278569-1-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 762c280d5f3c17a239204a73855d8778f6dc2113
      
https://github.com/qemu/qemu/commit/762c280d5f3c17a239204a73855d8778f6dc2113
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M python/tests/iotests-pylint.sh
    M python/tests/pylint.sh

  Log Message:
  -----------
  Python: add setuptools v60.0 workaround

Setuptools v60 and later include a bundled version of distutils, a
deprecated standard library scheduled for removal in future versions of
Python. Setuptools v60 is only possible to install for Python 3.7 and later.

Python has a distutils.sysconfig.get_python_lib() function that returns
'/usr/lib/pythonX.Y' on posix systems. RPM-based systems actually use
'/usr/lib64/pythonX.Y' instead, so Fedora patches stdlib distutils for
Python 3.7 and Python 3.8 to return the correct value.

Python 3.9 and later introduce a sys.platlibdir property, which returns
the correct value on RPM-based systems.

The change to a distutils package not provided by Fedora on Python 3.7
and 3.8 causes a regression in distutils.sysconfig.get_python_lib() that
ultimately causes false positives to be emitted by pylint, because it
can no longer find the system source libraries.

Many Python tools are fairly aggressive about updating setuptools
packages, and so even though this package is a fair bit newer than
Python 3.7/3.8, it's not entirely unreasonable for a given user to have
such a modern package with a fairly old Python interpreter.

Updates to Python 3.7 and Python 3.8 are being produced for Fedora which
will fix the problem on up-to-date systems. Until then, we can force the
loading of platform-provided distutils when running the pylint
test. This is the least-invasive yet most comprehensive fix.

References:
 https://github.com/pypa/setuptools/pull/2896
 https://github.com/PyCQA/pylint/issues/5704
 https://github.com/pypa/distutils/issues/110

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20220204221804.2047468-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 43a1119ef132ce23624046babbd08d9d0708dc46
      
https://github.com/qemu/qemu/commit/43a1119ef132ce23624046babbd08d9d0708dc46
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M python/Makefile
    M python/setup.cfg

  Log Message:
  -----------
  Revert "python: pin setuptools below v60.0.0"

This reverts commit 1e4d8b31be35e54b6429fea54f5ecaa0083f91e7.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20220204221804.2047468-3-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 89d38c74f4b69a93696392b55a9fee573055d78b
      
https://github.com/qemu/qemu/commit/89d38c74f4b69a93696392b55a9fee573055d78b
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M MAINTAINERS

  Log Message:
  -----------
  MAINTAINERS: python - remove ehabkost and add bleal

Eduardo Habkost has left Red Hat and has other daily responsibilities to
attend to. In order to stop spamming him on every series, remove him as
"Reviewer" for the python/ library dir and add Beraldo Leal instead.

For the "python scripts" stanza (which is separate due to level of
support), replace Eduardo as maintainer with myself.

(Thanks for all of your hard work, Eduardo!)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Beraldo Leal <bleal@redhat.com>
Acked-by: Eduardo Habkost <eduardo@habkost.net>
Message-id: 20220208000525.2601011-1-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: fa435db8ce1dff3b15e3f59a12f55f7b3a347b08
      
https://github.com/qemu/qemu/commit/fa435db8ce1dff3b15e3f59a12f55f7b3a347b08
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-24 (Thu, 24 Feb 2022)

  Changed paths:
    M MAINTAINERS
    M python/Makefile
    M python/qemu/aqmp/qmp_shell.py
    M python/setup.cfg
    M python/setup.py
    M python/tests/iotests-pylint.sh
    M python/tests/pylint.sh
    A scripts/qmp/qmp-shell-wrap

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' 
into staging

Python patches

New functionality in qmp-shell from Dan, and some packaging fixes.

# gpg: Signature made Wed 23 Feb 2022 22:08:35 GMT
# gpg:                using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full]
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jsnow-gitlab/tags/python-pull-request:
  MAINTAINERS: python - remove ehabkost and add bleal
  Revert "python: pin setuptools below v60.0.0"
  Python: add setuptools v60.0 workaround
  Python: discourage direct setup.py install
  python: support recording QMP session to a file
  python: introduce qmp-shell-wrap convenience tool

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/4aa2e497a98b...fa435db8ce1d



reply via email to

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