Skip to contentSkip to conversation

block: add block_set_io_throttle virtio-blk-pci QMP example

PATCH Applied Stefan Hajnoczi 2 participants 3 messages Jan 17, 2018 – Jan 18, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: add block_set_io_throttle virtio-blk-pci QMP example

The block_set_io_throttle command can look up BlockBackends by the attached qdev device ID. virtio-blk-pci is a special case because the actual VirtIOBlock device is the "/virtio-backend" child of the PCI adapter device.

Add a QMP schema example so clients will know how to use block_set_io_throttle on the virtio-blk-pci device.

The alternative is to implement some sort of aliasing for qmp_get_blk() but that is likely to cause confusion and could break future use cases. Let's not go there.

---
 qapi/block-core.json | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
qapi/block-core.json +18 -0
index e94a6881b2..4e84cf29db 100644
@@ -1799,6 +1799,24 @@
 # Example:
 #
 # -> { "execute": "block_set_io_throttle",
+#      "arguments": { "id": "virtio-blk-pci0/virtio-backend",
+#                     "bps": 0,
+#                     "bps_rd": 0,
+#                     "bps_wr": 0,
+#                     "iops": 512,
+#                     "iops_rd": 0,
+#                     "iops_wr": 0,
+#                     "bps_max": 0,
+#                     "bps_rd_max": 0,
+#                     "bps_wr_max": 0,
+#                     "iops_max": 0,
+#                     "iops_rd_max": 0,
+#                     "iops_wr_max": 0,
+#                     "bps_max_length": 0,
+#                     "iops_size": 0 } }
+# <- { "return": {} }
+#
+# -> { "execute": "block_set_io_throttle",
 #      "arguments": { "id": "ide0-1-0",
 #                     "bps": 1000000,
 #                     "bps_rd": 0,
Signature · 1 line
2.14.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Stefan Hajnoczi

The block_set_io_throttle command can look up BlockBackends by the attached qdev device ID. virtio-blk-pci is a special case because the actual VirtIOBlock device is the "/virtio-backend" child of the PCI adapter device.

Add a QMP schema example so clients will know how to use block_set_io_throttle on the virtio-blk-pci device.

Quoted 6 lines

The alternative is to implement some sort of aliasing for qmp_get_blk() but that is likely to cause confusion and could break future use cases. Let's not go there.

Berto

author Applied
#2 lore raw
In reply to Stefan Hajnoczi
Quoted 12 lines · Stefan Hajnoczi

The block_set_io_throttle command can look up BlockBackends by the attached qdev device ID. virtio-blk-pci is a special case because the actual VirtIOBlock device is the "/virtio-backend" child of the PCI adapter device.

Add a QMP schema example so clients will know how to use block_set_io_throttle on the virtio-blk-pci device.

The alternative is to implement some sort of aliasing for qmp_get_blk() but that is likely to cause confusion and could break future use cases. Let's not go there.

Quoted 5 lines
---
 qapi/block-core.json | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

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

Stefan