scripts/qmp-shell: convert usage comment to docstring
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 <jsnow@redhat.com> Message-id: 20210607200649.1840382-37-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
26d3ce9e5e
commit
7fc29896d2
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Low-level QEMU shell on top of QMP.
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009, 2010 Red Hat Inc.
|
# Copyright (C) 2009, 2010 Red Hat Inc.
|
||||||
#
|
#
|
||||||
# Authors:
|
# Authors:
|
||||||
@ -10,60 +8,78 @@
|
|||||||
# This work is licensed under the terms of the GNU GPL, version 2. See
|
# This work is licensed under the terms of the GNU GPL, version 2. See
|
||||||
# the COPYING file in the top-level directory.
|
# the COPYING file in the top-level directory.
|
||||||
#
|
#
|
||||||
# Usage:
|
|
||||||
#
|
"""
|
||||||
# Start QEMU with:
|
Low-level QEMU shell on top of QMP.
|
||||||
#
|
|
||||||
# # qemu [...] -qmp unix:./qmp-sock,server
|
usage: qmp-shell [-h] [-H] [-N] [-v] [-p] qmp_server
|
||||||
#
|
|
||||||
# Run the shell:
|
positional arguments:
|
||||||
#
|
qmp_server < UNIX socket path | TCP address:port >
|
||||||
# $ qmp-shell ./qmp-sock
|
|
||||||
#
|
optional arguments:
|
||||||
# Commands have the following format:
|
-h, --help show this help message and exit
|
||||||
#
|
-H, --hmp Use HMP interface
|
||||||
# < command-name > [ arg-name1=arg1 ] ... [ arg-nameN=argN ]
|
-N, --skip-negotiation
|
||||||
#
|
Skip negotiate (for qemu-ga)
|
||||||
# For example:
|
-v, --verbose Verbose (echo commands sent and received)
|
||||||
#
|
-p, --pretty Pretty-print JSON
|
||||||
# (QEMU) device_add driver=e1000 id=net1
|
|
||||||
# {u'return': {}}
|
|
||||||
# (QEMU)
|
Start QEMU with:
|
||||||
#
|
|
||||||
# key=value pairs also support Python or JSON object literal subset notations,
|
# qemu [...] -qmp unix:./qmp-sock,server
|
||||||
# without spaces. Dictionaries/objects {} are supported as are arrays [].
|
|
||||||
#
|
Run the shell:
|
||||||
# example-command arg-name1={'key':'value','obj'={'prop':"value"}}
|
|
||||||
#
|
$ qmp-shell ./qmp-sock
|
||||||
# Both JSON and Python formatting should work, including both styles of
|
|
||||||
# string literal quotes. Both paradigms of literal values should work,
|
Commands have the following format:
|
||||||
# including null/true/false for JSON and None/True/False for Python.
|
|
||||||
#
|
< command-name > [ arg-name1=arg1 ] ... [ arg-nameN=argN ]
|
||||||
#
|
|
||||||
# Transactions have the following multi-line format:
|
For example:
|
||||||
#
|
|
||||||
# transaction(
|
(QEMU) device_add driver=e1000 id=net1
|
||||||
# action-name1 [ arg-name1=arg1 ] ... [arg-nameN=argN ]
|
{'return': {}}
|
||||||
# ...
|
(QEMU)
|
||||||
# action-nameN [ arg-name1=arg1 ] ... [arg-nameN=argN ]
|
|
||||||
# )
|
key=value pairs also support Python or JSON object literal subset notations,
|
||||||
#
|
without spaces. Dictionaries/objects {} are supported as are arrays [].
|
||||||
# One line transactions are also supported:
|
|
||||||
#
|
example-command arg-name1={'key':'value','obj'={'prop':"value"}}
|
||||||
# transaction( action-name1 ... )
|
|
||||||
#
|
Both JSON and Python formatting should work, including both styles of
|
||||||
# For example:
|
string literal quotes. Both paradigms of literal values should work,
|
||||||
#
|
including null/true/false for JSON and None/True/False for Python.
|
||||||
# (QEMU) transaction(
|
|
||||||
# TRANS> block-dirty-bitmap-add node=drive0 name=bitmap1
|
|
||||||
# TRANS> block-dirty-bitmap-clear node=drive0 name=bitmap0
|
Transactions have the following multi-line format:
|
||||||
# TRANS> )
|
|
||||||
# {"return": {}}
|
transaction(
|
||||||
# (QEMU)
|
action-name1 [ arg-name1=arg1 ] ... [arg-nameN=argN ]
|
||||||
#
|
...
|
||||||
# Use the -v and -p options to activate the verbose and pretty-print options,
|
action-nameN [ arg-name1=arg1 ] ... [arg-nameN=argN ]
|
||||||
# which will echo back the properly formatted JSON-compliant QMP that is being
|
)
|
||||||
# sent to QEMU, which is useful for debugging and documentation generation.
|
|
||||||
|
One line transactions are also supported:
|
||||||
|
|
||||||
|
transaction( action-name1 ... )
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
(QEMU) transaction(
|
||||||
|
TRANS> block-dirty-bitmap-add node=drive0 name=bitmap1
|
||||||
|
TRANS> block-dirty-bitmap-clear node=drive0 name=bitmap0
|
||||||
|
TRANS> )
|
||||||
|
{"return": {}}
|
||||||
|
(QEMU)
|
||||||
|
|
||||||
|
Use the -v and -p options to activate the verbose and pretty-print options,
|
||||||
|
which will echo back the properly formatted JSON-compliant QMP that is being
|
||||||
|
sent to QEMU, which is useful for debugging and documentation generation.
|
||||||
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import ast
|
import ast
|
||||||
import json
|
import json
|
||||||
|
Loading…
Reference in New Issue
Block a user