On 11/28/2011 11:24 PM, Adam Litke wrote:
On Wed, Nov 23, 2011 at 10:41:32AM -0700, Eric Blake wrote:
> Hmm - passing nparams==1 to set just read_bytes_sec has the side effect
> of wiping out any existing total_iops_sec, even though those two
> parameters seem somewhat orthogonal, all because we zero-initialized the
> struct that we pass on to the monitor command. Is that intended? I can
> live with it (but it probably ought to be documented), but we may want
> to consider being more flexible, by using '0' to clear a previous limit,
> but initializing to '-1' to imply the limit does not change. Then the
> qemu_monitor_json code should only emit the arguments that are actually
> being changed, rather than blindly always outputting 6 parameters even
> when the user only passed in one parameter. But I'm okay delaying that
> to a separate patch based on whether others think it would be a good
> improvement.
+1. I believe I had pointed this out previously as well (albeit not as
concisely as this).
Well, here is the description of block I/O throttling command
'block_io_set_throttle'
in qmp-commands.hx.
EQMP
{
.name = "block_set_io_throttle",
.args_type =
"device:B,bps:i?,bps_rd:i?,bps_wr:i?,iops:i?,iops_rd:i?,iops_wr:i?",
.params = "device [bps] [bps_rd] [bps_wr] [iops] [iops_rd]
[iops_wr]",
.help = "change I/O throttle limits for a block drive",
.user_print = monitor_user_noop,
.mhandler.cmd_new = do_block_set_io_throttle,
},
SQMP
block_set_io_throttle
------------
Change I/O throttle limits for a block drive.
Arguments:
- "device": device name (json-string)
- "bps": total throughput limit in bytes per second(json-int, optional)
- "bps_rd": read throughput limit in bytes per second(json-int, optional)
- "bps_wr": read throughput limit in bytes per second(json-int, optional)
- "iops": total I/O operations per second(json-int, optional)
- "iops_rd": read I/O operations per second(json-int, optional)
- "iops_wr": write I/O operations per second(json-int, optional)
Example:
-> { "execute": "block_set_io_throttle", "arguments": {
"device": "virtio0",
"bps": "1000000",
"bps_rd": "0",
"bps_wr": "0",
"iops": "0",
"iops_rd": "0",
"iops_wr": "0" } }
<- { "return": {} }
This qmp command need all these 6 parameters at one time in qemu, so
zero-initialized the struct to meet If there is no setting value for
some of the fields.
--
Lei