[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/2] BlockPull: Set bandwidth limit when using text monitor



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);
-- 
1.7.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]