Skip to contentSkip to conversation

: QMP: Commands doc

PATCH Applied Luiz Capitulino 5 participants 16 messages May 31, 2010 – Jun 1, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

v4 cover : QMP: Commands doc

Rebase.. Let's try to merge this ASAP, please.

changelog
---------

v3 -> v4
--------

- Rebased
- Minor commit log clarification

v2 -> v3
--------

- Rebased
- Addressed review comments
- Move contents to qemu-monitor.hx (Jan)

v1 -> v2
--------

- Rebased
- Addressed Markus's comments
- Changed indentation style
- Minor fixes and clarifications

#1 lore raw

PATCH v4 1/3 monitor: Reorder info documentation

From: Jan Kiszka <[email protected]>

Push the doc fragments for the info command to the end of qemu-monitor.hx. This helps to establish a proper layout in the upcoming QMP documentation.

---
 qemu-monitor.hx |  186 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 96 insertions(+), 90 deletions(-)
qemu-monitor.hx +96 -90
index f4f88df..b8c765b 100644
@@ -38,96 +38,6 @@ Commit changes to the disk images (if -snapshot is used) or backing files.
 ETEXI
 
     {
-        .name       = "info",
-        .args_type  = "item:s?",
-        .params     = "[subcommand]",
-        .help       = "show various information about the system state",
-        .user_print = monitor_user_noop,
-        .mhandler.cmd_new = do_info,
-    },
-
-STEXI
-@item info @var{subcommand}
-@findex info
-Show various information about the system state.
-
-@table @option
-@item info version
-show the version of QEMU
-@item info commands
-list QMP available commands
-@item info network
-show the various VLANs and the associated devices
-@item info chardev
-show the character devices
-@item info block
-show the block devices
-@item info blockstats
-show block device statistics
-@item info registers
-show the cpu registers
-@item info cpus
-show infos for each CPU
-@item info history
-show the command line history
-@item info irq
-show the interrupts statistics (if available)
-@item info pic
-show i8259 (PIC) state
-@item info pci
-show emulated PCI device info
-@item info tlb
-show virtual to physical memory mappings (i386 only)
-@item info mem
-show the active virtual memory mappings (i386 only)
-@item info hpet
-show state of HPET (i386 only)
-@item info jit
-show dynamic compiler info
-@item info kvm
-show KVM information
-@item info numa
-show NUMA information
-@item info usb
-show USB devices plugged on the virtual USB hub
-@item info usbhost
-show all USB host devices
-@item info profile
-show profiling information
-@item info capture
-show information about active capturing
-@item info snapshots
-show list of VM snapshots
-@item info status
-show the current VM status (running|paused)
-@item info pcmcia
-show guest PCMCIA status
-@item info mice
-show which guest mouse is receiving events
-@item info vnc
-show the vnc server status
-@item info name
-show the current VM name
-@item info uuid
-show the current VM UUID
-@item info cpustats
-show CPU statistics
-@item info usernet
-show user network stack connection states
-@item info migrate
-show migration status
-@item info balloon
-show balloon information
-@item info qtree
-show device tree
-@item info qdm
-show qdev device model list
-@item info roms
-show roms
-@end table
-ETEXI
-
-    {
         .name       = "q|quit",
         .args_type  = "",
         .params     = "",
@@ -1190,6 +1100,102 @@ STEXI
 Enable the specified QMP capabilities
 ETEXI
 
+
+HXCOMM Keep the 'info' command at the end!
+HXCOMM This is required for the QMP documentation layout.
+
+    {
+        .name       = "info",
+        .args_type  = "item:s?",
+        .params     = "[subcommand]",
+        .help       = "show various information about the system state",
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_info,
+    },
+
+STEXI
+@item info @var{subcommand}
+@findex info
+Show various information about the system state.
+
+@table @option
+@item info version
+show the version of QEMU
+@item info commands
+list QMP available commands
+@item info network
+show the various VLANs and the associated devices
+@item info chardev
+show the character devices
+@item info block
+show the block devices
+@item info blockstats
+show block device statistics
+@item info registers
+show the cpu registers
+@item info cpus
+show infos for each CPU
+@item info history
+show the command line history
+@item info irq
+show the interrupts statistics (if available)
+@item info pic
+show i8259 (PIC) state
+@item info pci
+show emulated PCI device info
+@item info tlb
+show virtual to physical memory mappings (i386 only)
+@item info mem
+show the active virtual memory mappings (i386 only)
+@item info hpet
+show state of HPET (i386 only)
+@item info jit
+show dynamic compiler info
+@item info kvm
+show KVM information
+@item info numa
+show NUMA information
+@item info usb
+show USB devices plugged on the virtual USB hub
+@item info usbhost
+show all USB host devices
+@item info profile
+show profiling information
+@item info capture
+show information about active capturing
+@item info snapshots
+show list of VM snapshots
+@item info status
+show the current VM status (running|paused)
+@item info pcmcia
+show guest PCMCIA status
+@item info mice
+show which guest mouse is receiving events
+@item info vnc
+show the vnc server status
+@item info name
+show the current VM name
+@item info uuid
+show the current VM UUID
+@item info cpustats
+show CPU statistics
+@item info usernet
+show user network stack connection states
+@item info migrate
+show migration status
+@item info balloon
+show balloon information
+@item info qtree
+show device tree
+@item info qdm
+show qdev device model list
+@item info roms
+show roms
+@end table
+ETEXI
+
+HXCOMM DO NOT add new commands after 'info', move your addition before it!
+
 STEXI
 @end table
 ETEXI
Signature · 1 line
1.7.1.231.gd0b16
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] monitor: Reorder info documentation

Quoted 8 lines · Luiz Capitulino

From: Jan Kiszka<[email protected]>

Push the doc fragments for the info command to the end of qemu-monitor.hx. This helps to establish a proper layout in the upcoming QMP documentation.

Applied all. Thanks.

Regards,

Anthony Liguori

Quoted 209 lines
---
  qemu-monitor.hx |  186 ++++++++++++++++++++++++++++--------------------------
  1 files changed, 96 insertions(+), 90 deletions(-)
qemu-monitor.hx +96 -90
index f4f88df..b8c765b 100644
@@ -38,96 +38,6 @@ Commit changes to the disk images (if -snapshot is used) or backing files.
  ETEXI
 
      {
-        .name       = "info",
-        .args_type  = "item:s?",
-        .params     = "[subcommand]",
-        .help       = "show various information about the system state",
-        .user_print = monitor_user_noop,
-        .mhandler.cmd_new = do_info,
-    },
-
-STEXI
-@item info @var{subcommand}
-@findex info
-Show various information about the system state.
-
-@table @option
-@item info version
-show the version of QEMU
-@item info commands
-list QMP available commands
-@item info network
-show the various VLANs and the associated devices
-@item info chardev
-show the character devices
-@item info block
-show the block devices
-@item info blockstats
-show block device statistics
-@item info registers
-show the cpu registers
-@item info cpus
-show infos for each CPU
-@item info history
-show the command line history
-@item info irq
-show the interrupts statistics (if available)
-@item info pic
-show i8259 (PIC) state
-@item info pci
-show emulated PCI device info
-@item info tlb
-show virtual to physical memory mappings (i386 only)
-@item info mem
-show the active virtual memory mappings (i386 only)
-@item info hpet
-show state of HPET (i386 only)
-@item info jit
-show dynamic compiler info
-@item info kvm
-show KVM information
-@item info numa
-show NUMA information
-@item info usb
-show USB devices plugged on the virtual USB hub
-@item info usbhost
-show all USB host devices
-@item info profile
-show profiling information
-@item info capture
-show information about active capturing
-@item info snapshots
-show list of VM snapshots
-@item info status
-show the current VM status (running|paused)
-@item info pcmcia
-show guest PCMCIA status
-@item info mice
-show which guest mouse is receiving events
-@item info vnc
-show the vnc server status
-@item info name
-show the current VM name
-@item info uuid
-show the current VM UUID
-@item info cpustats
-show CPU statistics
-@item info usernet
-show user network stack connection states
-@item info migrate
-show migration status
-@item info balloon
-show balloon information
-@item info qtree
-show device tree
-@item info qdm
-show qdev device model list
-@item info roms
-show roms
-@end table
-ETEXI
-
-    {
          .name       = "q|quit",
          .args_type  = "",
          .params     = "",
@@ -1190,6 +1100,102 @@ STEXI
  Enable the specified QMP capabilities
  ETEXI
 
+
+HXCOMM Keep the 'info' command at the end!
+HXCOMM This is required for the QMP documentation layout.
+
+    {
+        .name       = "info",
+        .args_type  = "item:s?",
+        .params     = "[subcommand]",
+        .help       = "show various information about the system state",
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_info,
+    },
+
+STEXI
+@item info @var{subcommand}
+@findex info
+Show various information about the system state.
+
+@table @option
+@item info version
+show the version of QEMU
+@item info commands
+list QMP available commands
+@item info network
+show the various VLANs and the associated devices
+@item info chardev
+show the character devices
+@item info block
+show the block devices
+@item info blockstats
+show block device statistics
+@item info registers
+show the cpu registers
+@item info cpus
+show infos for each CPU
+@item info history
+show the command line history
+@item info irq
+show the interrupts statistics (if available)
+@item info pic
+show i8259 (PIC) state
+@item info pci
+show emulated PCI device info
+@item info tlb
+show virtual to physical memory mappings (i386 only)
+@item info mem
+show the active virtual memory mappings (i386 only)
+@item info hpet
+show state of HPET (i386 only)
+@item info jit
+show dynamic compiler info
+@item info kvm
+show KVM information
+@item info numa
+show NUMA information
+@item info usb
+show USB devices plugged on the virtual USB hub
+@item info usbhost
+show all USB host devices
+@item info profile
+show profiling information
+@item info capture
+show information about active capturing
+@item info snapshots
+show list of VM snapshots
+@item info status
+show the current VM status (running|paused)
+@item info pcmcia
+show guest PCMCIA status
+@item info mice
+show which guest mouse is receiving events
+@item info vnc
+show the vnc server status
+@item info name
+show the current VM name
+@item info uuid
+show the current VM UUID
+@item info cpustats
+show CPU statistics
+@item info usernet
+show user network stack connection states
+@item info migrate
+show migration status
+@item info balloon
+show balloon information
+@item info qtree
+show device tree
+@item info qdm
+show qdev device model list
+@item info roms
+show roms
+@end table
+ETEXI
+
+HXCOMM DO NOT add new commands after 'info', move your addition before it!
+
  STEXI
  @end table
  ETEXI
#3 lore raw

PATCH v4 2/3 QMP: Introduce commands documentation

In reply to Luiz Capitulino

From: Jan Kiszka <[email protected]>

One of the most important missing feature in QMP today is its supported commands documentation.

The plan is to make it part of self-description support, however self-description is a big task we have been postponing for a long time now and still don't know when it's going to be done.

In order not to compromise QMP adoption and make users' life easier, this commit adds a simple text documentation which fully describes all QMP supported commands.

This is not ideal for a number of reasons (harder to maintain, text-only, etc) but does improve the current situation. To avoid at least divering from the user monitor help and texi snippets, QMP bits are also maintained inside qemu-monitor.hx, and hxtool is extended to generate a single text file from them.

---
 Makefile        |    5 +-
 QMP/README      |    5 +-
 configure       |    4 +
 hxtool          |   44 ++-
 qemu-monitor.hx | 1322 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 1376 insertions(+), 4 deletions(-)
Makefile +4 -1
index 7986bf6..3a8a311 100644
@@ -29,7 +29,7 @@ $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
 LIBS+=-lz $(LIBS_TOOLS)
 
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
+DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
 else
 DOCS=
 endif
@@ -259,6 +259,9 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
+QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
+	$(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@,"  GEN   $@")
+
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
QMP/README +3 -2
index 9334c25..35a80c7 100644
@@ -15,8 +15,9 @@ QMP is JSON[1] based and has the following features:
 
 For more information, please, refer to the following files:
 
-o qmp-spec.txt    QEMU Monitor Protocol current specification
-o qmp-events.txt  List of available asynchronous events
+o qmp-spec.txt      QEMU Monitor Protocol current specification
+o qmp-commands.txt  QMP supported commands
+o qmp-events.txt    List of available asynchronous events
 
 There are also two simple Python scripts available:
 
configure +4 -0
index 3cd2c5f..653c8d2 100755
@@ -2817,3 +2817,7 @@ ln -s $source_path/Makefile.user $d/Makefile
 if test "$static" = "no" -a "$user_pie" = "yes" ; then
   echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
 fi
+
+if test "$docs" = "yes" ; then
+  mkdir -p QMP
+fi
hxtool +43 -1

65 lines not on this page · raw message

qemu-monitor.hx +1322 -0

1,553 lines not on this page · raw message

Signature · 1 line
1.7.1.231.gd0b16
#4 lore raw

Re: [Qemu-devel] [PATCH 2/3] QMP: Introduce commands documentation

On Mon, May 31, 2010 at 6:43 PM, Luiz Capitulino <[email protected]> wrote:
Hi Luiz,

I'm interested in QMP, have left some feedback. As I get up to speed with QMP my questions and suggestions will hopefully be useful. Apologies in advance if any of my thoughts here are old news and have been discussed elsewhere :).

I didn't see documentation on the errors that a command can encounter.
Error documentation would be useful for commands where the client
needs to react by trying an alternative command. If errors are opaque or undocumented, then the client can't perform error recovery, they can only log the error or prompt the user for help.

Quoted 34 lines
(quoted diff) +0 -0
@@ -113,6 +184,35 @@ Password: ********
 

 @end table
 ETEXI

qemu-monitor.hx +29 -0
+SQMP
+change
+------
+
+Change a removable medium or VNC configuration.
+
+Arguments:
+
+- "device": device name (json-string)
+- "target": filename or item (json-string)
+- "arg": additional argument (json-string, optional)
+
+Examples:
+
+1. Change a removable medium
+
+-> { "execute": "change",
+             "arguments": { "device": "ide1-cd0",
+                            "target": "/srv/images/Fedora-12-x86_64-DVD.iso" } }
+<- { "return": {} }
+
+2. Change VNC password
+
+-> { "execute": "change",
+             "arguments": { "device": "vnc", "target": "password",
+                            "arg": "foobar1" } }
+<- { "return": {} }
+
+EQMP
Quoted 2 lines

    {
        .name       = "screendump",

For removable media is there a way to use, for instance, sheepdog, or is the target strictly a file name?

Can the VNC password be removed when arg is the empty string or arg is not present?

Quoted 23 lines
(quoted diff) +0 -0
@@ -532,6 +747,24 @@ STEXI

 @findex cpu
 Set the default CPU.
 ETEXI

qemu-monitor.hx +18 -0
+SQMP
+cpu
+---
+
+Set the default CPU.
+
+Arguments:
+
+- "index": the CPU's index (json-int)
+
+Example:
+
+-> { "execute": "cpu", "arguments": { "index": 0 } }
+<- { "return": {} }
+
+Note: CPUs' indexes are obtained with the 'query-cpus' command.
+
+EQMP
Quoted 2 lines

    {
        .name       = "mouse_move",

I believe this is the per-monitor default cpu for memory dumping and other per-cpu commands. The concept of the default cpu makes sense for an interactive monitor, humans don't want to type the cpu index for each cpu-specific command. For QMP it feels cleaner to have a cpu argument for commands that are per-cpu. As a newcomer I'm not sure of the philosophy for QMP commands, 1:1 with monitor commands or as appropriate for a JSON interface?

If the QMP cpu command is supported in a QEMU release, can it be phased out later?

Will look more later.

Stefan

#5 lore raw

Re: [Qemu-devel] [PATCH 2/3] QMP: Introduce commands documentation

Quoted 80 lines · Stefan Hajnoczi

On Mon, May 31, 2010 at 6:43 PM, Luiz Capitulino <[email protected]> wrote:
Hi Luiz,

I'm interested in QMP, have left some feedback. As I get up to speed with QMP my questions and suggestions will hopefully be useful. Apologies in advance if any of my thoughts here are old news and have been discussed elsewhere :).

I didn't see documentation on the errors that a command can encounter.
Error documentation would be useful for commands where the client
needs to react by trying an alternative command. If errors are opaque or undocumented, then the client can't perform error recovery, they can only log the error or prompt the user for help.

Quoted 26 lines
qemu-monitor.hx +22 -0
@@ -113,6 +184,35 @@ Password: ********
 
 @end table
 ETEXI
+SQMP
+change
+------
+
+Change a removable medium or VNC configuration.
+
+Arguments:
+
+- "device": device name (json-string)
+- "target": filename or item (json-string)
+- "arg": additional argument (json-string, optional)
+
+Examples:
+
+1. Change a removable medium
+
+-> { "execute": "change",
+             "arguments": { "device": "ide1-cd0",
+                            "target": "/srv/images/Fedora-12-x86_64-DVD.iso" } }
+<- { "return": {} }
+
+2. Change VNC password

qemu-monitor.hx Password: ******** · line 218

Quoted 10 lines
qemu-monitor.hx +7 -0
+
+-> { "execute": "change",
+             "arguments": { "device": "vnc", "target": "password",
+                            "arg": "foobar1" } }
+<- { "return": {} }
+
+EQMP
 
    {
        .name       = "screendump",

For removable media is there a way to use, for instance, sheepdog, or is the target strictly a file name?

Can the VNC password be removed when arg is the empty string or arg is not present?

Quoted 23 lines
qemu-monitor.hx +18 -0
@@ -532,6 +747,24 @@ STEXI
 @findex cpu
 Set the default CPU.
 ETEXI
+SQMP
+cpu
+---
+
+Set the default CPU.
+
+Arguments:
+
+- "index": the CPU's index (json-int)
+
+Example:
+
+-> { "execute": "cpu", "arguments": { "index": 0 } }
+<- { "return": {} }
+
+Note: CPUs' indexes are obtained with the 'query-cpus' command.
+
+EQMP
 
Quoted 10 lines

qemu-monitor.hx STEXI · line 770

Quoted 2 lines
qemu-monitor.hx +0 -0
    {
        .name       = "mouse_move",

I believe this is the per-monitor default cpu for memory dumping and other per-cpu commands. The concept of the default cpu makes sense for an interactive monitor, humans don't want to type the cpu index for each cpu-specific command. For QMP it feels cleaner to have a cpu argument for commands that are per-cpu. As a newcomer I'm not sure of the philosophy for QMP commands, 1:1 with monitor commands or as appropriate for a JSON interface?

Makes some sense.

I've a simple patch in my queue that can be used to assign different arguments for QMP and HMP use. So we could add a 'cpu' argument to all those QMP commands that so far rely on the above mechanism.

Quoted 3 lines

If the QMP cpu command is supported in a QEMU release, can it be phased out later?

Better avoid it being rolled out.

That said, first let us merge this documentation as baseline, then fix such things (including error documentation) on top of it.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#6 lore raw

Re: [Qemu-devel] [PATCH 2/3] QMP: Introduce commands documentation

Quoted 92 lines · On Tue, 01 Jun 2010 09:40:44 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 80 lines · Stefan Hajnoczi

On Mon, May 31, 2010 at 6:43 PM, Luiz Capitulino <[email protected]> wrote:
Hi Luiz,

I'm interested in QMP, have left some feedback. As I get up to speed with QMP my questions and suggestions will hopefully be useful. Apologies in advance if any of my thoughts here are old news and have been discussed elsewhere :).

I didn't see documentation on the errors that a command can encounter.
Error documentation would be useful for commands where the client
needs to react by trying an alternative command. If errors are opaque or undocumented, then the client can't perform error recovery, they can only log the error or prompt the user for help.

Quoted 26 lines
qemu-monitor.hx +22 -0
@@ -113,6 +184,35 @@ Password: ********
 
 @end table
 ETEXI
+SQMP
+change
+------
+
+Change a removable medium or VNC configuration.
+
+Arguments:
+
+- "device": device name (json-string)
+- "target": filename or item (json-string)
+- "arg": additional argument (json-string, optional)
+
+Examples:
+
+1. Change a removable medium
+
+-> { "execute": "change",
+             "arguments": { "device": "ide1-cd0",
+                            "target": "/srv/images/Fedora-12-x86_64-DVD.iso" } }
+<- { "return": {} }
+
+2. Change VNC password

qemu-monitor.hx Password: ******** · line 218

Quoted 10 lines
qemu-monitor.hx +7 -0
+
+-> { "execute": "change",
+             "arguments": { "device": "vnc", "target": "password",
+                            "arg": "foobar1" } }
+<- { "return": {} }
+
+EQMP
 
    {
        .name       = "screendump",

For removable media is there a way to use, for instance, sheepdog, or is the target strictly a file name?

Can the VNC password be removed when arg is the empty string or arg is not present?

Quoted 23 lines
qemu-monitor.hx +18 -0
@@ -532,6 +747,24 @@ STEXI
 @findex cpu
 Set the default CPU.
 ETEXI
+SQMP
+cpu
+---
+
+Set the default CPU.
+
+Arguments:
+
+- "index": the CPU's index (json-int)
+
+Example:
+
+-> { "execute": "cpu", "arguments": { "index": 0 } }
+<- { "return": {} }
+
+Note: CPUs' indexes are obtained with the 'query-cpus' command.
+
+EQMP
 
Quoted 10 lines

qemu-monitor.hx STEXI · line 770

Quoted 2 lines
qemu-monitor.hx +0 -0
    {
        .name       = "mouse_move",

I believe this is the per-monitor default cpu for memory dumping and other per-cpu commands. The concept of the default cpu makes sense for an interactive monitor, humans don't want to type the cpu index for each cpu-specific command. For QMP it feels cleaner to have a cpu argument for commands that are per-cpu. As a newcomer I'm not sure of the philosophy for QMP commands, 1:1 with monitor commands or as appropriate for a JSON interface?

Quoted 5 lines

Makes some sense.

I've a simple patch in my queue that can be used to assign different arguments for QMP and HMP use. So we could add a 'cpu' argument to all those QMP commands that so far rely on the above mechanism.

Nice.

Quoted 4 lines
Quoted 2 lines

If the QMP cpu command is supported in a QEMU release, can it be phased out later?

Better avoid it being rolled out.

After 0.13 no incompatible protocol change will be allowed.

Quoted 2 lines

That said, first let us merge this documentation as baseline, then fix such things (including error documentation) on top of it.

Exactly, the goal now is to describe the current protocol state.

#7 lore raw

Re: [Qemu-devel] [PATCH 2/3] QMP: Introduce commands documentation

Quoted 6 lines · Luiz Capitulino
Quoted 2 lines · On Tue, 01 Jun 2010 09:40:44 +0200 Jan Kiszka <[email protected]> wrote:

That said, first let us merge this documentation as baseline, then fix such things (including error documentation) on top of it.

 Exactly, the goal now is to describe the current protocol state.

I understand. Hope to help out soon.

Stefan

#8 lore raw

Re: [Qemu-devel] [PATCH 2/3] QMP: Introduce commands documentation

In reply to Jan Kiszka
Quoted 6 lines · Jan Kiszka
Quoted 4 lines

If the QMP cpu command is supported in a QEMU release, can it be phased out later?

Better avoid it being rolled out.

I agree. All of the per-monitor CPU stuff needs to be eliminated before 0.13 in QMP.

Regards,

Anthony Liguori

Quoted 6 lines

That said, first let us merge this documentation as baseline, then fix such things (including error documentation) on top of it.

Jan

#9 lore raw

Re: [Qemu-devel] [PATCH 2/3] QMP: Introduce commands documentation

In reply to Stefan Hajnoczi
Quoted 7 lines · On Mon, 31 May 2010 21:22:22 +0100 Stefan Hajnoczi <[email protected]> wrote:

On Mon, May 31, 2010 at 6:43 PM, Luiz Capitulino <[email protected]> wrote:
Hi Luiz,

I'm interested in QMP, have left some feedback. As I get up to speed with QMP my questions and suggestions will hopefully be useful. Apologies in advance if any of my thoughts here are old news and have been discussed elsewhere :).

No problem.

Quoted 5 lines

I didn't see documentation on the errors that a command can encounter.
Error documentation would be useful for commands where the client
needs to react by trying an alternative command. If errors are opaque or undocumented, then the client can't perform error recovery, they can only log the error or prompt the user for help.

The immediate need is to have something which is minimally useful,
we're going to describe errors later.

Actually, ultimate goal is to have self-description support, which should
describe everything (commands, arguments, errors, async messages, etc). But I'm wondering whether we're going to have this on time for 0.13.

Quoted 34 lines
Quoted 34 lines
(quoted diff) +0 -0
@@ -113,6 +184,35 @@ Password: ********
 

 @end table
 ETEXI

qemu-monitor.hx +29 -0
+SQMP
+change
+------
+
+Change a removable medium or VNC configuration.
+
+Arguments:
+
+- "device": device name (json-string)
+- "target": filename or item (json-string)
+- "arg": additional argument (json-string, optional)
+
+Examples:
+
+1. Change a removable medium
+
+-> { "execute": "change",
+             "arguments": { "device": "ide1-cd0",
+                            "target": "/srv/images/Fedora-12-x86_64-DVD.iso" } }
+<- { "return": {} }
+
+2. Change VNC password
+
+-> { "execute": "change",
+             "arguments": { "device": "vnc", "target": "password",
+                            "arg": "foobar1" } }
+<- { "return": {} }
+
+EQMP
Quoted 5 lines
Quoted 2 lines

    {
        .name       = "screendump",

For removable media is there a way to use, for instance, sheepdog, or is the target strictly a file name?

Good question, hey, aren't you a block layer guy? :)

Anyway, this command has the same behavior of HMP's change command.

Quoted 2 lines

Can the VNC password be removed when arg is the empty string or arg is not present?

Yes, when arg is the empty string the password seems to be removed, which
is an ill behavior.

Anyway, the plan is to drop this command from QMP and introduce
change_blockdev & change_password.

Quoted 23 lines
Quoted 23 lines
(quoted diff) +0 -0
@@ -532,6 +747,24 @@ STEXI

 @findex cpu
 Set the default CPU.
 ETEXI

qemu-monitor.hx +18 -0
+SQMP
+cpu
+---
+
+Set the default CPU.
+
+Arguments:
+
+- "index": the CPU's index (json-int)
+
+Example:
+
+-> { "execute": "cpu", "arguments": { "index": 0 } }
+<- { "return": {} }
+
+Note: CPUs' indexes are obtained with the 'query-cpus' command.
+
+EQMP
Quoted 10 lines
Quoted 2 lines

    {
        .name       = "mouse_move",

I believe this is the per-monitor default cpu for memory dumping and other per-cpu commands. The concept of the default cpu makes sense for an interactive monitor, humans don't want to type the cpu index for each cpu-specific command. For QMP it feels cleaner to have a cpu argument for commands that are per-cpu. As a newcomer I'm not sure of the philosophy for QMP commands, 1:1 with monitor commands or as appropriate for a JSON interface?

The latter and you're right about the cpu command, Avi has also
pointed this out.

Quoted 2 lines

If the QMP cpu command is supported in a QEMU release, can it be phased out later?

No, we have to fix all this stuff before 0.13 is out, otherwise we'll
have to support them forever. Actually, we'll probably have some kind of deprecation process, even then we'll have to support bad commands for long time.

#10 lore raw

[Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

In reply to Luiz Capitulino
Quoted 43 lines · Luiz Capitulino

From: Jan Kiszka <[email protected]>

One of the most important missing feature in QMP today is its supported commands documentation.

The plan is to make it part of self-description support, however self-description is a big task we have been postponing for a long time now and still don't know when it's going to be done.

In order not to compromise QMP adoption and make users' life easier, this commit adds a simple text documentation which fully describes all QMP supported commands.

This is not ideal for a number of reasons (harder to maintain, text-only, etc) but does improve the current situation. To avoid at least divering from the user monitor help and texi snippets, QMP bits are also maintained inside qemu-monitor.hx, and hxtool is extended to generate a single text file from them.

---
 Makefile        |    5 +-
 QMP/README      |    5 +-
 configure       |    4 +
 hxtool          |   44 ++-
 qemu-monitor.hx | 1322 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 1376 insertions(+), 4 deletions(-)
Makefile +1 -1
index 7986bf6..3a8a311 100644
@@ -29,7 +29,7 @@ $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
 LIBS+=-lz $(LIBS_TOOLS)
 
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
+DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
 else
 DOCS=
 endif

Makefile qemu-options.texi: $(SRC_PATH)/qemu-options.hx · line 267

Quoted 9 lines
Makefile +3 -0
@@ -259,6 +259,9 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
+QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
+       $(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@,"  GEN   $@")
+
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 

This hunk seem to have "gained" tab-to-spaces conversion, unfortunately in a makefile.

Applying the patch generated another hunk warning:

...
patching file qemu-monitor.hx
Hunk #15 succeeded at 983 with fuzz 2.

Haven't checked yet - harmless?

If you need to resent the patch, please already fold in this trivial fix:

hxtool +2 -0
index d499dc0..7ca83ed 100644
@@ -59,6 +59,7 @@ hxtoqmp()
 {
     IFS=
     flag=0
+    line=1
     while read -r str; do
         case "$str" in
             HXCOMM*)
@@ -87,6 +88,7 @@ hxtoqmp()
             test $flag -eq 1 && echo "$str"
             ;;
         esac
+        line=$((line+1))
     done
 }
 

Thanks!
Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#11 lore raw

[Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

Quoted 57 lines · On Tue, 01 Jun 2010 18:10:26 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 43 lines · Luiz Capitulino

From: Jan Kiszka <[email protected]>

One of the most important missing feature in QMP today is its supported commands documentation.

The plan is to make it part of self-description support, however self-description is a big task we have been postponing for a long time now and still don't know when it's going to be done.

In order not to compromise QMP adoption and make users' life easier, this commit adds a simple text documentation which fully describes all QMP supported commands.

This is not ideal for a number of reasons (harder to maintain, text-only, etc) but does improve the current situation. To avoid at least divering from the user monitor help and texi snippets, QMP bits are also maintained inside qemu-monitor.hx, and hxtool is extended to generate a single text file from them.

---
 Makefile        |    5 +-
 QMP/README      |    5 +-
 configure       |    4 +
 hxtool          |   44 ++-
 qemu-monitor.hx | 1322 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 1376 insertions(+), 4 deletions(-)
Makefile +1 -1
index 7986bf6..3a8a311 100644
@@ -29,7 +29,7 @@ $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
 LIBS+=-lz $(LIBS_TOOLS)
 
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
+DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
 else
 DOCS=
 endif

Makefile qemu-options.texi: $(SRC_PATH)/qemu-options.hx · line 267

Quoted 9 lines
Makefile +3 -0
@@ -259,6 +259,9 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
+QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
+       $(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@,"  GEN   $@")
+
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 

This hunk seem to have "gained" tab-to-spaces conversion, unfortunately in a makefile.

Quoted 1 line

Applying the patch generated another hunk warning:

Are those problems worth a resping or can we fix then with
additional patches? It works ok here.

#12 lore raw

[Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

Quoted 59 lines · Luiz Capitulino
Quoted 56 lines · On Tue, 01 Jun 2010 18:10:26 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 43 lines · Luiz Capitulino

From: Jan Kiszka <[email protected]>

One of the most important missing feature in QMP today is its supported commands documentation.

The plan is to make it part of self-description support, however self-description is a big task we have been postponing for a long time now and still don't know when it's going to be done.

In order not to compromise QMP adoption and make users' life easier, this commit adds a simple text documentation which fully describes all QMP supported commands.

This is not ideal for a number of reasons (harder to maintain, text-only, etc) but does improve the current situation. To avoid at least divering from the user monitor help and texi snippets, QMP bits are also maintained inside qemu-monitor.hx, and hxtool is extended to generate a single text file from them.

---
 Makefile        |    5 +-
 QMP/README      |    5 +-
 configure       |    4 +
 hxtool          |   44 ++-
 qemu-monitor.hx | 1322 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 1376 insertions(+), 4 deletions(-)
Makefile +1 -1
index 7986bf6..3a8a311 100644
@@ -29,7 +29,7 @@ $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
 LIBS+=-lz $(LIBS_TOOLS)
 
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
+DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
 else
 DOCS=
 endif

Makefile qemu-options.texi: $(SRC_PATH)/qemu-options.hx · line 267

Quoted 9 lines
Makefile +3 -0
@@ -259,6 +259,9 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
+QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
+       $(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@,"  GEN   $@")
+
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 

This hunk seem to have "gained" tab-to-spaces conversion, unfortunately in a makefile.

Quoted 4 lines
Quoted 1 line

Applying the patch generated another hunk warning:

Are those problems worth a resping or can we fix then with
additional patches? It works ok here.

Oh, it's indeed a local issue. Likely our corporate mail server. Nice... Sorry for the noise!

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#13 lore raw

Re: [Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

Quoted 4 lines · Jan Kiszka

Oh, it's indeed a local issue. Likely our corporate mail server. Nice... Sorry for the noise!

Jan, I believe you're okay with the current state of this series, yes?

I'd like to apply these ASAP so we can start formal spec review.

Regards,

Anthony Liguori

Quoted 3 lines

Jan

#14 lore raw

Re: [Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

Quoted 6 lines · Anthony Liguori
Quoted 3 lines · Jan Kiszka

Oh, it's indeed a local issue. Likely our corporate mail server. Nice... Sorry for the noise!

Jan, I believe you're okay with the current state of this series, yes?

Yes, of course!

Quoted 2 lines

I'd like to apply these ASAP so we can start formal spec review.

Great.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#15 lore raw

PATCH v4 3/3 Monitor: Drop QMP documentation from code

In reply to Luiz Capitulino

Previous commit added QMP documentation to the qemu-monitor.hx file, it's is a copy of this information.

While it's good to keep it near code, maintaining two copies of the same information is too hard and has little benefit as we don't expect client writers to consult the code to find how to use a QMP command.

---
 block.c     |   69 ----------------------------------------
 hw/pci.c    |   61 -----------------------------------
 hw/qdev.c   |   13 -------
 input.c     |   18 ----------
 migration.c |   38 ----------------------
 monitor.c   |  102 -----------------------------------------------------------
 net.c       |   22 -------------
 qemu-char.c |   16 ---------
 vnc.c       |   29 -----------------
 9 files changed, 0 insertions(+), 368 deletions(-)
block.c +0 -69
index cd70730..67f0998 100644
@@ -1444,33 +1444,6 @@ void bdrv_info_print(Monitor *mon, const QObject *data)
     qlist_iter(qobject_to_qlist(data), bdrv_print_dict, mon);
 }
 
-/**
- * bdrv_info(): Block devices information
- *
- * Each block device information is stored in a QDict and the
- * returned QObject is a QList of all devices.
- *
- * The QDict contains the following:
- *
- * - "device": device name
- * - "type": device type
- * - "removable": true if the device is removable, false otherwise
- * - "locked": true if the device is locked, false otherwise
- * - "inserted": only present if the device is inserted, it is a QDict
- *    containing the following:
- *          - "file": device file name
- *          - "ro": true if read-only, false otherwise
- *          - "drv": driver format name
- *          - "backing_file": backing file name if one is used
- *          - "encrypted": true if encrypted, false otherwise
- *
- * Example:
- *
- * [ { "device": "ide0-hd0", "type": "hd", "removable": false, "locked": false,
- *     "inserted": { "file": "/tmp/foobar", "ro": false, "drv": "qcow2" } },
- *   { "device": "floppy0", "type": "floppy", "removable": true,
- *     "locked": false } ]
- */
 void bdrv_info(Monitor *mon, QObject **ret_data)
 {
     QList *bs_list;
@@ -1576,48 +1549,6 @@ static QObject* bdrv_info_stats_bs(BlockDriverState *bs)
     return res;
 }
 
-/**
- * bdrv_info_stats(): show block device statistics
- *
- * Each device statistic information is stored in a QDict and
- * the returned QObject is a QList of all devices.
- *
- * The QDict contains the following:
- *
- * - "device": device name
- * - "stats": A QDict with the statistics information, it contains:
- *     - "rd_bytes": bytes read
- *     - "wr_bytes": bytes written
- *     - "rd_operations": read operations
- *     - "wr_operations": write operations
- *     - "wr_highest_offset": Highest offset of a sector written since the
- *       BlockDriverState has been opened
- * - "parent": A QDict recursively holding the statistics of the underlying
- *    protocol (e.g. the host file for a qcow2 image). If there is no
- *    underlying protocol, this field is omitted.
- *
- * Example:
- *
- * [ { "device": "ide0-hd0",
- *               "stats": { "rd_bytes": 512,
- *                          "wr_bytes": 0,
- *                          "rd_operations": 1,
- *                          "wr_operations": 0,
- *                          "wr_highest_offset": 0 },
- *               "parent": {
- *                      "stats": { "rd_bytes": 1024,
- *                                 "wr_bytes": 0,
- *                                 "rd_operations": 2,
- *                                 "wr_operations": 0,
- *                                 "wr_highest_offset": 0,
- *                      } } },
- *   { "device": "ide1-cd0",
- *               "stats": { "rd_bytes": 0,
- *                          "wr_bytes": 0,
- *                          "rd_operations": 0,
- *                          "wr_operations": 0,
- *                          "wr_highest_offset": 0 } },
- */
 void bdrv_info_stats(Monitor *mon, QObject **ret_data)
 {
     QObject *obj;
hw/pci.c +0 -61

67 lines not on this page · raw message

hw/qdev.c +0 -13
index af17486..aa2ce01 100644
@@ -779,19 +779,6 @@ void do_info_qdm(Monitor *mon)
     }
 }
 
-/**
- * do_device_add(): Add a device
- *
- * Argument qdict contains
- * - "driver": the name of the new device's driver
- * - "bus": the device's parent bus (device tree path)
- * - "id": the device's ID (must be unique)
- * - device properties
- *
- * Example:
- *
- * { "driver": "usb-net", "id": "eth1", "netdev": "netdev1" }
- */
 int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     QemuOpts *opts;
input.c +0 -18
index 8f0941e..651442d 100644
@@ -214,24 +214,6 @@ void do_info_mice_print(Monitor *mon, const QObject *data)
     qlist_iter(mice_list, info_mice_iter, mon);
 }
 
-/**
- * do_info_mice(): Show VM mice information
- *
- * Each mouse is represented by a QDict, the returned QObject is a QList of
- * all mice.
- *
- * The mouse QDict contains the following:
- *
- * - "name": mouse's name
- * - "index": mouse's index
- * - "current": true if this mouse is receiving events, false otherwise
- * - "absolute": true if the mouse generates absolute input events
- *
- * Example:
- *
- * [ { "name": "QEMU Microsoft Mouse", "index": 0, "current": false, "absolute": false },
- *   { "name": "QEMU PS/2 Mouse", "index": 1, "current": true, "absolute": true } ]
- */
 void do_info_mice(Monitor *mon, QObject **ret_data)
 {
     QEMUPutMouseEntry *cursor;
migration.c +0 -38
index 05f6cc5..706fe55 100644
@@ -197,44 +197,6 @@ static void migrate_put_status(QDict *qdict, const char *name,
     qdict_put_obj(qdict, name, obj);
 }
 
-/**
- * do_info_migrate(): Migration status
- *
- * Return a QDict. If migration is active there will be another
- * QDict with RAM migration status and if block migration is active
- * another one with block migration status.
- *
- * The main QDict contains the following:
- *
- * - "status": migration status
- * - "ram": only present if "status" is "active", it is a QDict with the
- *   following RAM information (in bytes):
- *          - "transferred": amount transferred
- *          - "remaining": amount remaining
- *          - "total": total
- * - "disk": only present if "status" is "active" and it is a block migration,
- *   it is a QDict with the following disk information (in bytes):
- *          - "transferred": amount transferred
- *          - "remaining": amount remaining
- *          - "total": total
- *
- * Examples:
- *
- * 1. Migration is "completed":
- *
- * { "status": "completed" }
- *
- * 2. Migration is "active" and it is not a block migration:
- *
- * { "status": "active",
- *            "ram": { "transferred": 123, "remaining": 123, "total": 246 } }
- *
- * 3. Migration is "active" and it is a block migration:
- *
- * { "status": "active",
- *   "ram": { "total": 1057024, "remaining": 1053304, "transferred": 3720 },
- *   "disk": { "total": 20971520, "remaining": 20880384, "transferred": 91136 }}
- */
 void do_info_migrate(Monitor *mon, QObject **ret_data)
 {
     QDict *qdict;
monitor.c +0 -102

150 lines not on this page · raw message

net.c +0 -22
index 378edfc..efa8b3d 100644
@@ -1194,18 +1194,6 @@ void net_host_device_remove(Monitor *mon, const QDict *qdict)
     qemu_del_vlan_client(vc);
 }
 
-/**
- * do_netdev_add(): Add a host network device
- *
- * Argument qdict contains
- * - "type": the device type, "tap", "user", ...
- * - "id": the device's ID (must be unique)
- * - device options
- *
- * Example:
- *
- * { "type": "user", "id": "netdev1", "hostname": "a-guest" }
- */
 int do_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     QemuOpts *opts;
@@ -1220,16 +1208,6 @@ int do_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
     return res;
 }
 
-/**
- * do_netdev_del(): Delete a host network device
- *
- * Argument qdict contains
- * - "id": the device's ID
- *
- * Example:
- *
- * { "id": "netdev1" }
- */
 int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     const char *id = qdict_get_str(qdict, "id");
qemu-char.c +0 -16
index ac65a1c..faaf624 100644
@@ -2528,22 +2528,6 @@ void qemu_chr_info_print(Monitor *mon, const QObject *ret_data)
     qlist_iter(qobject_to_qlist(ret_data), qemu_chr_qlist_iter, mon);
 }
 
-/**
- * qemu_chr_info(): Character devices information
- *
- * Each device is represented by a QDict. The returned QObject is a QList
- * of all devices.
- *
- * The QDict contains the following:
- *
- * - "label": device's label
- * - "filename": device's file
- *
- * Example:
- *
- * [ { "label": "monitor", "filename", "stdio" },
- *   { "label": "serial0", "filename": "vc" } ]
- */
 void qemu_chr_info(Monitor *mon, QObject **ret_data)
 {
     QList *chr_list;
vnc.c +0 -29
index 11ae3e5..aba3c91 100644
@@ -323,35 +323,6 @@ void do_info_vnc_print(Monitor *mon, const QObject *data)
     }
 }
 
-/**
- * do_info_vnc(): Show VNC server information
- *
- * Return a QDict with server information. Connected clients are returned
- * as a QList of QDicts.
- *
- * The main QDict contains the following:
- *
- * - "enabled": true or false
- * - "host": server's IP address
- * - "family": address family ("ipv4" or "ipv6")
- * - "service": server's port number
- * - "auth": authentication method
- * - "clients": a QList of all connected clients
- *
- * Clients are described by a QDict, with the following information:
- *
- * - "host": client's IP address
- * - "family": address family ("ipv4" or "ipv6")
- * - "service": client's port number
- * - "x509_dname": TLS dname (optional)
- * - "sasl_username": SASL username (optional)
- *
- * Example:
- *
- * { "enabled": true, "host": "0.0.0.0", "service": "50402", "auth": "vnc",
- *   "family": "ipv4",
- *   "clients": [{ "host": "127.0.0.1", "service": "50401", "family": "ipv4" }]}
- */
 void do_info_vnc(Monitor *mon, QObject **ret_data)
 {
     if (vnc_display == NULL || vnc_display->display == NULL) {
Signature · 1 line
1.7.1.231.gd0b16