Skip to contentSkip to conversation

block: document block-stream in qmp-commands.hx

PATCH Applied Stefan Hajnoczi 5 participants 6 messages Apr 15, 2015 – Apr 27, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: document block-stream in qmp-commands.hx

The 'block-stream' QMP command is documented in block-core.json but not qmp-commands.hx. Add a summary of the command to qmp-commands.hx (similar to the documentation for 'block-commit').

---
 qmp-commands.hx | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
qmp-commands.hx +37 -0
index 3a42ad0..7a745ed 100644
@@ -1008,6 +1008,43 @@ EQMP
         .mhandler.cmd_new = qmp_marshal_input_block_stream,
     },
 
+SQMP
+block-stream
+------------
+
+Copy data from a backing file into a block device.
+
+Arguments:
+
+- "device": The device's ID, must be unique (json-string)
+- "base": The file name of the backing image above which copying starts
+          (json-string, optional)
+- "backing-file": The backing file string to write into the active layer. This
+                  filename is not validated.
+
+                  If a pathname string is such that it cannot be resolved by
+                  QEMU, that means that subsequent QMP or HMP commands must use
+                  node-names for the image in question, as filename lookup
+                  methods will fail.
+
+                  If not specified, QEMU will automatically determine the
+                  backing file string to use, or error out if there is no
+                  obvious choice.  Care should be taken when specifying the
+                  string, to specify a valid filename or protocol.
+                  (json-string, optional) (Since 2.1)
+- "speed":  the maximum speed, in bytes per second (json-int, optional)
+- "on-error": the action to take on an error (default 'report').  'stop' and
+              'enospc' can only be used if the block device supports io-status.
+              (json-string, optional) (Since 2.1)
+
+Example:
+
+-> { "execute": "block-stream", "arguments": { "device": "virtio0",
+                                               "base": "/tmp/master.qcow2" } }
+<- { "return": {} }
+
+EQMP
+
     {
         .name       = "block-commit",
         .args_type  = "device:B,base:s?,top:s?,backing-file:s?,speed:o?",
Signature · 1 line
2.1.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Stefan Hajnoczi

The 'block-stream' QMP command is documented in block-core.json but not qmp-commands.hx. Add a summary of the command to qmp-commands.hx (similar to the documentation for 'block-commit').

---
 qmp-commands.hx | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Reviewed-by on v1 1/1
#2 lore raw
In reply to Stefan Hajnoczi
Quoted 15 lines · Stefan Hajnoczi

The 'block-stream' QMP command is documented in block-core.json but not qmp-commands.hx. Add a summary of the command to qmp-commands.hx (similar to the documentation for 'block-commit').

---
  qmp-commands.hx | 37 +++++++++++++++++++++++++++++++++++++
  1 file changed, 37 insertions(+)
qmp-commands.hx +0 -0
index 3a42ad0..7a745ed 100644

qmp-commands.hx EQMP · line 1015

Quoted 8 lines
qmp-commands.hx +5 -0
@@ -1008,6 +1008,43 @@ EQMP
          .mhandler.cmd_new = qmp_marshal_input_block_stream,
      },
 
+SQMP
+block-stream
+------------
+
+Copy data from a backing file into a block device.

It looks like you stopped just copy-pasting the information from block-core.json here...

qmp-commands.hx EQMP · line 1019

Quoted 4 lines
qmp-commands.hx +4 -0
+
+Arguments:
+
+- "device": The device's ID, must be unique (json-string)

...instead sometimes copying it from block-commit...

qmp-commands.hx EQMP · line 1021

Quoted 2 lines
qmp-commands.hx +2 -0
+- "base": The file name of the backing image above which copying starts
+          (json-string, optional)

...or creating new descriptions...

qmp-commands.hx EQMP · line 1023

Quoted 2 lines
qmp-commands.hx +2 -0
+- "backing-file": The backing file string to write into the active layer. This
+                  filename is not validated.

...and then you are continuing copying the block-core.json entry.

Is there a reason why you didn't just take all of the block-core.json comment and put it here? (just curious)

Quoted 27 lines
qmp-commands.hx +24 -0
+
+                  If a pathname string is such that it cannot be resolved by
+                  QEMU, that means that subsequent QMP or HMP commands must use
+                  node-names for the image in question, as filename lookup
+                  methods will fail.
+
+                  If not specified, QEMU will automatically determine the
+                  backing file string to use, or error out if there is no
+                  obvious choice.  Care should be taken when specifying the
+                  string, to specify a valid filename or protocol.
+                  (json-string, optional) (Since 2.1)
+- "speed":  the maximum speed, in bytes per second (json-int, optional)
+- "on-error": the action to take on an error (default 'report').  'stop' and
+              'enospc' can only be used if the block device supports io-status.
+              (json-string, optional) (Since 2.1)
+
+Example:
+
+-> { "execute": "block-stream", "arguments": { "device": "virtio0",
+                                               "base": "/tmp/master.qcow2" } }
+<- { "return": {} }
+
+EQMP
+
      {
          .name       = "block-commit",
          .args_type  = "device:B,base:s?,top:s?,backing-file:s?,speed:o?",
#3 lore raw
Quoted 39 lines · Max Reitz
Quoted 15 lines · Stefan Hajnoczi

The 'block-stream' QMP command is documented in block-core.json but not qmp-commands.hx. Add a summary of the command to qmp-commands.hx (similar to the documentation for 'block-commit').

---
 qmp-commands.hx | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
qmp-commands.hx +0 -0
index 3a42ad0..7a745ed 100644

qmp-commands.hx EQMP · line 1014

Quoted 7 lines
qmp-commands.hx +5 -0
@@ -1008,6 +1008,43 @@ EQMP
         .mhandler.cmd_new = qmp_marshal_input_block_stream,
     },
+SQMP
+block-stream
+------------
+
+Copy data from a backing file into a block device.

It looks like you stopped just copy-pasting the information from block-core.json here...

qmp-commands.hx EQMP · line 1019

Quoted 4 lines
qmp-commands.hx +4 -0
+
+Arguments:
+
+- "device": The device's ID, must be unique (json-string)

...instead sometimes copying it from block-commit...

qmp-commands.hx EQMP · line 1021

Quoted 2 lines
qmp-commands.hx +2 -0
+- "base": The file name of the backing image above which copying starts
+          (json-string, optional)

...or creating new descriptions...

Quoted 7 lines

qmp-commands.hx EQMP · line 1023

Quoted 2 lines
qmp-commands.hx +2 -0
+- "backing-file": The backing file string to write into the active layer. This
+                  filename is not validated.

...and then you are continuing copying the block-core.json entry.

Is there a reason why you didn't just take all of the block-core.json comment and put it here? (just curious)

Yes. block-commit has a similar approach where the qmp-commands.hx doesn't contain the full command description, just a summary.

Unfortunately, the QAPI schema and QMP argument descriptions differ. They use different conventions so I needed to adapt or rewrite them. The path I chose was a mixture of a little bit from, a little bit from there, and some of my own magic :P.

The best long-term step would be to pick a canonical documentation unit
- either QAPI schema or qmp-commands - and resolve differences between them. Then we'll have just 1 location and all documentation can be generated from it.

Stefan

#5 lore raw
In reply to Stefan Hajnoczi
Quoted 9 lines · Stefan Hajnoczi

The 'block-stream' QMP command is documented in block-core.json but not qmp-commands.hx. Add a summary of the command to qmp-commands.hx (similar to the documentation for 'block-commit').

---
 qmp-commands.hx | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Thanks, applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next

Stefan

#4 lore raw
In reply to Stefan Hajnoczi
Quoted 57 lines · Stefan Hajnoczi
Quoted 39 lines · Max Reitz
Quoted 15 lines · Stefan Hajnoczi

The 'block-stream' QMP command is documented in block-core.json but not qmp-commands.hx. Add a summary of the command to qmp-commands.hx (similar to the documentation for 'block-commit').

---
 qmp-commands.hx | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
qmp-commands.hx +0 -0
index 3a42ad0..7a745ed 100644

qmp-commands.hx EQMP · line 1014

Quoted 7 lines
qmp-commands.hx +5 -0
@@ -1008,6 +1008,43 @@ EQMP
         .mhandler.cmd_new = qmp_marshal_input_block_stream,
     },
+SQMP
+block-stream
+------------
+
+Copy data from a backing file into a block device.

It looks like you stopped just copy-pasting the information from block-core.json here...

qmp-commands.hx EQMP · line 1019

Quoted 4 lines
qmp-commands.hx +4 -0
+
+Arguments:
+
+- "device": The device's ID, must be unique (json-string)

...instead sometimes copying it from block-commit...

qmp-commands.hx EQMP · line 1021

Quoted 2 lines
qmp-commands.hx +2 -0
+- "base": The file name of the backing image above which copying starts
+          (json-string, optional)

...or creating new descriptions...

Quoted 8 lines
Quoted 3 lines
qmp-commands.hx +1 -0
+- "backing-file": The backing file string to write into the active

layer. This
+ filename is not validated.

...and then you are continuing copying the block-core.json entry.

Is there a reason why you didn't just take all of the block-core.json comment and put it here? (just curious)

Yes. block-commit has a similar approach where the qmp-commands.hx doesn't contain the full command description, just a summary.

Unfortunately, the QAPI schema and QMP argument descriptions differ. They use different conventions so I needed to adapt or rewrite them. The path I chose was a mixture of a little bit from, a little bit from there, and some of my own magic :P.

Quoted 4 lines

The best long-term step would be to pick a canonical documentation unit
- either QAPI schema or qmp-commands - and resolve differences between them. Then we'll have just 1 location and all documentation can be generated from it.

qmp-commands.hx needs to go. A few things keep it around, and one of them is qemu-commands.txt. Need to generate a satisfactory replacement from the QAPI schema.