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]>
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]>
This takes the place of qmp-shell's __get_address function. It also
allows other utilities to share the same parser and syntax for
specifying QMP locations.
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
If the user selects pretty-printing (-p) the contents of any
dictionaries in the output are sorted by key.
Signed-off-by: David Edmondson <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
We guarantee 3.5+ everywhere; remove more dead checks. In general, try
to avoid using version checks and instead prefer to attempt behavior
when possible.
Signed-off-by: John Snow <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Use the program search path to find the Python 3 interpreter.
Patch created mechanically by running:
$ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
$(git grep -l 'if __name__.*__main__')
Reported-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Suggested-by: Daniel P. Berrangé <[email protected]>
Suggested-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Acked-by: Stefan Hajnoczi <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
python3 doesn't have raw_input(), so qmp-shell breaks.
Use input() instead and override it with raw_input()
if running on python2.
Signed-off-by: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
This is a simple move of Python code that wraps common QEMU
functionality, and are used by a number of different tests
and scripts.
By treating that code as a real Python module, we can more easily:
* reuse code
* have a proper place for the module's own unittests
* apply a more consistent style
* generate documentation
Signed-off-by: Cleber Rosa <[email protected]>
Reviewed-by: Caio Carrara <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Cleber Rosa <[email protected]>