
On Wed, Aug 31, 2011 at 05:15:44PM -0500, Adam Litke wrote:
The libvirt BlockPull API supports the use of an initial bandwidth limit. To implement this in the text monitor we first start the operation with a 'block_stream' command and then issue a 'block_job_set_speed' command to apply the limit.
This functionality is already present for json mode.
Signed-off-by: Adam Litke <agl@us.ibm.com> --- src/qemu/qemu_monitor_text.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 854ee7f..2159209 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -3096,6 +3096,11 @@ int qemuMonitorTextBlockJob(qemuMonitorPtr mon,
ret = qemuMonitorTextParseBlockJob(reply, device, info);
+ /* If non-zero, set the bandwidth limit with a separate command */ + if (ret == 0 && mode == BLOCK_JOB_PULL && bandwidth != 0) + ret = qemuMonitorTextBlockJob(mon, device, bandwidth, info, + BLOCK_JOB_SPEED); + cleanup: VIR_FREE(cmd); VIR_FREE(reply);
Since it needs to be done for both json & text monitor, could we push this chunk of code up one level into qemu_monitor.c, thus avoiding the duplication ? Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|