[PATCH 2/2] qemu: blockcopy: Add check for bandwidth

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

 



QEMU code does not work well with too big numbers on the JSON monitor so
our monitor code supports sending only numbers up to LLONG_MAX. Avoid a
weird error message by limiting the size of the 'bandwidth' parameter
for block copy.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1532542

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bbce5bd81b..9e7ac1cfa0 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17218,6 +17218,14 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
         goto cleanup;
     }

+    if (bandwidth > LLONG_MAX) {
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("bandwidth must be less than "
+                         "'%llu' bytes/s (%llu MiB/s)"),
+                       LLONG_MAX, LLONG_MAX >> 20);
+        goto cleanup;
+    }
+
     if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;

-- 
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux