From nobody Sun Feb 8 23:41:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1594818634; cv=none; d=zohomail.com; s=zohoarc; b=JfvZATZ0J3xjlfBmW2MZWZ055nAUYCFURPCZNS/Ywo1lCP+QuaOC1kdS69rz8cW9vevqWxfXhy/Ajg/kPQYZMvab9RXngqIAE42rR0xjpspxJdsgYrb2wcJCZgMW4bXq3GJvsykXuoQoT+ElqLSkb9Fvh/XNLC1BVetQKfRwEa4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594818634; 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=Kd+HfepIf195bKLujSv365wO+WAohSvqk3RgbXQ+zLQ=; b=CCvS4wu2cmsrOTXIBLPXJ9GvUFPaInuS+ZP8dQQDsuZhHqSh7rWLDBeIkYQ5M48Jy4G/cOZ6BUJmposbsNeL2fhFe4lKqoen5VwMkbMUdtWzgWy82Iy56R1iBCrppKEfwAWaeewPwAjfD0H/IZCZ8GjXrIgIvj1+VJukQjUV5HI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594818634183348.18091006493523; Wed, 15 Jul 2020 06:10:34 -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-236-D7fRu3UNOrWGKWdzoeY7IQ-1; Wed, 15 Jul 2020 09:10:30 -0400 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 A320910059AA; Wed, 15 Jul 2020 13:10:24 +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 5EA326842F; Wed, 15 Jul 2020 13:10:24 +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 DD30D1809561; Wed, 15 Jul 2020 13:10:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06FDAM6U005750 for ; Wed, 15 Jul 2020 09:10:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0FCF860C84; Wed, 15 Jul 2020 13:10:22 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EAD961982 for ; Wed, 15 Jul 2020 13:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594818633; 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=Kd+HfepIf195bKLujSv365wO+WAohSvqk3RgbXQ+zLQ=; b=VtsQ+lC+6EDMebsahX9m3sEMdiY7a3PdvgzequlzS4DA1l6pWQP5SMBiyJRrvl/q9/Hqfp aZbAkAr32e0C3b+JozN2jz0b9+kedEW/0FlAGS2fV01OX1E8QFUxF70eCMsDHckzVHyaxK GZp/6eJMUZm2kTWbfmyvuThaQzzEUUQ= X-MC-Unique: D7fRu3UNOrWGKWdzoeY7IQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/10] qemuProcessHandleBlockThreshold: Report correct indexes Date: Wed, 15 Jul 2020 15:10:06 +0200 Message-Id: <1d94cd8c868862ed9e89a5ce9bffe263223044e8.1594818495.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The index returned by qemuDomainDiskLookupByNodename is the position in the backing chain rather than the index we report in the XML. Since with -blockdev they differ now and additionally the disk source also has an index we need to fix the 'threshold' evens we report: 1) If it's the top level image we must always trigger the event without any suffix as we did until now 2) We must report the correct index 3) We must report the correct index also for the top level image, when blockdev is used. This means that we need to potentially emit 2 events, one for the device without the index and then when blockdev is used and the top level image has an idex we must do it also with the index. This will fix it for blockdev cases, while also not removing previous semantics. https://bugzilla.redhat.com/show_bug.cgi?id=3D1857204 Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_process.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2ee778c606..9b6dc8e68b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1497,10 +1497,10 @@ qemuProcessHandleBlockThreshold(qemuMonitorPtr mon = G_GNUC_UNUSED, void *opaque) { virQEMUDriverPtr driver =3D opaque; - virObjectEventPtr event =3D NULL; + virObjectEventPtr eventSource =3D NULL; + virObjectEventPtr eventDevice =3D NULL; virDomainDiskDefPtr disk; virStorageSourcePtr src; - unsigned int idx; const char *path =3D NULL; virObjectLock(vm); @@ -1509,18 +1509,28 @@ qemuProcessHandleBlockThreshold(qemuMonitorPtr mon = G_GNUC_UNUSED, "threshold '%llu' exceeded by '%llu'", nodename, vm, vm->def->name, threshold, excess); - if ((disk =3D qemuDomainDiskLookupByNodename(vm->def, nodename, &src, = &idx))) { - g_autofree char *dev =3D NULL; + if ((disk =3D qemuDomainDiskLookupByNodename(vm->def, nodename, &src, = NULL))) { if (virStorageSourceIsLocalStorage(src)) path =3D src->path; - if ((dev =3D qemuDomainDiskBackingStoreGetName(disk, idx))) - event =3D virDomainEventBlockThresholdNewFromObj(vm, dev, path, - threshold, exce= ss); + if (src =3D=3D disk->src) { + g_autofree char *dev =3D qemuDomainDiskBackingStoreGetName(dis= k, 0); + + eventDevice =3D virDomainEventBlockThresholdNewFromObj(vm, dev= , path, + threshold= , excess); + } + + if (src->id !=3D 0) { + g_autofree char *dev =3D qemuDomainDiskBackingStoreGetName(dis= k, src->id); + + eventSource =3D virDomainEventBlockThresholdNewFromObj(vm, dev= , path, + threshold= , excess); + } } virObjectUnlock(vm); - virObjectEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, eventDevice); + virObjectEventStateQueue(driver->domainEventState, eventSource); return 0; } --=20 2.26.2