From 32288fc9b94ea24c9a32a638450942cf7dbb71d6 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 9 Mar 2015 15:25:17 +0100 Subject: [PATCH] qemu: monitor: Drop parsing of 'errs' from block info The error count statistic is not supported by qemu, so there's no need to pass the variables around if the result is ignored anyways. --- src/qemu/qemu_driver.c | 11 ++++++----- src/qemu/qemu_monitor.c | 9 +++------ src/qemu/qemu_monitor.h | 3 +-- src/qemu/qemu_monitor_json.c | 6 ++---- src/qemu/qemu_monitor_json.h | 3 +-- src/qemu/qemu_monitor_text.c | 5 ++--- src/qemu/qemu_monitor_text.h | 3 +-- tests/qemumonitorjsontest.c | 19 +++++++++---------- 8 files changed, 25 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e904b7be8f..7ae5c29f88 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10536,6 +10536,9 @@ qemuDomainBlockStats(virDomainPtr dom, priv = vm->privateData; + /* qemu doesn't report the error count */ + stats->errs = -1; + qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetBlockStatsInfo(priv->mon, diskAlias, @@ -10546,8 +10549,7 @@ qemuDomainBlockStats(virDomainPtr dom, &stats->wr_bytes, NULL, NULL, - NULL, - &stats->errs); + NULL); if (qemuDomainObjExitMonitor(driver, vm) < 0) ret = -1; @@ -10574,7 +10576,7 @@ qemuDomainBlockStatsFlags(virDomainPtr dom, virDomainObjPtr vm; qemuDomainObjPrivatePtr priv; long long rd_req, rd_bytes, wr_req, wr_bytes, rd_total_times; - long long wr_total_times, flush_req, flush_total_times, errs; + long long wr_total_times, flush_req, flush_total_times; char *diskAlias = NULL; virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); @@ -10643,8 +10645,7 @@ qemuDomainBlockStatsFlags(virDomainPtr dom, &wr_bytes, &wr_total_times, &flush_req, - &flush_total_times, - &errs); + &flush_total_times); if (qemuDomainObjExitMonitor(driver, vm) < 0) ret = -1; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 94495cd717..24e87b783c 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1817,8 +1817,7 @@ int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon, long long *wr_bytes, long long *wr_total_times, long long *flush_req, - long long *flush_total_times, - long long *errs) + long long *flush_total_times) { int ret; VIR_DEBUG("mon=%p dev=%s", mon, dev_name); @@ -1836,8 +1835,7 @@ int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon, wr_req, wr_bytes, wr_total_times, flush_req, - flush_total_times, - errs); + flush_total_times); else ret = qemuMonitorTextGetBlockStatsInfo(mon, dev_name, rd_req, rd_bytes, @@ -1845,8 +1843,7 @@ int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon, wr_req, wr_bytes, wr_total_times, flush_req, - flush_total_times, - errs); + flush_total_times); return ret; } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 133d42d4bb..72498b339e 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -366,8 +366,7 @@ int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon, long long *wr_bytes, long long *wr_total_times, long long *flush_req, - long long *flush_total_times, - long long *errs); + long long *flush_total_times); typedef struct _qemuBlockStats qemuBlockStats; typedef qemuBlockStats *qemuBlockStatsPtr; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 832f5898b2..612553b007 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1677,15 +1677,14 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon, long long *wr_bytes, long long *wr_total_times, long long *flush_req, - long long *flush_total_times, - long long *errs) + long long *flush_total_times) { qemuBlockStats *stats; virHashTablePtr blockstats = NULL; int ret = -1; *rd_req = *rd_bytes = -1; - *wr_req = *wr_bytes = *errs = -1; + *wr_req = *wr_bytes = -1; if (rd_total_times) *rd_total_times = -1; @@ -1709,7 +1708,6 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon, *rd_bytes = stats->rd_bytes; *wr_req = stats->wr_req; *wr_bytes = stats->wr_bytes; - *errs = -1; /* QEMU does not have this */ if (rd_total_times) *rd_total_times = stats->rd_total_times; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 1da1a007ff..23589cf4f1 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -80,8 +80,7 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon, long long *wr_bytes, long long *wr_total_times, long long *flush_req, - long long *flush_total_times, - long long *errs); + long long *flush_total_times); int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon, virHashTablePtr *ret_stats, bool backingChain); diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 70aeaca369..2de281ff35 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -847,8 +847,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon, long long *wr_bytes, long long *wr_total_times, long long *flush_req, - long long *flush_total_times, - long long *errs) + long long *flush_total_times) { char *info = NULL; int ret = -1; @@ -872,7 +871,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon, } *rd_req = *rd_bytes = -1; - *wr_req = *wr_bytes = *errs = -1; + *wr_req = *wr_bytes = -1; if (rd_total_times) *rd_total_times = -1; diff --git a/src/qemu/qemu_monitor_text.h b/src/qemu/qemu_monitor_text.h index f118a308e6..695ac28a82 100644 --- a/src/qemu/qemu_monitor_text.h +++ b/src/qemu/qemu_monitor_text.h @@ -69,8 +69,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon, long long *wr_bytes, long long *wr_total_times, long long *flush_req, - long long *flush_total_times, - long long *errs); + long long *flush_total_times); int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon, int *nparams); int qemuMonitorTextGetBlockExtent(qemuMonitorPtr mon, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index bd92e631ac..da9cd6cc6a 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1438,7 +1438,7 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data) int ret = -1; long long rd_req, rd_bytes, rd_total_times; long long wr_req, wr_bytes, wr_total_times; - long long flush_req, flush_total_times, errs; + long long flush_req, flush_total_times; int nparams; unsigned long long extent; @@ -1552,7 +1552,7 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data) } #define CHECK(RD_REQ, RD_BYTES, RD_TOTAL_TIMES, WR_REQ, WR_BYTES, WR_TOTAL_TIMES, \ - FLUSH_REQ, FLUSH_TOTAL_TIMES, ERRS) \ + FLUSH_REQ, FLUSH_TOTAL_TIMES) \ CHECK0(rd_req, RD_REQ) \ CHECK0(rd_bytes, RD_BYTES) \ CHECK0(rd_total_times, RD_TOTAL_TIMES) \ @@ -1560,32 +1560,31 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data) CHECK0(wr_bytes, WR_BYTES) \ CHECK0(wr_total_times, WR_TOTAL_TIMES) \ CHECK0(flush_req, FLUSH_REQ) \ - CHECK0(flush_total_times, FLUSH_TOTAL_TIMES) \ - CHECK0(errs, ERRS) + CHECK0(flush_total_times, FLUSH_TOTAL_TIMES) if (qemuMonitorJSONGetBlockStatsInfo(qemuMonitorTestGetMonitor(test), "virtio-disk0", &rd_req, &rd_bytes, &rd_total_times, &wr_req, &wr_bytes, &wr_total_times, - &flush_req, &flush_total_times, &errs) < 0) + &flush_req, &flush_total_times) < 0) goto cleanup; - CHECK(1279, 28505088, 640616474, 174, 2845696, 530699221, 0, 0, -1) + CHECK(1279, 28505088, 640616474, 174, 2845696, 530699221, 0, 0) if (qemuMonitorJSONGetBlockStatsInfo(qemuMonitorTestGetMonitor(test), "virtio-disk1", &rd_req, &rd_bytes, &rd_total_times, &wr_req, &wr_bytes, &wr_total_times, - &flush_req, &flush_total_times, &errs) < 0) + &flush_req, &flush_total_times) < 0) goto cleanup; - CHECK(85, 348160, 8232156, 0, 0, 0, 0, 0, -1) + CHECK(85, 348160, 8232156, 0, 0, 0, 0, 0) if (qemuMonitorJSONGetBlockStatsInfo(qemuMonitorTestGetMonitor(test), "ide0-1-0", &rd_req, &rd_bytes, &rd_total_times, &wr_req, &wr_bytes, &wr_total_times, - &flush_req, &flush_total_times, &errs) < 0) + &flush_req, &flush_total_times) < 0) goto cleanup; - CHECK(16, 49250, 1004952, 0, 0, 0, 0, 0, -1) + CHECK(16, 49250, 1004952, 0, 0, 0, 0, 0) if (qemuMonitorJSONGetBlockStatsParamsNumber(qemuMonitorTestGetMonitor(test), &nparams) < 0) -- GitLab