]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
fix key error for qemuMonitorGetBlockStatsInfo
authorlvroyce <lvroyce@linux.vnet.ibm.com>
Thu, 21 Jun 2012 07:37:13 +0000 (15:37 +0800)
committerCole Robinson <crobinso@redhat.com>
Sun, 12 Aug 2012 23:22:51 +0000 (19:22 -0400)
virDomainBlockStatsFlags can't collect total_time_ns for read/write/flush
because of key typo when retriveing from qemu cmd result

Signed-off-by: lvroyce <lvroyce@linux.vnet.ibm.com>
(cherry picked from commit 811cea18f34485cf524639b1527887750da777ca)

src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_text.c

index d09d7793ff82059b2906c5a83fd1a073d3ac6ea7..4bb09d9b461b5cf01b33215705f7953cab275f14 100644 (file)
@@ -1662,12 +1662,12 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
             goto cleanup;
         }
         if (rd_total_times &&
-            virJSONValueObjectHasKey(stats, "rd_total_times_ns") &&
-            (virJSONValueObjectGetNumberLong(stats, "rd_total_times_ns",
+            virJSONValueObjectHasKey(stats, "rd_total_time_ns") &&
+            (virJSONValueObjectGetNumberLong(stats, "rd_total_time_ns",
                                              rd_total_times) < 0)) {
             qemuReportError(VIR_ERR_INTERNAL_ERROR,
                             _("cannot read %s statistic"),
-                            "rd_total_times_ns");
+                            "rd_total_time_ns");
             goto cleanup;
         }
         if (virJSONValueObjectGetNumberLong(stats, "wr_bytes", wr_bytes) < 0) {
@@ -1683,12 +1683,12 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
             goto cleanup;
         }
         if (wr_total_times &&
-            virJSONValueObjectHasKey(stats, "wr_total_times_ns") &&
-            (virJSONValueObjectGetNumberLong(stats, "wr_total_times_ns",
+            virJSONValueObjectHasKey(stats, "wr_total_time_ns") &&
+            (virJSONValueObjectGetNumberLong(stats, "wr_total_time_ns",
                                              wr_total_times) < 0)) {
             qemuReportError(VIR_ERR_INTERNAL_ERROR,
                             _("cannot read %s statistic"),
-                            "wr_total_times_ns");
+                            "wr_total_time_ns");
             goto cleanup;
         }
         if (flush_req &&
@@ -1701,12 +1701,12 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
             goto cleanup;
         }
         if (flush_total_times &&
-            virJSONValueObjectHasKey(stats, "flush_total_times_ns") &&
-            (virJSONValueObjectGetNumberLong(stats, "flush_total_times_ns",
+            virJSONValueObjectHasKey(stats, "flush_total_time_ns") &&
+            (virJSONValueObjectGetNumberLong(stats, "flush_total_time_ns",
                                             flush_total_times) < 0)) {
             qemuReportError(VIR_ERR_INTERNAL_ERROR,
                             _("cannot read %s statistic"),
-                            "flush_total_times_ns");
+                            "flush_total_time_ns");
             goto cleanup;
         }
     }
@@ -1774,12 +1774,12 @@ int qemuMonitorJSONGetBlockStatsParamsNumber(qemuMonitorPtr mon,
 
         if (STREQ(key, "rd_bytes") ||
             STREQ(key, "rd_operations") ||
-            STREQ(key, "rd_total_times_ns") ||
+            STREQ(key, "rd_total_time_ns") ||
             STREQ(key, "wr_bytes") ||
             STREQ(key, "wr_operations") ||
-            STREQ(key, "wr_total_times_ns") ||
+            STREQ(key, "wr_total_time_ns") ||
             STREQ(key, "flush_operations") ||
-            STREQ(key, "flush_total_times_ns")) {
+            STREQ(key, "flush_total_time_ns")) {
             num++;
         } else {
             /* wr_highest_offset is parsed by qemuMonitorJSONGetBlockExtent. */
index 9e2991bb0f4e9c5b0febebd0206afed6174789e8..ddc86ef647a00578988a7a3f4abf33dbb9b43053 100644 (file)
@@ -973,13 +973,13 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
                     if (virStrToLong_ll (p, &dummy, 10, wr_req) == -1)
                         VIR_DEBUG ("error reading wr_req: %s", p);
                 } else if (rd_total_times &&
-                           STRPREFIX (p, "rd_total_times_ns=")) {
-                    p += strlen("rd_total_times_ns=");
+                           STRPREFIX (p, "rd_total_time_ns=")) {
+                    p += strlen("rd_total_time_ns=");
                     if (virStrToLong_ll (p, &dummy, 10, rd_total_times) == -1)
                         VIR_DEBUG ("error reading rd_total_times: %s", p);
                 } else if (wr_total_times &&
-                           STRPREFIX (p, "wr_total_times_ns=")) {
-                    p += strlen("wr_total_times_ns=");
+                           STRPREFIX (p, "wr_total_time_ns=")) {
+                    p += strlen("wr_total_time_ns=");
                     if (virStrToLong_ll (p, &dummy, 10, wr_total_times) == -1)
                         VIR_DEBUG ("error reading wr_total_times: %s", p);
                 } else if (flush_req &&
@@ -988,8 +988,8 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
                     if (virStrToLong_ll (p, &dummy, 10, flush_req) == -1)
                         VIR_DEBUG ("error reading flush_req: %s", p);
                 } else if (flush_total_times &&
-                           STRPREFIX (p, "flush_total_times_ns=")) {
-                    p += strlen("flush_total_times_ns=");
+                           STRPREFIX (p, "flush_total_time_ns=")) {
+                    p += strlen("flush_total_time_ns=");
                     if (virStrToLong_ll (p, &dummy, 10, flush_total_times) == -1)
                         VIR_DEBUG ("error reading flush_total_times: %s", p);
                 } else {
@@ -1067,10 +1067,10 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
             STRPREFIX (p, " wr_bytes=") ||
             STRPREFIX (p, " rd_operations=") ||
             STRPREFIX (p, " wr_operations=") ||
-            STRPREFIX (p, " rd_total_times_ns=") ||
-            STRPREFIX (p, " wr_total_times_ns=") ||
+            STRPREFIX (p, " rd_total_time_ns=") ||
+            STRPREFIX (p, " wr_total_time_ns=") ||
             STRPREFIX (p, " flush_operations=") ||
-            STRPREFIX (p, " flush_total_times_ns=")) {
+            STRPREFIX (p, " flush_total_time_ns=")) {
             num++;
         } else {
             VIR_DEBUG ("unknown block stat near %s", p);