From nobody Sun Feb 8 19:03:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1533651846683431.7860764895669; Tue, 7 Aug 2018 07:24:06 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 05C1A80F8E; Tue, 7 Aug 2018 14:24:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C579A5F7C4; Tue, 7 Aug 2018 14:24:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 771FD12E3F; Tue, 7 Aug 2018 14:24:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w77ENM6l010520 for ; Tue, 7 Aug 2018 10:23:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 78F122166BA2; Tue, 7 Aug 2018 14:23:22 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16C8C2166BA0 for ; Tue, 7 Aug 2018 14:23:21 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 7 Aug 2018 16:22:38 +0200 Message-Id: <01dcdb123bf8d116de8de501178e684ba01bb83d.1533651617.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 47/55] qemu: Export stats relevant for the frontend separately X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 07 Aug 2018 14:24:05 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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: Peter Krempa --- src/qemu/qemu_driver.c | 54 ++++++++++++++++++++++++++++++++++------------= ---- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4e9be6ed3d..d8a202fa47 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20110,23 +20110,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); @@ -20155,6 +20138,39 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver, } +static int +qemuDomainGetStatsBlockExportFrontend(const char *frontendname, + virHashTablePtr stats, + size_t recordnr, + virDomainStatsRecordPtr records, + int *nrecords) +{ + qemuBlockStats *entry; + int ret =3D -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 sta= ts is + * usually caused by blocked storage so this would make libvirtd hang = */ + if (!stats || !frontendname || !(entry =3D virHashLookup(stats, fronte= ndname))) { + ret =3D 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 =3D 0; + cleanup: + return ret; +} + + static int qemuDomainGetStatsBlockExportHeader(virDomainDiskDefPtr disk, virStorageSourcePtr src, @@ -20209,6 +20225,10 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDef= Ptr 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) --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list