[libvirt] [PATCH] qemu_monitor: Fix regression in getting disk capacity

Michal Privoznik mprivozn at redhat.com
Thu Jul 26 14:39:54 UTC 2018


In dbf990fd31e8 the qemuMonitorJSONBlockStatsUpdateCapacityOne()
was split. However, due to a bug the return value was never set
to something meaningful.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_monitor_json.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 75d0738b5d..9acf62e0bb 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2492,14 +2492,15 @@ qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONValuePtr image,
         goto cleanup;
 
     if (backingChain &&
-        (backing = virJSONValueObjectGetObject(image, "backing-image"))) {
-        ret = qemuMonitorJSONBlockStatsUpdateCapacityOne(backing,
-                                                         dev_name,
-                                                         depth + 1,
-                                                         stats,
-                                                         true);
-    }
+        (backing = virJSONValueObjectGetObject(image, "backing-image")) &&
+        qemuMonitorJSONBlockStatsUpdateCapacityOne(backing,
+                                                   dev_name,
+                                                   depth + 1,
+                                                   stats,
+                                                   true) < 0)
+        goto cleanup;
 
+    ret = 0;
  cleanup:
     VIR_FREE(entry_name);
     return ret;
-- 
2.16.4




More information about the libvir-list mailing list