From nobody Sat Apr 27 08:26:46 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1506334996785182.64389100622168; Mon, 25 Sep 2017 03:23:16 -0700 (PDT) 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 5C079883DE; Mon, 25 Sep 2017 10:23:15 +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 137BE6294A; Mon, 25 Sep 2017 10:23:15 +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 393751855941; Mon, 25 Sep 2017 10:23:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8P9rHip002379 for ; Mon, 25 Sep 2017 05:53:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id B508F6BC2A; Mon, 25 Sep 2017 09:53:17 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14E196017D; Mon, 25 Sep 2017 09:53:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5C079883DE Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 25 Sep 2017 11:53:06 +0200 Message-Id: <0e03052e69411d9f846ec6d17ab806870a1f7b6e.1506333120.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/2] qemu: block: Don't lookup node names if they are already known 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.26]); Mon, 25 Sep 2017 10:23:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move the check that skips node name detection if they are already present earlier so that the hash table lookup is skipped. --- src/qemu/qemu_block.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 3437302dd..a3da80f88 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -272,13 +272,13 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk, qemuBlockNodeNameBackingChainDataPtr entry =3D NULL; virStorageSourcePtr src =3D disk->src; - if (!(entry =3D virHashLookup(disktable, disk->info.alias))) - return 0; - /* don't attempt the detection if the top level already has node names= */ if (src->nodeformat || src->nodestorage) return 0; + if (!(entry =3D virHashLookup(disktable, disk->info.alias))) + return 0; + while (src && entry) { if (src->nodeformat || src->nodestorage) { if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) || --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 08:26:46 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1506335826413803.171307622759; Mon, 25 Sep 2017 03:37:06 -0700 (PDT) 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 E3C867EA85; Mon, 25 Sep 2017 10:37:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D6EF46B8F9; Mon, 25 Sep 2017 10:37:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6B65A4EE50; Mon, 25 Sep 2017 10:37:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8P9rIqb002389 for ; Mon, 25 Sep 2017 05:53:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id AEC366017D; Mon, 25 Sep 2017 09:53:18 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DF9B6BC2F; Mon, 25 Sep 2017 09:53:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E3C867EA85 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 25 Sep 2017 11:53:07 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/2] qemu: block: Use correct alias when extracting disk node names 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]); Mon, 25 Sep 2017 10:37:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" For some arcane reason we don't use the alias from disk->info.alias directly but prepend drive in front of it. This messed up the disk node name extraction code as qemu reports the full alias. This was broken in the node name detector refactoring done in commit 0175dc6ea024d Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1494327 --- src/qemu/qemu_block.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index a3da80f88..6faecb0ae 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -20,6 +20,7 @@ #include "qemu_block.h" #include "qemu_domain.h" +#include "qemu_alias.h" #include "viralloc.h" #include "virstring.h" @@ -271,36 +272,46 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk, { qemuBlockNodeNameBackingChainDataPtr entry =3D NULL; virStorageSourcePtr src =3D disk->src; + char *alias =3D NULL; + int ret =3D -1; /* don't attempt the detection if the top level already has node names= */ if (src->nodeformat || src->nodestorage) return 0; - if (!(entry =3D virHashLookup(disktable, disk->info.alias))) - return 0; + if (!(alias =3D qemuAliasFromDisk(disk))) + goto cleanup; + + if (!(entry =3D virHashLookup(disktable, alias))) { + ret =3D 0; + goto cleanup; + } while (src && entry) { if (src->nodeformat || src->nodestorage) { if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) || STRNEQ_NULLABLE(src->nodestorage, entry->nodestorage)) - goto error; + goto cleanup; break; } else { if (VIR_STRDUP(src->nodeformat, entry->nodeformat) < 0 || VIR_STRDUP(src->nodestorage, entry->nodestorage) < 0) - goto error; + goto cleanup; } entry =3D entry->backing; src =3D src->backingStore; } - return 0; + ret =3D 0; - error: - qemuBlockDiskClearDetectedNodes(disk); - return -1; + cleanup: + VIR_FREE(alias); + if (ret < 0) + qemuBlockDiskClearDetectedNodes(disk); + + return ret; } --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list