Now that we are fully switched over to the new QMP library, move it back
over the old namespace. This is being done primarily so that we may
upload this package simply as "qemu.qmp" without introducing confusion
over whether or not "aqmp" is a new protocol or not.
The trade-off is increased confusion inside the QEMU developer
tree. Sorry!
Note: the 'private' member "_aqmp" in legacy.py also changes to "_qmp";
not out of necessity, but just to remove any traces of the "aqmp"
name.
Signed-off-by: John Snow <[email protected]>
Reviewed-by: Beraldo Leal <[email protected]>
Acked-by: Hanna Reitz <[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
Mea culpa. Dan's patch wound up with the wrong import path because I
re-ordered my most recent pull request and missed that this needed a fix
on rebase.
Fixes: 43912529
Reported-by: Kashyap Chamarthy <[email protected]>
Signed-off-by: John Snow <[email protected]>
Tested-by: Kashyap Chamarthy <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
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é <[email protected]>
Message-id: [email protected]
[Edited for rebase. --js]
Signed-off-by: John Snow <[email protected]>
In order to upload a QMP package to PyPI, I want to remove any scripts
that I am not 100% confident I want to support upstream, beyond our
castle walls.
Move most of our QMP utilities into the utils package so we can split
them out from the PyPI upload.
Signed-off-by: John Snow <[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Beraldo Leal <[email protected]>
The script will be unavailable for a commit or two, which will help
preserve development history attached to the new file. A forwarder will
be added shortly afterwards.
With qmp_shell in the python qemu.qmp package, now it is fully type
checked, linted, etc. via the Python CI. It will be quite a bit harder
to accidentally break it again in the future.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
In preparation for moving qmp-shell into the qemu.qmp package, make
QMPShellError inherit from QMPError so that all custom errors in this
package all derive from QMPError.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
They're not needed; single underscore is enough to express intent that
these methods are "internal". double underscore is used as a weak name
mangling, but that isn't beneficial for us here.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
The nice usage comment should be a docstring instead of a comment, so
that it's visible from other python tooling.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
We are only anticipating QMPShellErrors here, for syntax we weren't able
to understand. Other errors, if any, should be allowed to percolate
upwards.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
calling "transaction( )" is pointless, but valid. Rework the parser to
allow this kind of invocation. This helps clean up exception handling
later by removing accidental breakages of the parser that aren't
explicitly forbidden.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
We still want to revamp qmp-shell again, but there's much more to the
idea than the comment now intuits. Remove it.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
We can invoke the shell history writing when we leave the QMPShell scope
instead of relying on atexit. Doing so may be preferable to avoid global
state being registered from within a class instead of from the
application logic directly.
Use QMP's context manager to hook this history saving at close time,
which gets invoked when we leave the context block.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
Don't "extend" QEMUMonitorProtocol by changing the argument types. Move
the string parsing just outside of the class instead.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
As per my usual, this patch is annotations only. Any changes with side
effects are done elsewhere.
Note: pylint does not understand the subscripts for Collection in Python 3.6,
so use the stronger Sequence type as a workaround.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
list is a generic type, but we expect to use strings directly. We could
subclass list[str], but pylint does not presently understand that
invocation.
Change this class to envelop a list instead of *being* a list, for
simpler mypy typing.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
I'm not sure when this regressed (Or maybe if it was ever working right
to begin with?), but the Python AST requires you to change "Names" to
"Constants" in order to truly convert `false` to `False`.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
Instead of doing this in main, move it into the class itself. (This
makes it easier to put into the qemu.qmp package later by removing as
much as we can from the main() function.)
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
Small tidying; treat "prompt" like an immutable property instead of
function/method/routine.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
No real reason to hide this behind an underscore; make it part of the
initializer and make it a regular RW attribute.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
It's less useful, but it makes the initialization methods LSP
consistent, which quiets a mypy complaint.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
Use argparse instead of an open-coded CLI parser, for consistency with
everything else.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
Shushes pylint. I don't always mind these patterns personally, but I'm
not as sure that I want to remove the warning from pylint's repertoire
entirely. Oh well.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
We want to remove exceptions that are too broad here; we only want to
catch IOErrors that get raised as a direct result of the open call.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
It needs to match the parent's signature -- the negotiate parameter must
be optional.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
Add a little forwarder shim until we are sure that everyone is
comfortable with how to use the tools in their new packaged location.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
The script itself will be unavailable for a few commits before being
restored, with no way to run it right after this commit. This helps move
git history into the new file. To prevent linter regressions, though, we
do need to immediately touch up the filename to remove dashes (to make
the module importable), and remove the executable bit.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
This script is in slightly rough shape, but it still works. A lot of
care went into its initial development. In good faith, I'm updating it
to the latest Python coding standards. If there is in interest in this
script, though, I'll be asking for a contributor to take care of it
further.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
I'm only doing a very quick best-effort to preserve this script, to help
keep it from breaking further. I think there are pending ideas swirling
on the right way to implement better SDKs and better clients, and this
script might be a handy reference for those discussions. It presents
some interesting design problems, like static type safety when using a
dynamic RPC mechanism.
I believe it's worth preserving the effort and care that went into
making this script by updating it to work with our current
infrastructure. However, I am disabling the requirement for docstrings
in this file.
If you would like to help improve this script, please add docstrings
alongside any refactors or rejuvenations you might apply at that time.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
optparse isn't supported anymore, it's from the python2 days. Replace it
with the mostly similar argparse.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>