提交 8bb3924f 编写于 作者: P Peter Krempa

qemu: Export stats relevant for the frontend separately

While we report the read and written byte stats for every single layer
of the backing chain, qemu in fact reports them only for the frontend.

Split out the relevant stats into a separate function so that we can
later fix this bug and stop reporting it for backing chain entries where
they don't make sense.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 6fd50ba7
......@@ -20093,23 +20093,6 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
goto cleanup;
}
QEMU_ADD_BLOCK_PARAM_LL(record, maxparams, block_idx,
"rd.reqs", entry->rd_req);
QEMU_ADD_BLOCK_PARAM_LL(record, maxparams, block_idx,
"rd.bytes", entry->rd_bytes);
QEMU_ADD_BLOCK_PARAM_LL(record, maxparams, block_idx,
"rd.times", entry->rd_total_times);
QEMU_ADD_BLOCK_PARAM_LL(record, maxparams, block_idx,
"wr.reqs", entry->wr_req);
QEMU_ADD_BLOCK_PARAM_LL(record, maxparams, block_idx,
"wr.bytes", entry->wr_bytes);
QEMU_ADD_BLOCK_PARAM_LL(record, maxparams, block_idx,
"wr.times", entry->wr_total_times);
QEMU_ADD_BLOCK_PARAM_LL(record, maxparams, block_idx,
"fl.reqs", entry->flush_req);
QEMU_ADD_BLOCK_PARAM_LL(record, maxparams, block_idx,
"fl.times", entry->flush_total_times);
QEMU_ADD_BLOCK_PARAM_ULL(record, maxparams, block_idx,
"allocation", entry->wr_highest_offset);
......@@ -20138,6 +20121,39 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
}
static int
qemuDomainGetStatsBlockExportFrontend(const char *frontendname,
virHashTablePtr stats,
size_t recordnr,
virDomainStatsRecordPtr records,
int *nrecords)
{
qemuBlockStats *entry;
int ret = -1;
/* In case where qemu didn't provide the stats we stop here rather than
* trying to refresh the stats from the disk. Inability to provide stats is
* usually caused by blocked storage so this would make libvirtd hang */
if (!stats || !frontendname || !(entry = virHashLookup(stats, frontendname))) {
ret = 0;
goto cleanup;
}
QEMU_ADD_BLOCK_PARAM_LL(records, nrecords, recordnr, "rd.reqs", entry->rd_req);
QEMU_ADD_BLOCK_PARAM_LL(records, nrecords, recordnr, "rd.bytes", entry->rd_bytes);
QEMU_ADD_BLOCK_PARAM_LL(records, nrecords, recordnr, "rd.times", entry->rd_total_times);
QEMU_ADD_BLOCK_PARAM_LL(records, nrecords, recordnr, "wr.reqs", entry->wr_req);
QEMU_ADD_BLOCK_PARAM_LL(records, nrecords, recordnr, "wr.bytes", entry->wr_bytes);
QEMU_ADD_BLOCK_PARAM_LL(records, nrecords, recordnr, "wr.times", entry->wr_total_times);
QEMU_ADD_BLOCK_PARAM_LL(records, nrecords, recordnr, "fl.reqs", entry->flush_req);
QEMU_ADD_BLOCK_PARAM_LL(records, nrecords, recordnr, "fl.times", entry->flush_total_times);
ret = 0;
cleanup:
return ret;
}
static int
qemuDomainGetStatsBlockExportHeader(virDomainDiskDefPtr disk,
virStorageSourcePtr src,
......@@ -20192,6 +20208,10 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk,
records, nrecords) < 0)
goto cleanup;
if (qemuDomainGetStatsBlockExportFrontend(alias, stats, *recordnr,
records, nrecords) < 0)
goto cleanup;
if (qemuDomainGetStatsOneBlock(driver, cfg, dom, records, nrecords,
alias, src, *recordnr,
stats) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册