From nobody Mon Apr 29 09:12:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634654772; cv=none; d=zohomail.com; s=zohoarc; b=mRFQ+mNdrHnDP4xBvlWYP1NTcFboKJh3u111xiDo1B4VqLke3QT9hNRoZqZRhK/rCWni84EPCldAAZknhWFuVVOPj5Rcc35rNfJB299tA0IlLX2Am+TM5f4iabSxbXgHCs6SSFqHrlT+1CjE/71bq7/dQsIU6IKk8C48T6vxDKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634654772; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jEHn1twcTPkOYV8DNLgEPlSrb23gJMhRSvDOJkOo4j4=; b=iepuNpK7crxXIGWppQoM2ZnHvDVgL+UdJEw2JFM2q6N5fN3sIC0Nv5wyWvoDF+JI1rVSPO6zUTVxjutHrfa/0sZPvwV4AxdNg5iq2sQi+r44TsmPZ6Ej8T3dALvtSnOimSuvePgaRfPklbv5gHqB7yStZzQd1A/VaeGP750znPM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 163465477272250.288257207155425; Tue, 19 Oct 2021 07:46:12 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-507-wObWWUiNNDyJTpMtirpqAw-1; Tue, 19 Oct 2021 10:44:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4D5A9101F7A5; Tue, 19 Oct 2021 14:44:07 +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 306225B826; Tue, 19 Oct 2021 14:44:07 +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 E84214EA2F; Tue, 19 Oct 2021 14:44:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19JEhIBC031675 for ; Tue, 19 Oct 2021 10:43:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E19019D9F; Tue, 19 Oct 2021 14:43:18 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83F6619C79 for ; Tue, 19 Oct 2021 14:43:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654771; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jEHn1twcTPkOYV8DNLgEPlSrb23gJMhRSvDOJkOo4j4=; b=SIhi/7+01eZ2kB/jx+k0GVuq2kzUc6Ml63ZAfdwbwZcHmKFHsDpUslibK5G7wjKXk9RLQQ qbfZ71UrO0xqx1a6YZjh+xPCQX4V4W+SgjU2Ts8YNtkDAFndkbbZi3xsnbjbgN4m0be8z8 kiG4P6YbaLuIw7zxNkE8XLBrJN436Sw= X-MC-Unique: wObWWUiNNDyJTpMtirpqAw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/8] qemuDomainBlocksStatsGather: Always fetch stats for the full backing chain Date: Tue, 19 Oct 2021 16:43:08 +0200 Message-Id: <175565673560b041a0f8ffaf58b70f4d393394e7.1634654476.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634654773420100001 Content-Type: text/plain; charset="utf-8" In certain cases such as when running a backup blockjob qemu installs a filter node between the frontend and the top node of the backend of the disk. The stats gathering code didn't instruct the monitor code to fetch the stats for all the layers, so since the top layer now doesn't have stats we were reporting wrong stats such as allocation. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2015281 Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b9cc8f8379..34da87e330 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10051,13 +10051,13 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, } qemuDomainObjEnterMonitor(driver, vm); - nstats =3D qemuMonitorGetAllBlockStatsInfo(priv->mon, &blockstats, fal= se); + nstats =3D qemuMonitorGetAllBlockStatsInfo(priv->mon, &blockstats, tru= e); if (capacity && nstats >=3D 0) { if (blockdev) rc =3D qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, = blockstats); else - rc =3D qemuMonitorBlockStatsUpdateCapacity(priv->mon, blocksta= ts, false); + rc =3D qemuMonitorBlockStatsUpdateCapacity(priv->mon, blocksta= ts, true); } if (qemuDomainObjExitMonitor(driver, vm) < 0 || nstats < 0 || rc < 0) --=20 2.31.1 From nobody Mon Apr 29 09:12:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634654659; cv=none; d=zohomail.com; s=zohoarc; b=Ae26YL9TUX6w0sQp6yfXasoQKlNLe4mneD07fJ2vW2WbF8QxpQXEmoL2SrAQw3fKgId/RZiGKQZRjxMNWp2XFSkQF6rJg8msW8kYj/RcsytQF5EvQZCvcFnXuz/CKplxNpFos4GGz5XvP33vNTaavai83A3TPui8h3kn7QN61DY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634654659; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WdWOHqe0JojnVLwQIX2tSI85j1ubFOzsbcv0bdjFvdo=; b=kzfgWL7LmleXLJS2Np9BPz4D8c/iFhRS0ghn1cudPy//TGtykazKDTRtHhfiZnzGAX5K0FciRHIMjzaILVXnC3XieBhQaWyfLWsM569evFGFUpCJ2sCzlHfnlrPy411Mwf72zA5SoGB2m9fk8R/dDz0Ap2OXn/D2Xd6tHlNpU4U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634654659320398.7843499732046; Tue, 19 Oct 2021 07:44:19 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-487-lOaeRhLSMJujJWIU3djfzg-1; Tue, 19 Oct 2021 10:44:15 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 60E2C80F041; Tue, 19 Oct 2021 14:44:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DEB219723; Tue, 19 Oct 2021 14:44:10 +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 0812A181A1D0; Tue, 19 Oct 2021 14:44:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19JEhJSR031686 for ; Tue, 19 Oct 2021 10:43:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2E18519D9F; Tue, 19 Oct 2021 14:43:19 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8AA4919C79 for ; Tue, 19 Oct 2021 14:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654658; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=WdWOHqe0JojnVLwQIX2tSI85j1ubFOzsbcv0bdjFvdo=; b=E1mIZ8Pp6lI40QQYDXadDZ78AUoJp7GK5lDnpEiyeHI8mscmdZ8V9IBUWw4oQ85cyK9IPg eah5gbgjTj/UsAsTEB7HhG9QNRpTuUSlvGnm0jNgKOW8ZvbaEs7oF7+VserkR20+8q9zGa i1LVY2DwzSHp3AFZN7PKICw1jyL+anE= X-MC-Unique: lOaeRhLSMJujJWIU3djfzg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/8] qemuDomainGetStatsBlock: Always fetch stats for the full backing chain Date: Tue, 19 Oct 2021 16:43:09 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634654659778100005 Content-Type: text/plain; charset="utf-8" Similarly to the fix to 'qemuDomainBlocksStatsGather' we should be always fetching the full backing chain so that we can avoid any automatic filter notes which would prevent us from fetching the stats for the correct nodename. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 34da87e330..b46ee01d31 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18478,14 +18478,14 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) { qemuDomainObjEnterMonitor(driver, dom); - rc =3D qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats, visitBac= king); + rc =3D qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats, true); if (rc >=3D 0) { if (blockdev) rc =3D qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->m= on, stats); else ignore_value(qemuMonitorBlockStatsUpdateCapacity(priv->mon= , stats, - visitBack= ing)); + true)); } if (fetchnodedata) --=20 2.31.1 From nobody Mon Apr 29 09:12:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634654769; cv=none; d=zohomail.com; s=zohoarc; b=OLKVAAHxY+1PhgEcOU4KYsMHk3f9YvlcX0EQsSNzFSAlvHYnKOK5rlM3KxD3G90Jd7tJXSgZTvSNIto7LBIkA4Y4z/DDDs38trb9J2KVqUj59I7yP6WPSpxldKkW9Q59pPuTH0rWMmCP4ea9cr78I8UNyAJCpZdOU9mxDJ8U+aY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634654769; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nLusOQE1Vz0M79MxEMChn4PK1bLn50rvXJoqp3L+oWY=; b=XleppzpBn/1e/9HsEmxq3BWyxXdldvuC+RI+iv2C9In+CUnhtpzJIM7iTkkhAUJHUvBzymmPRhGyfBx9k6J/tdMWXtxrA/W5C8OeXz3swiw07xLWiYkkppFDdYuSinOpPaMbkLshDd4f7OcJ4awwBsmFvbCPgOV7WlG/IYfL9vg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 16346547696891015.5279240621659; Tue, 19 Oct 2021 07:46:09 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-0xognFbjNESYXMZF_Q1s_Q-1; Tue, 19 Oct 2021 10:44:18 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7CA8E180831B; Tue, 19 Oct 2021 14:44:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C7451017CE7; Tue, 19 Oct 2021 14:44:13 +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 1A4F81832DD5; Tue, 19 Oct 2021 14:44:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19JEhKak031698 for ; Tue, 19 Oct 2021 10:43:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42C571972E; Tue, 19 Oct 2021 14:43:20 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CFAE19C79 for ; Tue, 19 Oct 2021 14:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654768; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nLusOQE1Vz0M79MxEMChn4PK1bLn50rvXJoqp3L+oWY=; b=WJSdIn1SwWldvSrzhttqzZw8/J921HDljq7zjW3iI+C9sLznaq1Gq8pzEuCcqfVGxzz62S vHmiHPX74DVoynBTOIVH/fMLXQ1ueOufs+DpbBq/O0yiZJOZftZpji0jEh87EEuKTeeKpK WEKLj2xeaa5oGQQT3H6dYIANO243qt0= X-MC-Unique: 0xognFbjNESYXMZF_Q1s_Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/8] qemuMonitorJSONBlockStatsUpdateCapacity: Refactor cleanup Date: Tue, 19 Oct 2021 16:43:10 +0200 Message-Id: <0f6ceb7b02b3267b1ced83e8fe8111c388643095.1634654476.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634654770441100002 Content-Type: text/plain; charset="utf-8" Use automatic memory clearing for the temporary variable and remove the cleanup section. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor_json.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 579d986e02..af6e918e06 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2660,9 +2660,8 @@ qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *= mon, GHashTable *stats, bool backingChain) { - int ret =3D -1; size_t i; - virJSONValue *devices; + g_autoptr(virJSONValue) devices =3D NULL; if (!(devices =3D qemuMonitorJSONQueryBlock(mon))) return -1; @@ -2674,10 +2673,10 @@ qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor= *mon, const char *dev_name; if (!(dev =3D qemuMonitorJSONGetBlockDev(devices, i))) - goto cleanup; + return -1; if (!(dev_name =3D qemuMonitorJSONGetBlockDevDevice(dev))) - goto cleanup; + return -1; /* drive may be empty */ if (!(inserted =3D virJSONValueObjectGetObject(dev, "inserted")) || @@ -2687,14 +2686,10 @@ qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor= *mon, if (qemuMonitorJSONBlockStatsUpdateCapacityOne(image, dev_name, 0, stats, backingChain) < 0) - goto cleanup; + return -1; } - ret =3D 0; - - cleanup: - virJSONValueFree(devices); - return ret; + return 0; } --=20 2.31.1 From nobody Mon Apr 29 09:12:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634654666; cv=none; d=zohomail.com; s=zohoarc; b=PU1ITXGmVnuX4T+FYg9uI5DTwC90CCthSWzswtLbBQ8aOkbfb1/BdmyhFNC8iexB6MB1vjVohh37V63jHlRTlUs4JV2D8fK1t04CCE0AdDvg/R9L6D5VWzI7KpBwR7xqQyHj8RkpsGb1aasYhcRPgv8jcKafKylrh5bb6MH4Mm0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634654666; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+VCWmB4N8ccQOqN/Z563hMHmp0TsiN5wAXhF7TJPHpA=; b=bg0d7BxYXZxzb7PENfdN3Pm+ZvoCwadKQpkaDwNnUDFLyzST4/IZgDDKzceYrY+wmUfzgNz6J+aEECrdsnoWFHHqfN7AL4VwG7I2nwDFoiTgGitjiPdmBWD2U+bZm8PDiY+6gI+yB86nGpEYtpbf/swOyjh+979jx6a1u/6PxE8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16346546664329.975604971387497; Tue, 19 Oct 2021 07:44:26 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-518-HF2UD7Z6PCWvWiIWLnl7bw-1; Tue, 19 Oct 2021 10:44:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 80C7B1808321; Tue, 19 Oct 2021 14:44:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 62C5E18A8F; Tue, 19 Oct 2021 14:44:16 +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 2DBD01832DD8; Tue, 19 Oct 2021 14:44:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19JEhLws031705 for ; Tue, 19 Oct 2021 10:43:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 520D819D9F; Tue, 19 Oct 2021 14:43:21 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5D0019C79 for ; Tue, 19 Oct 2021 14:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654665; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+VCWmB4N8ccQOqN/Z563hMHmp0TsiN5wAXhF7TJPHpA=; b=X3M2rbXmOVHe/OMsUFuLiL97kRf+/+OcK4xoOti/GdyHqNZ0gjT6Ad45nT0DxF2o8x8bzi IsfxiJ5ZmS+BgcDQb1XtRWYifpELvX4L6FmjfQS3D7AMB8dnN3hDJPVq+SigPKJNySvSj1 CRbim1HrOG2moA+NikXPcxNYoE2ushk= X-MC-Unique: HF2UD7Z6PCWvWiIWLnl7bw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/8] qemuMonitorJSONBlockStatsUpdateCapacityOne: Refactor cleanup Date: Tue, 19 Oct 2021 16:43:11 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634654667245100001 Content-Type: text/plain; charset="utf-8" Use automatic memory clearing for the temporary variable and remove the cleanup section. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor_json.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index af6e918e06..e4f4dba79a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2631,13 +2631,12 @@ qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONV= alue *image, GHashTable *stats, bool backingChain) { - int ret =3D -1; - char *entry_name =3D qemuDomainStorageAlias(dev_name, depth); + g_autofree char *entry_name =3D qemuDomainStorageAlias(dev_name, depth= ); virJSONValue *backing; if (qemuMonitorJSONBlockStatsUpdateCapacityData(image, entry_name, stats, NULL) < 0) - goto cleanup; + return -1; if (backingChain && (backing =3D virJSONValueObjectGetObject(image, "backing-image")) = && @@ -2646,12 +2645,9 @@ qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONVa= lue *image, depth + 1, stats, true) < 0) - goto cleanup; + return -1; - ret =3D 0; - cleanup: - VIR_FREE(entry_name); - return ret; + return 0; } --=20 2.31.1 From nobody Mon Apr 29 09:12:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634654673; cv=none; d=zohomail.com; s=zohoarc; b=EyTwRUL5/TZF0lUY93tfqRqSc5Z+rERQqjlcNd51y/JQiYuFrBPF3AjumwYqqoiamkv3uLwJ55sOjHQtKp8GCNcJQmWeUr2T0MhpuqZ70wvxdnzKh6+P9svgcuu510Hrjaz21DYSfEVTCJKrw72cnwVjpxlG/OIe6EV1NZaDWHw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634654673; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JyqH1C5h63EfXjwV2gR2Qq3nGU7A9P1T2fwMHX56aUw=; b=fVIiPldIvZ39r7+MyqK9+Z6l7/S8bJH6tW4yGfHu3GLGJF68oqK3hy3dPlEXOuG/JUUxB/1XNhSLGu7WruSCRSmTSE/jjn4RJ9IM8Gn3hcASNM+ploZtix53aD2VvytpRwuBoKQGaiYKo+VQlkvETk9eeIVPmsc/RufbcgPeFfo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634654673843249.07981168304764; Tue, 19 Oct 2021 07:44:33 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459--d_ZkTjnNVqf3zZYoTHZZw-1; Tue, 19 Oct 2021 10:44:29 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1A47E801FCE; Tue, 19 Oct 2021 14:44:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E4AD31815D; Tue, 19 Oct 2021 14:44:04 +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 9C5D61819AC1; Tue, 19 Oct 2021 14:44:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19JEhMtv031711 for ; Tue, 19 Oct 2021 10:43:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6A65119D9F; Tue, 19 Oct 2021 14:43:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id BED0919C79 for ; Tue, 19 Oct 2021 14:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654672; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JyqH1C5h63EfXjwV2gR2Qq3nGU7A9P1T2fwMHX56aUw=; b=faOwpill0n44TWvQf/XiZm1nWRO+67Hs/PKWx7oVV0BLmau5iAuk70ZFNopevBqezlU91Y QsXW20hUZ9bpNG3UOPLoq1LjYudtMhcOBE9146QWxO5mkEMY2+5xythoSfzVsHqkqmJRJ/ h9iRhqqGOR7CHSkEp3MjIH/sbj1sNic= X-MC-Unique: -d_ZkTjnNVqf3zZYoTHZZw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/8] qemuDomainGetStatsBlock: Refactor cleanup Date: Tue, 19 Oct 2021 16:43:12 +0200 Message-Id: <100e4a850d6e855761a11d3bf4225e2901203815.1634654476.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634654675514100003 Content-Type: text/plain; charset="utf-8" Use automatic memory clearing for the temporary variables and remove the cleanup section. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b46ee01d31..822fd99ae2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18461,11 +18461,10 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, unsigned int privflags) { size_t i; - int ret =3D -1; int rc; - GHashTable *stats =3D NULL; - GHashTable *nodestats =3D NULL; - virJSONValue *nodedata =3D NULL; + g_autoptr(GHashTable) stats =3D NULL; + g_autoptr(GHashTable) nodestats =3D NULL; + g_autoptr(virJSONValue) nodedata =3D NULL; qemuDomainObjPrivate *priv =3D dom->privateData; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); bool blockdev =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); @@ -18492,7 +18491,7 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, nodedata =3D qemuMonitorQueryNamedBlockNodes(priv->mon); if (qemuDomainObjExitMonitor(driver, dom) < 0) - goto cleanup; + return -1; /* failure to retrieve stats is fine at this point */ if (rc < 0 || (fetchnodedata && !nodedata)) @@ -18501,31 +18500,26 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, if (nodedata && !(nodestats =3D qemuBlockGetNodeData(nodedata))) - goto cleanup; + return -1; /* When listing backing chains, it's easier to fix up the count * after the iteration than it is to iterate twice; but we still * want count listed first. */ count_index =3D params->npar; if (virTypedParamListAddUInt(params, 0, "block.count") < 0) - goto cleanup; + return -1; for (i =3D 0; i < dom->def->ndisks; i++) { if (qemuDomainGetStatsBlockExportDisk(dom->def->disks[i], stats, n= odestats, params, &visited, visitBacking, driver, cfg, d= om, blockdev) < 0) - goto cleanup; + return -1; } params->par[count_index].value.ui =3D visited; - ret =3D 0; - cleanup: - virHashFree(stats); - virHashFree(nodestats); - virJSONValueFree(nodedata); - return ret; + return 0; } --=20 2.31.1 From nobody Mon Apr 29 09:12:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634654667; cv=none; d=zohomail.com; s=zohoarc; b=Zq2scJpTYQ8ME7lrrFXFzD3N8QO9XZzq/1EYQAJsbccR4gZVYNCCoZbvmp3MlUdcFRBSeI29Ks1nhVsNk3feyTewG7Qw0PAVx5U7pY3+R58V6mAddpZ/tEI2K3sjTxERPaiyRxmXf9I1TKtN6pEwVNNg2FJcuIZ5CkqR7YzzWtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634654667; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=j1PBFgzS7ZrkSyk4nUYkK7QvIpEcy8MC0HbNhvF7ftw=; b=jT0Mu9oPFsFP+6p+3ceO1Sxu3evfuDetKPxrp6dgw8Yb0xK2X6ZBU6GKm0vX4jR4+j0Yri3v0jM58lJFM6JS176rpvG4khmLO22qbJk2N9Lcr5AS8qwk+czm23PLUrMzG08jou/C/wXDzSjfnRagm8YKhkQ2CykKUdLcYO/u0Rg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634654667108601.4384279959977; Tue, 19 Oct 2021 07:44:27 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-239-JD-X8P9rPE2zdqvU2uETvg-1; Tue, 19 Oct 2021 10:44:24 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92B5B101F7A4; Tue, 19 Oct 2021 14:44:19 +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 75437707B6; Tue, 19 Oct 2021 14:44:19 +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 129564EA38; Tue, 19 Oct 2021 14:44:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19JEhNNP031724 for ; Tue, 19 Oct 2021 10:43:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 80A0A19D9F; Tue, 19 Oct 2021 14:43:23 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDBD519C79 for ; Tue, 19 Oct 2021 14:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654666; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=j1PBFgzS7ZrkSyk4nUYkK7QvIpEcy8MC0HbNhvF7ftw=; b=eqv4BX6fiPfBcyrDatULHnxkpcp4at0uRyWCp7tOMQ5mru5zaOytjiG7gMzt2UI2wAzxM0 nzeZit+tTx3Q5cEbarD5Pekuq96cBqxF3fFu59HHG2fXvEJs1cKGsp9ZkaoKpbuocBajAW /QRa03gC2EkAIcyURqgs/Y3dTkUAqKA= X-MC-Unique: JD-X8P9rPE2zdqvU2uETvg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/8] qemuMonitorJSONQueryBlockstats: Refactor cleanup Date: Tue, 19 Oct 2021 16:43:13 +0200 Message-Id: <67af53dab4f5a4f66a79943864926c0ae9e15fe6.1634654476.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634654667608100003 Content-Type: text/plain; charset="utf-8" Use automatic memory clearing and remove the cleanup label. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor_json.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e4f4dba79a..6cf36d2518 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2520,25 +2520,19 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValue *d= ev, virJSONValue * qemuMonitorJSONQueryBlockstats(qemuMonitor *mon) { - virJSONValue *cmd; - virJSONValue *reply =3D NULL; - virJSONValue *ret =3D NULL; + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; if (!(cmd =3D qemuMonitorJSONMakeCommand("query-blockstats", NULL))) return NULL; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; + return NULL; if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0) - goto cleanup; - - ret =3D virJSONValueObjectStealArray(reply, "return"); + return NULL; - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; + return virJSONValueObjectStealArray(reply, "return"); } --=20 2.31.1 From nobody Mon Apr 29 09:12:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634654657; cv=none; d=zohomail.com; s=zohoarc; b=H72Q8dusJz02xdLhp8Ut6W5/BEAp99u+C8uzZ08IUVkwRDKd52bMnwhZLE4OMo2dOoCd0I4Nz9lb/a1XF+NGgFhKl4Q+rNyK9xMtFQHlq1miBlVShu6lGVZsAG243cqwq0KdjxKz67C3mdfZXA3YDHFWL+oGZdzvxDmHlLS+f0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634654657; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eO74xyRVzkuxblb/cI4aFWg0UHkYOJcU68QgAJPLQWo=; b=Iz4ElQAPQ8X+hXsJ2xqp9UYrEKyNjZJSxTbIuQg+Hu7vhap2+93O05jhxUjiYcliAwfK46Dw2V2w0mwz+cIsVEzxXPDE9kV019ZzsYmuAkluIiUYmlNI2d1hipuRUirBd0wQNAIIWfnyvq4u0V+1yKy92alUGU9xxenDu6kqnFU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634654657130205.7667744579586; Tue, 19 Oct 2021 07:44:17 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-337-URp6EnhdPIiX7WAQu1kDBA-1; Tue, 19 Oct 2021 10:44:14 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EEFE0180830C; Tue, 19 Oct 2021 14:44:08 +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 D220018A8F; Tue, 19 Oct 2021 14:44:08 +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 94E734EA31; Tue, 19 Oct 2021 14:44:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19JEhOih031737 for ; Tue, 19 Oct 2021 10:43:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A73B19723; Tue, 19 Oct 2021 14:43:24 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF2C619C79 for ; Tue, 19 Oct 2021 14:43:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654656; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eO74xyRVzkuxblb/cI4aFWg0UHkYOJcU68QgAJPLQWo=; b=EVgPmous0/8TU+MuLWUZKlLs8otr1q6edQAsmmNxqV4v0d7GQpL0KYtOB7AR7V4d1wiSLd VSoDY8xCsDolKAmWX/keS1/a3MzfceIdBR6t+wC4OMZajdeb+ZNHGYFxz8e0fq5/nxuash DsDX5HE03v92sHO6aaflJXMrR5QY7g8= X-MC-Unique: URp6EnhdPIiX7WAQu1kDBA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/8] qemuMonitorGetAllBlockStatsInfo: Remove 'backingChain' argument Date: Tue, 19 Oct 2021 16:43:14 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634654657504100001 Content-Type: text/plain; charset="utf-8" All (proper) callers pass true so we can remove the argument. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 4 ++-- src/qemu/qemu_monitor.c | 13 ++++--------- src/qemu/qemu_monitor.h | 3 +-- src/qemu/qemu_monitor_json.c | 15 +++++---------- src/qemu/qemu_monitor_json.h | 3 +-- tests/qemumonitorjsontest.c | 2 +- 6 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 822fd99ae2..587a673efc 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10051,7 +10051,7 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, } qemuDomainObjEnterMonitor(driver, vm); - nstats =3D qemuMonitorGetAllBlockStatsInfo(priv->mon, &blockstats, tru= e); + nstats =3D qemuMonitorGetAllBlockStatsInfo(priv->mon, &blockstats); if (capacity && nstats >=3D 0) { if (blockdev) @@ -18477,7 +18477,7 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) { qemuDomainObjEnterMonitor(driver, dom); - rc =3D qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats, true); + rc =3D qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats); if (rc >=3D 0) { if (blockdev) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index e8accaf2b0..166f7958f0 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2056,27 +2056,22 @@ qemuMonitorQueryBlockstats(qemuMonitor *mon) * qemuMonitorGetAllBlockStatsInfo: * @mon: monitor object * @ret_stats: pointer that is filled with a hash table containing the sta= ts - * @backingChain: recurse into the backing chain of devices * - * Creates a hash table in @ret_stats with block stats of all devices. In = case - * @backingChain is true @ret_stats will additionally contain stats for - * backing chain members of block devices. + * Creates a hash table in @ret_stats with block stats of all devices and = the + * backing chains for the block devices. * * Returns < 0 on error, count of supported block stats fields on success. */ int qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon, - GHashTable **ret_stats, - bool backingChain) + GHashTable **ret_stats) { int ret; g_autoptr(GHashTable) stats =3D virHashNew(g_free); - VIR_DEBUG("ret_stats=3D%p, backing=3D%d", ret_stats, backingChain); - QEMU_CHECK_MONITOR(mon); - ret =3D qemuMonitorJSONGetAllBlockStatsInfo(mon, stats, backingChain); + ret =3D qemuMonitorJSONGetAllBlockStatsInfo(mon, stats); if (ret < 0) return -1; diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 52ff34d316..e28d45cc4a 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -738,8 +738,7 @@ struct _qemuBlockStats { }; int qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon, - GHashTable **ret_stats, - bool backingChain) + GHashTable **ret_stats) ATTRIBUTE_NONNULL(2); int qemuMonitorBlockStatsUpdateCapacity(qemuMonitor *mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6cf36d2518..af673b5ba6 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2469,8 +2469,7 @@ static int qemuMonitorJSONGetOneBlockStatsInfo(virJSONValue *dev, const char *dev_name, int depth, - GHashTable *hash, - bool backingChain) + GHashTable *hash) { g_autofree qemuBlockStats *bstats =3D NULL; int nstats =3D 0; @@ -2507,10 +2506,8 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValue *de= v, qemuMonitorJSONAddOneBlockStatsInfo(bstats, nodename, hash) < 0) return -1; - if (backingChain && - (backing =3D virJSONValueObjectGetObject(dev, "backing")) && - qemuMonitorJSONGetOneBlockStatsInfo(backing, dev_name, depth + 1, - hash, true) < 0) + if ((backing =3D virJSONValueObjectGetObject(dev, "backing")) && + qemuMonitorJSONGetOneBlockStatsInfo(backing, dev_name, depth + 1, = hash) < 0) return -1; return nstats; @@ -2538,8 +2535,7 @@ qemuMonitorJSONQueryBlockstats(qemuMonitor *mon) int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon, - GHashTable *hash, - bool backingChain) + GHashTable *hash) { int nstats =3D 0; int rc; @@ -2570,8 +2566,7 @@ qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon, if (*dev_name =3D=3D '\0') dev_name =3D NULL; - rc =3D qemuMonitorJSONGetOneBlockStatsInfo(dev, dev_name, 0, hash, - backingChain); + rc =3D qemuMonitorJSONGetOneBlockStatsInfo(dev, dev_name, 0, hash); if (rc < 0) return -1; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index c841de0a03..c60f079d06 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -77,8 +77,7 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitor *mon, virJSONValue *qemuMonitorJSONQueryBlockstats(qemuMonitor *mon); int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon, - GHashTable *hash, - bool backingChain); + GHashTable *hash); int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon, GHashTable *stats, bool backingChain); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 30a19d27e8..e5ba39cd2f 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1657,7 +1657,7 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInf= o(const void *opaque) CHECK0FULL(wr_highest_offset_valid, WR_HIGHEST_OFFSET_VALID, "%d", "%d= ") if (qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorTestGetMonitor(test= ), - blockstats, false) < 0) + blockstats) < 0) return -1; if (!blockstats) { --=20 2.31.1 From nobody Mon Apr 29 09:12:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634654672; cv=none; d=zohomail.com; s=zohoarc; b=LRcnWf++uvjvl9TyA2PMbAjz9Wxv94lNEI+9tW+ceDCBHTeLisQTkztCBYfV4tg/kVBy2ZDthIdp5UhHFImNnzJZeTB+cz21C1fK7VDvQ0pJaYdw/3Lzc9zYC26kG8sgz8ZzfBat3wwsyFxiEewmS/iyw3FTGPbd4MMfv6b8a0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634654672; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=J/Pr8lIur4dQehb6p6P8xqOMQ3WGsQQVu+jkXJ8/GWQ=; b=mb5caXwyCTlgB463udQRn3WA5Bev3dfj01vdXbNeVlBjTbl+ahAjWgHmaDa/UlToYSsq6JRded06e+ndGEGDVXcPKN/d3whNZ5L2nb8HvweUVU1L9T4ymDcv5JoReRls5w4SVX0lc8GNkB264BbJhUdQqxSorQ106lvsbsS2il0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1634654672532786.6600790203864; Tue, 19 Oct 2021 07:44:32 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-107-F4fNM3m0OSK2rx-40E0lBQ-1; Tue, 19 Oct 2021 10:44:27 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0DA3180831A; Tue, 19 Oct 2021 14:44:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC8225DAA5; Tue, 19 Oct 2021 14:44:22 +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 747A11832DDA; Tue, 19 Oct 2021 14:44:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19JEhPVY031791 for ; Tue, 19 Oct 2021 10:43:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id A92459087; Tue, 19 Oct 2021 14:43:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02C5F1F43F for ; Tue, 19 Oct 2021 14:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654671; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=J/Pr8lIur4dQehb6p6P8xqOMQ3WGsQQVu+jkXJ8/GWQ=; b=OuSkTlrpOB5UKVg04GZVTVQE9Gh2aGO1+mR0d1NrEOS9TOKZI2mgZ9yx1vh2NbzusxzCf4 jQ2c9PnKwWNACaFl4GL5mWx2er90uub2rirRsSIf0qX2dBZ0bQmW2dvReuPPgXOvj3brgU 7FL00QokMlTBwqutKnDyEMyFZxqBy64= X-MC-Unique: F4fNM3m0OSK2rx-40E0lBQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 8/8] qemuMonitorBlockStatsUpdateCapacity: Remove 'backingChain' argument Date: Tue, 19 Oct 2021 16:43:15 +0200 Message-Id: <53043e75e13ba5931359f81e148862b752a11aaa.1634654476.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634654673349100001 Content-Type: text/plain; charset="utf-8" Always fetch the stats for all backing chain members. Callers from qemu_driver.c already always passed 'true' and the caller from the migration code won't mind when we fetch all stats. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 5 ++--- src/qemu/qemu_migration_cookie.c | 2 +- src/qemu/qemu_monitor.c | 7 ++----- src/qemu/qemu_monitor.h | 3 +-- src/qemu/qemu_monitor_json.c | 16 +++++----------- src/qemu/qemu_monitor_json.h | 3 +-- 6 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 587a673efc..6997dc7dea 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10057,7 +10057,7 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, if (blockdev) rc =3D qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, = blockstats); else - rc =3D qemuMonitorBlockStatsUpdateCapacity(priv->mon, blocksta= ts, true); + rc =3D qemuMonitorBlockStatsUpdateCapacity(priv->mon, blocksta= ts); } if (qemuDomainObjExitMonitor(driver, vm) < 0 || nstats < 0 || rc < 0) @@ -18483,8 +18483,7 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, if (blockdev) rc =3D qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->m= on, stats); else - ignore_value(qemuMonitorBlockStatsUpdateCapacity(priv->mon= , stats, - true)); + ignore_value(qemuMonitorBlockStatsUpdateCapacity(priv->mon= , stats)); } if (fetchnodedata) diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index c7b010f0a0..cc4cc39b32 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -495,7 +495,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookie *mig, if (blockdev) rc =3D qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, stat= s); else - rc =3D qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false= ); + rc =3D qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats); if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) return -1; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 166f7958f0..9af9d3cf63 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2084,14 +2084,11 @@ qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon, /* Updates "stats" to fill virtual and physical size of the image */ int qemuMonitorBlockStatsUpdateCapacity(qemuMonitor *mon, - GHashTable *stats, - bool backingChain) + GHashTable *stats) { - VIR_DEBUG("stats=3D%p, backing=3D%d", stats, backingChain); - QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONBlockStatsUpdateCapacity(mon, stats, backingChai= n); + return qemuMonitorJSONBlockStatsUpdateCapacity(mon, stats); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index e28d45cc4a..f452d0d306 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -742,8 +742,7 @@ int qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon, ATTRIBUTE_NONNULL(2); int qemuMonitorBlockStatsUpdateCapacity(qemuMonitor *mon, - GHashTable *stats, - bool backingChain) + GHashTable *stats) ATTRIBUTE_NONNULL(2); int qemuMonitorBlockStatsUpdateCapacityBlockdev(qemuMonitor *mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index af673b5ba6..7bf3a9981b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2617,8 +2617,7 @@ static int qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONValue *image, const char *dev_name, int depth, - GHashTable *stats, - bool backingChain) + GHashTable *stats) { g_autofree char *entry_name =3D qemuDomainStorageAlias(dev_name, depth= ); virJSONValue *backing; @@ -2627,13 +2626,11 @@ qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONV= alue *image, stats, NULL) < 0) return -1; - if (backingChain && - (backing =3D virJSONValueObjectGetObject(image, "backing-image")) = && + if ((backing =3D virJSONValueObjectGetObject(image, "backing-image")) = && qemuMonitorJSONBlockStatsUpdateCapacityOne(backing, dev_name, depth + 1, - stats, - true) < 0) + stats) < 0) return -1; return 0; @@ -2642,8 +2639,7 @@ qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONVal= ue *image, int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon, - GHashTable *stats, - bool backingChain) + GHashTable *stats) { size_t i; g_autoptr(virJSONValue) devices =3D NULL; @@ -2668,9 +2664,7 @@ qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *= mon, !(image =3D virJSONValueObjectGetObject(inserted, "image"))) continue; - if (qemuMonitorJSONBlockStatsUpdateCapacityOne(image, dev_name, 0, - stats, - backingChain) < 0) + if (qemuMonitorJSONBlockStatsUpdateCapacityOne(image, dev_name, 0,= stats) < 0) return -1; } diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index c60f079d06..f9e01e5bf5 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -79,8 +79,7 @@ virJSONValue *qemuMonitorJSONQueryBlockstats(qemuMonitor = *mon); int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon, GHashTable *hash); int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon, - GHashTable *stats, - bool backingChain); + GHashTable *stats); int qemuMonitorJSONBlockStatsUpdateCapacityBlockdev(qemuMonitor *mon, GHashTable *stats); --=20 2.31.1