As speed is an optional parameter for the QMP block-commit command, it
should be set to 0 if not given (as it is undefined if has_speed is
false), that is, the speed should not be limited.

Signed-off-by: Max Reitz <mre...@redhat.com>
---
 blockdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index b988cc5..9d7bd04 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1876,6 +1876,9 @@ void qmp_block_commit(const char *device,
      */
     BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;
 
+    if (!has_speed) {
+        speed = 0;
+    }
     if (!has_granularity) {
         granularity = 0;
     }
-- 
1.9.1


Reply via email to