From: "Daniel P. Berrangé" <berrange@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: Eduardo Habkost <eduardo@habkost.net>,
Cleber Rosa <crosa@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH v2 1/2] python: introduce qmp-shell-wrap convenience tool
Date: Fri, 28 Jan 2022 16:08:28 +0000 [thread overview]
Message-ID: <YfQU/N5QYGoxF2IF@redhat.com> (raw)
In-Reply-To: <CAFn=p-Ytc=9mmWqPKyrXRY2EFOKsyZ3akw8z=F6g1af6jgq0ug@mail.gmail.com>
On Tue, Jan 18, 2022 at 08:07:32PM -0500, John Snow wrote:
> On Tue, Jan 18, 2022 at 5:01 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > 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>
>
> Thanks, I think this is pretty useful.
>
> Can you look at setup.cfg and see about adding a qmp-shell-wrap entry
> point there? I had intended to wean people off of using /scripts for
> things that rely on the QMP packages, because I'm gonna fork them out
> and then these little forwards won't work without installing something
> anyway.
This looks simple enough but when I test I can't actuall get any of
the existing programs to work this way.
I did:
$ python setup.py install --user
...snip...
Processing qemu-0.6.1.0a1-py3.10.egg
Copying qemu-0.6.1.0a1-py3.10.egg to /home/berrange/.local/lib/python3.10/site-packages
Adding qemu 0.6.1.0a1 to easy-install.pth file
Installing aqmp-tui script to /home/berrange/.local/bin
Installing qemu-ga-client script to /home/berrange/.local/bin
Installing qmp-shell script to /home/berrange/.local/bin
Installing qmp-shell-wrap script to /home/berrange/.local/bin
Installing qom script to /home/berrange/.local/bin
Installing qom-fuse script to /home/berrange/.local/bin
Installing qom-get script to /home/berrange/.local/bin
Installing qom-list script to /home/berrange/.local/bin
Installing qom-set script to /home/berrange/.local/bin
Installing qom-tree script to /home/berrange/.local/bin
Installed /home/berrange/.local/lib/python3.10/site-packages/qemu-0.6.1.0a1-py3.10.egg
Processing dependencies for qemu==0.6.1.0a1
Finished processing dependencies for qemu==0.6.1.0a1
$ export PYTHONPATH=/home/berrange/.local/lib/python3.10/site-packages
$ qmp-shell
$ qmp-shell
Traceback (most recent call last):
File "/home/berrange/.local/bin/qmp-shell", line 33, in <module>
sys.exit(load_entry_point('qemu==0.6.1.0a1', 'console_scripts', 'qmp-shell')())
File "/home/berrange/.local/bin/qmp-shell", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib64/python3.10/importlib/metadata/__init__.py", line 162, in load
module = import_module(match.group('module'))
File "/usr/lib64/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'qemu'
I can't see why this is failing to find 'qemu' when it exists fine:
$ python
>>> import qemu.aqmp.qmp_shell
>>> qemu.aqmp.qmp_shell.main()
usage: [-h] [-H] [-N] [-v] [-p] [-l LOGFILE] qmp_server
: error: the following arguments are required: qmp_server
Why is 'load_entry_point' unhappy ?
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2022-01-28 16:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 10:01 [PATCH v2 0/2] python: a few improvements to qmp-shell Daniel P. Berrangé
2022-01-18 10:01 ` [PATCH v2 1/2] python: introduce qmp-shell-wrap convenience tool Daniel P. Berrangé
2022-01-19 1:07 ` John Snow
2022-01-28 16:00 ` Daniel P. Berrangé
2022-01-28 16:08 ` Daniel P. Berrangé [this message]
2022-02-05 0:18 ` John Snow
2022-01-18 10:01 ` [PATCH v2 2/2] python: support recording QMP session to a file Daniel P. Berrangé
2022-01-18 13:26 ` Philippe Mathieu-Daudé via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YfQU/N5QYGoxF2IF@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=crosa@redhat.com \
--cc=eduardo@habkost.net \
--cc=jsnow@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).