summaryrefslogtreecommitdiffstats
path: root/scripts/qmp
Commit message (Collapse)AuthorAgeFilesLines
* scripts: Add support for path as argument of qom-treeMartin Cerveny2015-06-191-2/+7
| | | | | | | Add processing of optional argument path as "tree base". Signed-off-by: Martin Cerveny <M.Cerveny@computer.org> Signed-off-by: Andreas Färber <afaerber@suse.de>
* scripts: qmp-shell: Add verbose flagJohn Snow2015-05-111-6/+18
| | | | | | | | | | | | | | | | | | | 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>
* scripts: qmp-shell: add transaction subshellJohn Snow2015-05-111-1/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* scripts: qmp-shell: Expand support for QMP expressionsJohn Snow2015-05-111-16/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* scripts: qmp-shell: refactor helpersJohn Snow2015-05-111-11/+13
| | | | | | | | | | | 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>
* iotests: add QMP event waiting queueJohn Snow2015-04-281-30/+65
| | | | | | | | | | | | | | | | | | | | | | | | A filter is added to allow callers to request very specific events to be pulled from the event queue, while leaving undesired events still in the stream. This allows us to poll for completion data for multiple asynchronous events in any arbitrary order. A new timeout context is added to the qmp pull_event method's wait parameter to allow tests to fail if they do not complete within some expected period of time. Also fixed is a bug in qmp.pull_event where we try to retrieve an event from an empty list if we attempt to retrieve an event with wait=False but no events have occurred. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1429314609-29776-19-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scripts: Add qom-tree scriptAndreas Färber2015-03-171-0/+70
| | | | | | | | | | Functionally it is a recursive qom-list with qom-get per non-child<> property. Some failures needed to be handled, such as trying to read a pointer property, which is not representable in QMP. Those print a literal "<EXCEPTION>". Tested-by: Alistair Francis <alistair.francis@xilinx.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qmp: Check for returned data from __json_read in get_eventsFam Zheng2014-02-281-1/+6
| | | | | | | | | | | | | When QEMU process aborts and socket is closed, qmp client will not detect it. When this happens, some qemu-iotests scripts will enter an endless loop waiting for qmp events. It's better we raise an exception in qmp.py to catch this and make the test script stop. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* QMP: Allow dot separated dict path arguments in qmp-shellFam Zheng2014-02-281-2/+18
| | | | | | | | | | | | | 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>
* QMP: allow JSON dict arguments in qmp-shellStefan Hajnoczi2014-02-171-0/+3
| | | | | | | | | | | | | | | | | | | | | 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>
* Use qemu-project.org domain nameStefan Hajnoczi2013-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qemu.org is held by a third-party and no core community contributor has access to the DNS configuration. This leaves the website exposed to outages due to DNS issues or IP address changes. For example, if the web server IP address needs to change we cannot guarantee qemu.org will point to it! The newer qemu-project.org domain name is owned by Anthony Liguori <anthony@codemonkey.ws>. You can confirm this by querying the whois information. Also note that the #qemu IRC channel topic already references qemu-project.org. Short of having a dedicated legal entity to hold the domain name on behalf of the community, qemu-project.org seems like the safest bet. Let's replace references to qemu.org with qemu-project.org. Note that git-submodule(1) does not detect URL changes. The following commands clear out and re-initialize all submodules to ensure you are using the latest URLs: $ git submodule deinit . # you'll be warned if you have local changes $ rm -rf .git/modules # also clear cached .git/ directories $ git submodule update --init Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1381495958-8306-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
* QMP: add scripts/qmpLuiz Capitulino2013-09-188-0/+1242
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>
OpenPOWER on IntegriCloud