提交 811cea18 编写于 作者: L lvroyce 提交者: Osier Yang

fix key error for qemuMonitorGetBlockStatsInfo

virDomainBlockStatsFlags can't collect total_time_ns for read/write/flush
because of key typo when retriveing from qemu cmd result
Signed-off-by: Nlvroyce <lvroyce@linux.vnet.ibm.com>
上级 3a4d9d1e
...@@ -1709,12 +1709,12 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon, ...@@ -1709,12 +1709,12 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
goto cleanup; goto cleanup;
} }
if (rd_total_times && if (rd_total_times &&
virJSONValueObjectHasKey(stats, "rd_total_times_ns") && virJSONValueObjectHasKey(stats, "rd_total_time_ns") &&
(virJSONValueObjectGetNumberLong(stats, "rd_total_times_ns", (virJSONValueObjectGetNumberLong(stats, "rd_total_time_ns",
rd_total_times) < 0)) { rd_total_times) < 0)) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot read %s statistic"), _("cannot read %s statistic"),
"rd_total_times_ns"); "rd_total_time_ns");
goto cleanup; goto cleanup;
} }
if (virJSONValueObjectGetNumberLong(stats, "wr_bytes", wr_bytes) < 0) { if (virJSONValueObjectGetNumberLong(stats, "wr_bytes", wr_bytes) < 0) {
...@@ -1730,12 +1730,12 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon, ...@@ -1730,12 +1730,12 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
goto cleanup; goto cleanup;
} }
if (wr_total_times && if (wr_total_times &&
virJSONValueObjectHasKey(stats, "wr_total_times_ns") && virJSONValueObjectHasKey(stats, "wr_total_time_ns") &&
(virJSONValueObjectGetNumberLong(stats, "wr_total_times_ns", (virJSONValueObjectGetNumberLong(stats, "wr_total_time_ns",
wr_total_times) < 0)) { wr_total_times) < 0)) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot read %s statistic"), _("cannot read %s statistic"),
"wr_total_times_ns"); "wr_total_time_ns");
goto cleanup; goto cleanup;
} }
if (flush_req && if (flush_req &&
...@@ -1748,12 +1748,12 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon, ...@@ -1748,12 +1748,12 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
goto cleanup; goto cleanup;
} }
if (flush_total_times && if (flush_total_times &&
virJSONValueObjectHasKey(stats, "flush_total_times_ns") && virJSONValueObjectHasKey(stats, "flush_total_time_ns") &&
(virJSONValueObjectGetNumberLong(stats, "flush_total_times_ns", (virJSONValueObjectGetNumberLong(stats, "flush_total_time_ns",
flush_total_times) < 0)) { flush_total_times) < 0)) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot read %s statistic"), _("cannot read %s statistic"),
"flush_total_times_ns"); "flush_total_time_ns");
goto cleanup; goto cleanup;
} }
} }
...@@ -1821,12 +1821,12 @@ int qemuMonitorJSONGetBlockStatsParamsNumber(qemuMonitorPtr mon, ...@@ -1821,12 +1821,12 @@ int qemuMonitorJSONGetBlockStatsParamsNumber(qemuMonitorPtr mon,
if (STREQ(key, "rd_bytes") || if (STREQ(key, "rd_bytes") ||
STREQ(key, "rd_operations") || STREQ(key, "rd_operations") ||
STREQ(key, "rd_total_times_ns") || STREQ(key, "rd_total_time_ns") ||
STREQ(key, "wr_bytes") || STREQ(key, "wr_bytes") ||
STREQ(key, "wr_operations") || STREQ(key, "wr_operations") ||
STREQ(key, "wr_total_times_ns") || STREQ(key, "wr_total_time_ns") ||
STREQ(key, "flush_operations") || STREQ(key, "flush_operations") ||
STREQ(key, "flush_total_times_ns")) { STREQ(key, "flush_total_time_ns")) {
num++; num++;
} else { } else {
/* wr_highest_offset is parsed by qemuMonitorJSONGetBlockExtent. */ /* wr_highest_offset is parsed by qemuMonitorJSONGetBlockExtent. */
......
...@@ -977,13 +977,13 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon, ...@@ -977,13 +977,13 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
if (virStrToLong_ll (p, &dummy, 10, wr_req) == -1) if (virStrToLong_ll (p, &dummy, 10, wr_req) == -1)
VIR_DEBUG ("error reading wr_req: %s", p); VIR_DEBUG ("error reading wr_req: %s", p);
} else if (rd_total_times && } else if (rd_total_times &&
STRPREFIX (p, "rd_total_times_ns=")) { STRPREFIX (p, "rd_total_time_ns=")) {
p += strlen("rd_total_times_ns="); p += strlen("rd_total_time_ns=");
if (virStrToLong_ll (p, &dummy, 10, rd_total_times) == -1) if (virStrToLong_ll (p, &dummy, 10, rd_total_times) == -1)
VIR_DEBUG ("error reading rd_total_times: %s", p); VIR_DEBUG ("error reading rd_total_times: %s", p);
} else if (wr_total_times && } else if (wr_total_times &&
STRPREFIX (p, "wr_total_times_ns=")) { STRPREFIX (p, "wr_total_time_ns=")) {
p += strlen("wr_total_times_ns="); p += strlen("wr_total_time_ns=");
if (virStrToLong_ll (p, &dummy, 10, wr_total_times) == -1) if (virStrToLong_ll (p, &dummy, 10, wr_total_times) == -1)
VIR_DEBUG ("error reading wr_total_times: %s", p); VIR_DEBUG ("error reading wr_total_times: %s", p);
} else if (flush_req && } else if (flush_req &&
...@@ -992,8 +992,8 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon, ...@@ -992,8 +992,8 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
if (virStrToLong_ll (p, &dummy, 10, flush_req) == -1) if (virStrToLong_ll (p, &dummy, 10, flush_req) == -1)
VIR_DEBUG ("error reading flush_req: %s", p); VIR_DEBUG ("error reading flush_req: %s", p);
} else if (flush_total_times && } else if (flush_total_times &&
STRPREFIX (p, "flush_total_times_ns=")) { STRPREFIX (p, "flush_total_time_ns=")) {
p += strlen("flush_total_times_ns="); p += strlen("flush_total_time_ns=");
if (virStrToLong_ll (p, &dummy, 10, flush_total_times) == -1) if (virStrToLong_ll (p, &dummy, 10, flush_total_times) == -1)
VIR_DEBUG ("error reading flush_total_times: %s", p); VIR_DEBUG ("error reading flush_total_times: %s", p);
} else { } else {
...@@ -1071,10 +1071,10 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon, ...@@ -1071,10 +1071,10 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
STRPREFIX (p, " wr_bytes=") || STRPREFIX (p, " wr_bytes=") ||
STRPREFIX (p, " rd_operations=") || STRPREFIX (p, " rd_operations=") ||
STRPREFIX (p, " wr_operations=") || STRPREFIX (p, " wr_operations=") ||
STRPREFIX (p, " rd_total_times_ns=") || STRPREFIX (p, " rd_total_time_ns=") ||
STRPREFIX (p, " wr_total_times_ns=") || STRPREFIX (p, " wr_total_time_ns=") ||
STRPREFIX (p, " flush_operations=") || STRPREFIX (p, " flush_operations=") ||
STRPREFIX (p, " flush_total_times_ns=")) { STRPREFIX (p, " flush_total_time_ns=")) {
num++; num++;
} else { } else {
VIR_DEBUG ("unknown block stat near %s", p); VIR_DEBUG ("unknown block stat near %s", p);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册