On Mon, Aug 13, 2018 at 06:00:35PM +0200, Peter Krempa wrote:
Add code paths which call into the new functions to gather the data on a per-node-name basis and tweak the aliases used for extracting the data. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 54 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 16 deletions(-) @@ -20265,17 +20279,17 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk, /* The following stats make sense only for the frontend device */ if (n == disk->src) { - if (qemuDomainGetStatsBlockExportFrontend(alias, stats, *recordnr, + if (qemuDomainGetStatsBlockExportFrontend(frontendalias, stats, *recordnr, records, nrecords) < 0) goto cleanup; } if (qemuDomainGetStatsOneBlock(driver, cfg, dom, records, nrecords, - alias, n, *recordnr, + backendalias, n, *recordnr, stats) < 0) goto cleanup; - if (qemuDomainGetStatsBlockExportBackendStorage(alias, + if (qemuDomainGetStatsBlockExportBackendStorage(backendstoragealias, stats, *recordnr, records, nrecords) < 0) goto cleanup; @@ -20310,19 +20324,26 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver, virJSONValuePtr nodedata = NULL; qemuDomainObjPrivatePtr priv = dom->privateData; virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); + bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); bool fetchnodedata = virQEMUCapsGet(priv->qemuCaps, - QEMU_CAPS_QUERY_NAMED_BLOCK_NODES); + QEMU_CAPS_QUERY_NAMED_BLOCK_NODES) && !blockdev; int count_index = -1; size_t visited = 0; bool visitBacking = !!(privflags & QEMU_DOMAIN_STATS_BACKING); if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) { qemuDomainObjEnterMonitor(driver, dom); - rc = qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats, - visitBacking); - if (rc >= 0) - ignore_value(qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, - visitBacking)); + + rc = qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats, visitBacking); + + if (blockdev) { + if (rc >= 0) + rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, stats); + } else { + if (rc >= 0) + ignore_value(qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, + visitBacking)); + }
less reading as: if (rc >= 0) { if (blockdev) f() else F() } Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> Jano
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list