This patch adds the reporting of the highest
block stats written to the block stats.

This information was already there since the
beginning, and doing so we gain the information
provided by GetBlockInfo without entering the
monitor again.

Signed-off-by: Francesco Romani <from...@redhat.com>
---
 src/qemu/qemu_monitor.h      | 1 +
 src/qemu/qemu_monitor_json.c | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 1b7d00b..8e16c7d 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -357,6 +357,7 @@ struct qemuBlockStats {
     long long flush_req;
     long long flush_total_times;
     long long errs; /* meaningless for QEMU */
+    unsigned long long wr_highest_offset;
 };
 
 int qemuMonitorGetAllBlockStatsInfo(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 68c5cf8..31ffb6c 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1880,6 +1880,13 @@ int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr 
mon,
                            "flush_total_time_ns");
             goto cleanup;
         }
+        if (virJSONValueObjectGetNumberUlong(stats, "wr_highest_offset", 
&blockstats->wr_highest_offset) < 0) {
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("cannot read %s statistic"),
+                           "wr_highest_offset");
+            goto cleanup;
+        }
+
         blockstats->errs = -1; /* meaningless for QEMU */
 
         ret++;
-- 
1.9.3

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

Reply via email to