#
e2f9a657 |
| 01-Jul-2015 |
John Snow <jsnow@redhat.com> |
qmp-shell: add documentation
I should probably document the changes that were made.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <1435775149-17285-1-git-send-email-jsnow@redhat.com> Revi
qmp-shell: add documentation
I should probably document the changes that were made.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <1435775149-17285-1-git-send-email-jsnow@redhat.com> Reviewed-By: Kashyap Chamarthy <kchamart@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
1ceca07e |
| 29-Apr-2015 |
John Snow <jsnow@redhat.com> |
scripts: qmp-shell: Add verbose flag
Add a verbose flag that shows the QMP command that was constructed, to allow for later copy/pasting, reference, debugging, etc.
The QMP is converted from a Pyth
scripts: qmp-shell: Add verbose flag
Add a verbose flag that shows the QMP command that was constructed, to allow for later copy/pasting, reference, debugging, etc.
The QMP is converted from a Python literal to JSON first, to ensure that it is viable input to the actual QMP parser.
As a side-effect, this JSON output will helpfully show all the necessary conversions that were performed on the input, illustrating that "True" was transformed back into "true", literal values are now escaped with "" instead of '', and so on.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Kashyap Chamarthy <kchamart@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
30bd6815 |
| 29-Apr-2015 |
John Snow <jsnow@redhat.com> |
scripts: qmp-shell: add transaction subshell
Add a special processing mode to craft transactions.
By entering "transaction(" the shell will enter a special mode where each subsequent command will b
scripts: qmp-shell: add transaction subshell
Add a special processing mode to craft transactions.
By entering "transaction(" the shell will enter a special mode where each subsequent command will be saved as a transaction instead of executed as an individual command.
The transaction can be submitted by entering ")" on a line by itself.
Examples:
Separate lines:
(QEMU) transaction( TRANS> block-dirty-bitmap-add node=drive0 name=bitmap1 TRANS> block-dirty-bitmap-clear node=drive0 name=bitmap0 TRANS> )
With a transaction action included on the first line:
(QEMU) transaction( block-dirty-bitmap-add node=drive0 name=bitmap2 TRANS> block-dirty-bitmap-add node=drive0 name=bitmap3 TRANS> )
As a one-liner, with just one transaction action:
(QEMU) transaction( block-dirty-bitmap-add node=drive0 name=bitmap0 )
As a side-effect of this patch, blank lines are now parsed as no-ops, regardless of which shell mode you are in.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Kashyap Chamarthy <kchamart@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
6092c3ec |
| 29-Apr-2015 |
John Snow <jsnow@redhat.com> |
scripts: qmp-shell: Expand support for QMP expressions
This includes support for [] expressions, single-quotes in QMP expressions (which is not strictly a part of JSON), and the ability to use "True
scripts: qmp-shell: Expand support for QMP expressions
This includes support for [] expressions, single-quotes in QMP expressions (which is not strictly a part of JSON), and the ability to use "True", "False" and "None" literals instead of JSON's equivalent true, false, and null literals.
qmp-shell currently allows you to describe values as JSON expressions: key={"key":{"key2":"val"}}
But it does not currently support arrays, which are needed for serializing and deserializing transactions: key=[{"type":"drive-backup","data":{...}}]
qmp-shell also only currently accepts doubly quoted strings as-per JSON spec, but QMP allows single quotes.
Lastly, python allows you to utilize "True" or "False" as boolean literals, but JSON expects "true" or "false". Expand qmp-shell to allow the user to type either, converting to the correct type.
As a consequence of the above, the key=val parsing is also improved to give better error messages if a key=val token is not provided.
CAVEAT: The parser is still extremely rudimentary and does not expect to find spaces in {} nor [] expressions. This patch does not improve this functionality.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Kashyap Chamarthy <kchamart@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
a7430a0b |
| 29-Apr-2015 |
John Snow <jsnow@redhat.com> |
scripts: qmp-shell: refactor helpers
Refactor the qmp-shell command line processing function into two components. This will be used to allow sub-expressions, which will assist us in adding transacti
scripts: qmp-shell: refactor helpers
Refactor the qmp-shell command line processing function into two components. This will be used to allow sub-expressions, which will assist us in adding transactional support to qmp-shell.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Kashyap Chamarthy <kchamart@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
cd159d09 |
| 12-Feb-2014 |
Fam Zheng <famz@redhat.com> |
QMP: Allow dot separated dict path arguments in qmp-shell
As another convenience to allow using commands that expect a dict as argument, this patch adds support for foo.bar=value syntax, similar to
QMP: Allow dot separated dict path arguments in qmp-shell
As another convenience to allow using commands that expect a dict as argument, this patch adds support for foo.bar=value syntax, similar to command line argument style:
(QEMU) blockdev-add options.driver=file options.id=drive1 options.filename=...
Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
ff9ec34d |
| 29-Jan-2014 |
Stefan Hajnoczi <stefanha@redhat.com> |
QMP: allow JSON dict arguments in qmp-shell
qmp-shell hides the QMP wire protocol JSON encoding from the user. Most of the time this is helpful and makes the command-line human-friendly.
Some QMP
QMP: allow JSON dict arguments in qmp-shell
qmp-shell hides the QMP wire protocol JSON encoding from the user. Most of the time this is helpful and makes the command-line human-friendly.
Some QMP commands take a dict as an argument. In order to express this we need to revert back to JSON notation.
This patch allows JSON dict arguments in qmp-shell so commands like blockdev-add and nbd-server-start can be invoked:
(QEMU) blockdev-add options={"driver":"file","id":"drive1",...}
Note that spaces are not allowed since str.split() is used to break up the command-line arguments first.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
22f3946b |
| 10-Sep-2013 |
Luiz Capitulino <lcapitulino@redhat.com> |
QMP: add scripts/qmp
Populate it with all scripts stored in QMP/. Also fixes trailing whitespaces in qmp-shell and qmp.py.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric
QMP: add scripts/qmp
Populate it with all scripts stored in QMP/. Also fixes trailing whitespaces in qmp-shell and qmp.py.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
#
74bc9066 |
| 06-May-2013 |
Zhangleiqiang <zhangleiqiang@huawei.com> |
qmp: fix handling of cmd with Equals in qmp-shell
qmp: fix handling of cmd with equal mark in qmp-shell
qmp-shell splits the argument and value of input command by equal mark("="). But there
qmp: fix handling of cmd with Equals in qmp-shell
qmp: fix handling of cmd with equal mark in qmp-shell
qmp-shell splits the argument and value of input command by equal mark("="). But there are commands whose values include equal mark themselves, and the json built by qmp-shell will not correct. For example, when using NBD as the target of block-backup command, the input "block-backup target=nbd+unix:///drive0?socket=/tmp/nbd.sock" will fail, because the json built will be as follows:
{ "execute":"block-backup", "arguments":{"target":"nbd+unix:///drive0?socket"} }
Fix it by joining the sections split by equal mark excluding the first section in __build_cmd function when the length of sections is larger than two.
Signed-off-by: zhangleiqiang <zhangleiqiang@huawei.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
e5ecec7b |
| 25-Mar-2013 |
Igor Mammedov <imammedo@redhat.com> |
qmp: fix handling of boolean values in qmp-shell
qmp-shell converts only integer arguments and the rest is assumed to be strings which are faithfully sent as quoted strings by json. But QEMU refuses
qmp: fix handling of boolean values in qmp-shell
qmp-shell converts only integer arguments and the rest is assumed to be strings which are faithfully sent as quoted strings by json. But QEMU refuses to accept qmp command with boolean argument whose value is escaped as string.
Fix it by special-casing true/false keywords and store value as corresponding boolean.
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
fa779b65 |
| 15-Aug-2012 |
Daniel P. Berrange <berrange@redhat.com> |
Add support for pretty-printing response in qmp-shell
Add a '-p' arg to the QMP/qmp-shell test program, which uses the python pprint module to pretty-print the dictionary returned from a command
Add support for pretty-printing response in qmp-shell
Add a '-p' arg to the QMP/qmp-shell test program, which uses the python pprint module to pretty-print the dictionary returned from a command
$ qmp-shell -p /tmp/qemu Welcome to the QMP low-level shell! Connected to QEMU 1.1.50
(QEMU) query-cpus { u'return': [ { u'CPU': 0, u'current': True, u'halted': True, u'pc': 1048556, u'thread_id': 7108}]}
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
11217a75 |
| 28-Oct-2010 |
Luiz Capitulino <lcapitulino@redhat.com> |
QMP/qmp-shell: Introduce HMP mode
In which qmp-shell will exclusively use the HMP passthrough feature, this is useful for testing.
Example:
# ./qmp-shell -H qmp-sock Welcome to the HMP she
QMP/qmp-shell: Introduce HMP mode
In which qmp-shell will exclusively use the HMP passthrough feature, this is useful for testing.
Example:
# ./qmp-shell -H qmp-sock Welcome to the HMP shell! Connected to QEMU 0.13.50
(QEMU) info network VLAN 0 devices: user.0: net=10.0.2.0, restricted=n e1000.0: model=e1000,macaddr=52:54:00:12:34:56 Devices not on any VLAN: (QEMU)
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
9bed0d0d |
| 27-Oct-2010 |
Luiz Capitulino <lcapitulino@redhat.com> |
QMP: Revamp the qmp-shell script
This commit updates the qmp-shell script to use the new interface introduced by the last commit.
Additionally, the following fixes/features are also introduced:
o
QMP: Revamp the qmp-shell script
This commit updates the qmp-shell script to use the new interface introduced by the last commit.
Additionally, the following fixes/features are also introduced:
o TCP sockets support o Update/add documentation o Simple command-line completion o Fix a number of unhandled errors
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
8d7e8457 |
| 15-Jun-2010 |
Jan Kiszka <jan.kiszka@siemens.com> |
QMP: Teach basic capability negotiation to python example
As sending "qmp_capabilities" on session start became mandatory, both python examples were broken.
Signed-off-by: Jan Kiszka <jan.kiszka@si
QMP: Teach basic capability negotiation to python example
As sending "qmp_capabilities" on session start became mandatory, both python examples were broken.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
cedebdac |
| 27-Nov-2009 |
Luiz Capitulino <lcapitulino@redhat.com> |
QMP: Introduce qmp-shell
This is a very simple shell written in Python for demonstration purposes.
Unfortunately it's a bit awkward right now, as the user has to specify the arguments names and the
QMP: Introduce qmp-shell
This is a very simple shell written in Python for demonstration purposes.
Unfortunately it's a bit awkward right now, as the user has to specify the arguments names and the printed data can be a raw dictionary or list, like the following example:
(QEMU) pci_add pci_addr=auto type=nic {u'slot': 5, u'bus': 0, u'domain': 0, u'function': 0} (QEMU)
It's worth to note that the shell is broken into two files. One is the shell itself, the other is the QMP class which handles the communication with QEMU.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|