From nobody Mon Feb 9 02:15:17 2026 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=1637932135; cv=none; d=zohomail.com; s=zohoarc; b=ODI28TC0yPTLNwplGFA7OsaDAuOm5LnsXFMO0TDO/ax5O0keOcOCyF6CDpG0UZ8RFkFJs5gu0JSEb+nfN0t5VSoc1wkUOwx/aHlYeAakzwZjfXb9/iPorRL1Qb3OXrvbF53XXSXgWFdmsZCaSMoKGYEaXor0b28BwnR9bJB0L9I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637932135; 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=jAsVLtzKzUfXq51ZeTVYMkm0RXGkD1M3101LpTWHbuA=; b=ML35lHJGqymMpWylAJK6GrSm4Qbtq4wZhXVALSpkT3wGvq7FByQXTSkcZ+IMAFWTeXUkWpiNpiG5Ut7YSZRZAHMzpySuCoFcQeVNGIEX/ZILqaH+JiCp7InVjfZEoj1YAwmeLG6tvrpoqASVbY0YXwOmOXxJ6bHVV3wbzFpSpDg= 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 163793213494774.0042019963771; Fri, 26 Nov 2021 05:08:54 -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-42-PhpHdjTiMHqfDbsUl4wFEQ-1; Fri, 26 Nov 2021 08:08:52 -0500 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 5FA6585B66B; Fri, 26 Nov 2021 13:08:47 +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 4586D60622; Fri, 26 Nov 2021 13:08: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 1A7761809C89; Fri, 26 Nov 2021 13:08:47 +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 1AQD84Ju012641 for ; Fri, 26 Nov 2021 08:08:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id AEE6772FA7; Fri, 26 Nov 2021 13:08:04 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09ED372FA2 for ; Fri, 26 Nov 2021 13:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637932133; 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=jAsVLtzKzUfXq51ZeTVYMkm0RXGkD1M3101LpTWHbuA=; b=NPNwzT7EnVo4EcnC691H6EPEbSB5tRuA9U8tLaRdLmZVjizB1Yzl7ItEE+RlWnk9Rn7KKy Wwpn7iRug5Fn27EJH3OJyNNNLGWnJKuzDmVqDDW8BEfn2yx650ErvU3QqbP34BOQ4PwoAS MLvtmqS4FSdx0nZqdODLFBqaLoAw0Sw= X-MC-Unique: PhpHdjTiMHqfDbsUl4wFEQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] virStorageSourceIsSameLocation: Special-case storage sources of type 'volume' Date: Fri, 26 Nov 2021 14:07:54 +0100 Message-Id: <7961214f89e95f8e8ca7756a2a827d430c58a58b.1637932021.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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: 1637932136350100001 Content-Type: text/plain; charset="utf-8" The function is used also to compare virStorageSource which may not be resolved to the image at that point in which case the 'path' is not yet populated and the actual type is not yet set. This means that the function fails to consider two identical volume-based disks as pointing to the same thing. Add a special case for both images being type=3Dvolume in which case we compare only the pool/volume names. Closes: https://gitlab.com/libvirt/libvirt/-/issues/240 Signed-off-by: Peter Krempa Reviewed-by: Martin Kletzander --- src/conf/storage_source_conf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index 44944e1dbd..c0acee189a 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -920,6 +920,13 @@ virStorageSourceIsSameLocation(virStorageSource *a, virStorageSourceIsEmpty(b)) return true; + /* for disk type=3Dvolume we must check just pool/volume names as they= might + * not yet be resolved if e.g. we are comparing against the persistent= def */ + if (a->type =3D=3D VIR_STORAGE_TYPE_VOLUME && b->type =3D=3D VIR_STORA= GE_TYPE_VOLUME) { + return STREQ(a->srcpool->pool, b->srcpool->pool) && + STREQ(a->srcpool->volume, b->srcpool->volume); + } + if (virStorageSourceGetActualType(a) !=3D virStorageSourceGetActualTyp= e(b)) return false; --=20 2.31.1