From nobody Tue May 7 04:32:31 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=1638455010; cv=none; d=zohomail.com; s=zohoarc; b=nQQLem9AKfPqfegSwIgY201/Jt6nhj4fjYDV575RVPY9sfRtFvSxaHgsUaTMxwsoeyaALwII0Lahgq+gHZyInIX5XqZtxeQ5V+eoYjDhW85YTKcIA0N72k75ktBvRk4yeXLH660n2G4Lp/c4BgmIZUhCa9U8mPabEt0RDizj+vA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638455010; 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=20DFHcZtVNLvIH+Kf/ijr2lKftEX6XW5Ehoyq/wbFHw=; b=UYiiLmKrEZOmAb3l9Gc9Lwl58yoHW/jhOmocubBH/87fNIP1REVxnVyzKYw+fIp8sdW0t5aPfHjtCgQKTl7j7Uoiz4UHBH3dChzRhz7e9GQkQzI3wpQd+G5KxO8oC3qJoHPxdsUSffIJ+2UZrWRDC//fcGr+hFaIOuqdO1r/lI4= 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 1638455010325420.0711401519852; Thu, 2 Dec 2021 06:23:30 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-575-9Mc1fb5vOqquzwFwhep6DQ-1; Thu, 02 Dec 2021 09:23:27 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43B6C344AF; Thu, 2 Dec 2021 14:23:21 +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 081DE60C13; Thu, 2 Dec 2021 14:23:21 +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 8E0441809C89; Thu, 2 Dec 2021 14:23:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B2EMAcR026682 for ; Thu, 2 Dec 2021 09:22:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6C88979447; Thu, 2 Dec 2021 14:22:10 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8D6D7944C for ; Thu, 2 Dec 2021 14:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638455009; 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=20DFHcZtVNLvIH+Kf/ijr2lKftEX6XW5Ehoyq/wbFHw=; b=TeTYkwPq5I31VC5snXK6mOrAN8oXuBUSBdlfVsI3n+/dcB/Gb2DHHmfo0SUU1dYoVeXm+2 o5f2GW2GPkoa3nMprcuxbFgE3pnP62F8a5DNc0gt6hUDgSdkrtVxS4MZeRx4SYO3xCLtHk l6EsLI76rJcPgFdtRRJqmKzjDg9UyE8= X-MC-Unique: 9Mc1fb5vOqquzwFwhep6DQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/3] qemu: Drop comma after QEMU_CAPS_LAST in queryDirtyRateRequired[] Date: Thu, 2 Dec 2021 15:22:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.12 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: 1638455010934100001 Content-Type: text/plain; charset="utf-8" The idea of queryDirtyRateRequired[] is that it lists QEMU capabilities required for given domstats record (VIR_DOMAIN_STATS_DIRTYRATE in this particular case) and QEMU_CAPS_LAST is used as a sentinel. Therefore, there can never be anything after it. Drop the comma to make it more obvious. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b88fb47032..d3430557f0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18667,7 +18667,7 @@ struct qemuDomainGetStatsWorker { =20 static virQEMUCapsFlags queryDirtyRateRequired[] =3D { QEMU_CAPS_QUERY_DIRTY_RATE, - QEMU_CAPS_LAST, + QEMU_CAPS_LAST }; =20 static struct qemuDomainGetStatsWorker qemuDomainGetStatsWorkers[] =3D { --=20 2.32.0 From nobody Tue May 7 04:32:31 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=1638455081; cv=none; d=zohomail.com; s=zohoarc; b=ZIJ23xoWXcKg9/oIh/fW62pLfoRDp52fn/yPRNr8rGH33e2iACfk4DnueixGsc7QkMqYspXTs3D7m2YvyUjfTnrrgaBQTn99a5OF8veyw3mte9MQGlGQ5ocibrmFL2gyeGHmXVpQcY9qtkrTtXp/wGrwezRhjHLLXQsn7V47sZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638455081; 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=rzNqGMsSzwuMeqBpsRS2Kr9RwFOtgspKg1FUUpnC7aw=; b=l3YWjHvnlkxzYhgnU5X/83KEGeKGzDWKsDQPjq989UjXeBO6GXUwqSx5ePqVjuLVmUDNBOplzy2wLt92BeL/xsyVr1GqRmwIC2pSQ5A3771xqaQa0plPbc2clqZwkotKpb2Lk6TH7d8FLlThvjPBGcuGc4jv7VTxpfxYZsaAb6A= 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 1638455081059496.36194053220163; Thu, 2 Dec 2021 06:24:41 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-455-qEUTQjdGM6WoL8n9uv0_mA-1; Thu, 02 Dec 2021 09:24:33 -0500 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 1B9D0100E3E5; Thu, 2 Dec 2021 14:23:52 +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 D4FB25ED2B; Thu, 2 Dec 2021 14:23:51 +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 84D154A7C8; Thu, 2 Dec 2021 14:23:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B2EMB1l026690 for ; Thu, 2 Dec 2021 09:22:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3D6657944C; Thu, 2 Dec 2021 14:22:11 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA50D76608 for ; Thu, 2 Dec 2021 14:22:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638455080; 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=rzNqGMsSzwuMeqBpsRS2Kr9RwFOtgspKg1FUUpnC7aw=; b=Q4BiUmCGSSlxDQWdPed+UAwzv1E2vTVSOnq9tD3/I3HPYfVwUq5eYQilef0GyLu16/yTBk YBEoaguBawmR6vV9K+1zXIE9T8WrNWS28UEz8gUJRF+nQSJV/KML7x2NQAVy8SOiutCvy0 Om34mnySNCce8s1upcsM0IOAPdOSKEc= X-MC-Unique: qEUTQjdGM6WoL8n9uv0_mA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/3] qemu: prefer .requiredCaps for VIR_DOMAIN_STATS_IOTHREAD Date: Thu, 2 Dec 2021 15:22:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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: 1638455082964100001 Content-Type: text/plain; charset="utf-8" Since f29d7c3e698 we have an option for checking capabilities required for given type of statistics upfront, instead of the callback. Switch qemuDomainGetStatsIOThread() callback to the new style. This will now error out properly if user requests IOTHREAD stats forcibly (via VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS flag) but QEMU doesn't support IOThreads. Previously, this was silently ignored. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d3430557f0..f12a5aef11 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18513,7 +18513,6 @@ qemuDomainGetStatsIOThread(virQEMUDriver *driver, virTypedParamList *params, unsigned int privflags) { - qemuDomainObjPrivate *priv =3D dom->privateData; size_t i; qemuMonitorIOThreadInfo **iothreads =3D NULL; int niothreads =3D 0; @@ -18522,9 +18521,6 @@ qemuDomainGetStatsIOThread(virQEMUDriver *driver, if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom)) return 0; =20 - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) - return 0; - if (qemuDomainGetIOThreadsMon(driver, dom, &iothreads, &niothreads) < = 0) return -1; =20 @@ -18665,6 +18661,12 @@ struct qemuDomainGetStatsWorker { virQEMUCapsFlags *requiredCaps; }; =20 + +static virQEMUCapsFlags queryIOThreadRequired[] =3D { + QEMU_CAPS_OBJECT_IOTHREAD, + QEMU_CAPS_LAST +}; + static virQEMUCapsFlags queryDirtyRateRequired[] =3D { QEMU_CAPS_QUERY_DIRTY_RATE, QEMU_CAPS_LAST @@ -18678,7 +18680,7 @@ static struct qemuDomainGetStatsWorker qemuDomainGe= tStatsWorkers[] =3D { { qemuDomainGetStatsInterface, VIR_DOMAIN_STATS_INTERFACE, false, NULL= }, { qemuDomainGetStatsBlock, VIR_DOMAIN_STATS_BLOCK, true, NULL }, { qemuDomainGetStatsPerf, VIR_DOMAIN_STATS_PERF, false, NULL }, - { qemuDomainGetStatsIOThread, VIR_DOMAIN_STATS_IOTHREAD, true, NULL }, + { qemuDomainGetStatsIOThread, VIR_DOMAIN_STATS_IOTHREAD, true, queryIO= ThreadRequired }, { qemuDomainGetStatsMemory, VIR_DOMAIN_STATS_MEMORY, false, NULL }, { qemuDomainGetStatsDirtyRate, VIR_DOMAIN_STATS_DIRTYRATE, true, query= DirtyRateRequired }, { NULL, 0, false, NULL } --=20 2.32.0 From nobody Tue May 7 04:32:31 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=1638454972; cv=none; d=zohomail.com; s=zohoarc; b=IIXE4poGkesFkHGmJzELcbRxk6seCx76as5NZJPyKm5YdWJn4AEP7r/IrzGhA83Zgd2HEP2zMYD8QxMn88RwD+N+6amcCeB8azBAf1btcDVXOk1nAk590wPB5b4CNEXIUNCe2sZceKfiV7BGwLqS37To3KsyYLtn/gbUVXbBodw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638454972; 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=Kp5g2ISe5T0wg8mNNuS+wfOSkhBNcrCSfV2yAbsuJ/Q=; b=lyk5S3vNUU9+9yNmTwFg/f2GpKSisIY3PsJXc2XRQVDNI/UQeOFazV5Mp6nkHFL5Y6CFf6+kA/talEHG9z1w+sGhbbbUISQH2pnTiKQ1AsTtm/kRYNpb/qD6cKaCaW6i3wdycUl+lqVzESPb9830jTS7jlibZzytif5WBD4P+sA= 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 1638454972772251.1546083871781; Thu, 2 Dec 2021 06:22:52 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-16--m4WO22rPVaG4bQqLVzBmA-1; Thu, 02 Dec 2021 09:22:50 -0500 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 0C5AB1926DA1; Thu, 2 Dec 2021 14:22:44 +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 B7AB810023AE; Thu, 2 Dec 2021 14:22:42 +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 D5DCF4BB7C; Thu, 2 Dec 2021 14:22:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B2EMC8G026698 for ; Thu, 2 Dec 2021 09:22:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0E08776608; Thu, 2 Dec 2021 14:22:12 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ADC877E21 for ; Thu, 2 Dec 2021 14:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638454971; 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=Kp5g2ISe5T0wg8mNNuS+wfOSkhBNcrCSfV2yAbsuJ/Q=; b=Otm6e0dzLOceQXSNYiAR0WNmgGvjYxJutWYHea56OhFSiUWw213X8UHlXslDRle4cG9XuP Tiam+Pl9+sLznfxway17Fp3SAYZSRb30rlzoi2yaltbVqPUloK8z1Ip9saVXGuakt3Tjgd Hc1ijQUhqXhEvIWM16X5rcWxI4r31Nk= X-MC-Unique: -m4WO22rPVaG4bQqLVzBmA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/3] qemuConnectGetAllDomainStats: Simplify qemuDomainGetStats() error handling Date: Thu, 2 Dec 2021 15:22:07 +0100 Message-Id: <1e62fc566b808649ab78fcee58df5f8d88335584.1638454853.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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: 1638454973675100001 Content-Type: text/plain; charset="utf-8" In qemuConnectGetAllDomainStats() there a loop that iterates over all domains that stats are to be fetched for. Within this loop the qemuDomainGetStats() is called which is responsible for fetching stats for an individual domain. Now, the code that handles successful and failure cases is almost the same. Rework it, so that the code is deduplicated. Note, that the check for !tmp is dropped because upon successful return from qemuDomainGetStats() it is always allocated. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f12a5aef11..6333d0af36 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18830,6 +18830,10 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, unsigned int privflags =3D 0; unsigned int requestedStats =3D stats; unsigned int domflags =3D 0; + int rc; + + if (flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING) + domflags |=3D QEMU_DOMAIN_STATS_BACKING; =20 virObjectLock(vm); =20 @@ -18854,23 +18858,17 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, } /* else: without a job it's still possible to gather some data */ =20 - if (flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING) - domflags |=3D QEMU_DOMAIN_STATS_BACKING; - if (qemuDomainGetStats(conn, vm, requestedStats, &tmp, domflags) <= 0) { - if (HAVE_JOB(domflags) && vm) - qemuDomainObjEndJob(driver, vm); - - virObjectUnlock(vm); - goto cleanup; - } - - if (tmp) - tmpstats[nstats++] =3D tmp; + rc =3D qemuDomainGetStats(conn, vm, requestedStats, &tmp, domflags= ); =20 if (HAVE_JOB(domflags)) qemuDomainObjEndJob(driver, vm); =20 virObjectUnlock(vm); + + if (rc < 0) + goto cleanup; + + tmpstats[nstats++] =3D tmp; } =20 *retStats =3D g_steal_pointer(&tmpstats); --=20 2.32.0