From 47fa65ec7f4f08bcc3bc97df40cee085e2504408 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 7 Aug 2018 15:44:14 +0200 Subject: [PATCH] qemu: Export stats relevant for the storage backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Data relevant for the storage of a backing chain member will need to be reported separately when switching to blockdev. Prepare a function that extracts the appropriate data. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_driver.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8fbc4dd75e..16f8f9ec00 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20111,8 +20111,29 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver, } } + ret = 0; + cleanup: + return ret; +} + + +static int +qemuDomainGetStatsBlockExportBackendStorage(const char *entryname, + virHashTablePtr stats, + size_t recordnr, + virDomainStatsRecordPtr records, + int *nrecords) +{ + qemuBlockStats *entry; + int ret = -1; + + if (!stats || !entryname || !(entry = virHashLookup(stats, entryname))) { + ret = 0; + goto cleanup; + } + if (entry->write_threshold) - QEMU_ADD_BLOCK_PARAM_ULL(record, maxparams, block_idx, "threshold", + QEMU_ADD_BLOCK_PARAM_ULL(records, nrecords, recordnr, "threshold", entry->write_threshold); ret = 0; @@ -20218,6 +20239,11 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk, stats) < 0) goto cleanup; + if (qemuDomainGetStatsBlockExportBackendStorage(alias, + stats, *recordnr, + records, nrecords) < 0) + goto cleanup; + VIR_FREE(alias); (*recordnr)++;