From nobody Tue Apr 23 09:24:40 2024 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 1543335830363612.1744270394734; Tue, 27 Nov 2018 08:23:50 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 330B1F81C; Tue, 27 Nov 2018 16:23:48 +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 F1ED25D738; Tue, 27 Nov 2018 16:23:47 +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 A6D8A181B9E4; Tue, 27 Nov 2018 16:23:47 +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 wARGNRdT017238 for ; Tue, 27 Nov 2018 11:23:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id D31551A90A; Tue, 27 Nov 2018 16:23:27 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-117-184.phx2.redhat.com [10.3.117.184]) by smtp.corp.redhat.com (Postfix) with ESMTP id 932222633D for ; Tue, 27 Nov 2018 16:23:27 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 27 Nov 2018 11:23:22 -0500 Message-Id: <20181127162323.948-2-jferlan@redhat.com> In-Reply-To: <20181127162323.948-1-jferlan@redhat.com> References: <20181127162323.948-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] qemu: Save qemuDomainGetStats error 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 27 Nov 2018 16:23:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" During qemuConnectGetAllDomainStats if qemuDomainGetStats causes a failure, then when collecting more than one domain's worth of statistics the loop in virDomainStatsRecordListFree would call virDomainFree which would call virResetLastError effectively wiping out the reason we failed leaving the caller with no idea why the collection failed. To fix this, let's save the error and restore it prior to return so that a caller such as 'virsh domstats' doesn't get the generic "error: An error occurred, but the cause is unknown". Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7d9e17e72c..2fb8eef609 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -21092,6 +21092,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, unsigned int flags) { virQEMUDriverPtr driver =3D conn->privateData; + virErrorPtr save_err =3D NULL; virDomainObjPtr *vms =3D NULL; virDomainObjPtr vm; size_t nvms; @@ -21160,6 +21161,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, if (flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING) domflags |=3D QEMU_DOMAIN_STATS_BACKING; if (qemuDomainGetStats(conn, vm, stats, &tmp, domflags) < 0) { + save_err =3D virSaveLastError(); if (HAVE_JOB(domflags) && vm) qemuDomainObjEndJob(driver, vm); =20 @@ -21184,6 +21186,10 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, cleanup: virDomainStatsRecordListFree(tmpstats); virObjectListFreeCount(vms, nvms); + if (save_err) { + virSetError(save_err); + virFreeError(save_err); + } =20 return ret; } --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 09:24:40 2024 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 154333614037717.539571769625354; Tue, 27 Nov 2018 08:29:00 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D497422D; Tue, 27 Nov 2018 16:28:57 +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 797C95C559; Tue, 27 Nov 2018 16:28:57 +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 70238181B9E5; Tue, 27 Nov 2018 16:28:56 +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 wARGNS0R017243 for ; Tue, 27 Nov 2018 11:23:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 450A517005; Tue, 27 Nov 2018 16:23:28 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-117-184.phx2.redhat.com [10.3.117.184]) by smtp.corp.redhat.com (Postfix) with ESMTP id 060F01A90A for ; Tue, 27 Nov 2018 16:23:27 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 27 Nov 2018 11:23:23 -0500 Message-Id: <20181127162323.948-3-jferlan@redhat.com> In-Reply-To: <20181127162323.948-1-jferlan@redhat.com> References: <20181127162323.948-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] qemu: Don't fail stats collection due to IOThread capability 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 27 Nov 2018 16:28:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit 212dc9286 made a generic qemuDomainGetIOThreadsMon which would fail if the QEMU_CAPS_OBJECT_IOTHREAD didn't exist. Then commit d1eac927 used that helper for the collection of all domain stats. However, if the capability doesn't exist, then the entire stats collection fails. Since the IOThread stats were meant to be if available only, thus rather than failing if the capability doesn't exist, let's just not collect the stats. Restore the caps failure logic for qemuDomainGetIOThreadsLive. Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2fb8eef609..60e29577ad 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5490,16 +5490,9 @@ qemuDomainGetIOThreadsMon(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuMonitorIOThreadInfoPtr **iothreads) { - qemuDomainObjPrivatePtr priv; + qemuDomainObjPrivatePtr priv =3D vm->privateData; int niothreads =3D 0; =20 - priv =3D vm->privateData; - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("IOThreads not supported with this binary")); - return -1; - } - qemuDomainObjEnterMonitor(driver, vm); niothreads =3D qemuMonitorGetIOThreads(priv->mon, iothreads); if (qemuDomainObjExitMonitor(driver, vm) < 0 || niothreads < 0) @@ -5514,6 +5507,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainIOThreadInfoPtr **info) { + qemuDomainObjPrivatePtr priv; qemuMonitorIOThreadInfoPtr *iothreads =3D NULL; virDomainIOThreadInfoPtr *info_ret =3D NULL; int niothreads =3D 0; @@ -5529,6 +5523,13 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, goto endjob; } =20 + priv =3D vm->privateData; + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("IOThreads not supported with this binary")); + goto endjob; + } + if ((niothreads =3D qemuDomainGetIOThreadsMon(driver, vm, &iothreads))= < 0) goto endjob; =20 @@ -20874,6 +20875,7 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver, int *maxparams, unsigned int privflags ATTRIBUTE_UNUSED) { + qemuDomainObjPrivatePtr priv; size_t i; qemuMonitorIOThreadInfoPtr *iothreads =3D NULL; int niothreads; @@ -20882,6 +20884,10 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver, if (!virDomainObjIsActive(dom)) return 0; =20 + priv =3D dom->privateData; + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) + return 0; + if ((niothreads =3D qemuDomainGetIOThreadsMon(driver, dom, &iothreads)= ) < 0) return -1; =20 --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list