From nobody Sun Feb 8 18:43:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.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 207.211.31.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=1594818650; cv=none; d=zohomail.com; s=zohoarc; b=hGyVaJOGZaGN3AxRnDZmOZU7HEOlwuSey9CNLLOeK+DYrY3dJW5fi8fA0g3i3jMPzA2iLgGnNP4w8aEOgoAXVpzY47t1Rbxn+g7Yw0nnoAJ2MHxwVOr/A7YrQ7/X8yjNFgIuvK8yff7Exvi/wgZUr55kFBc+Tm8Ibe+QwUclc0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594818650; 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=T3xXqyVQY8d2K4YMuKyH7MwtP0VGWZiKnF0IpJeijLc=; b=gkgtKSD+0WzUSqeukZObLO4/Cur4saJ55zJ52A5XWFSfYUsD75dmGOBilr/vzozZQ10nw5c/ybPlF4QYmIzotBwPOQRnpnGyqoKYZ8LFyKE2w5ltukIbBhk+1SK9IkKwD1FFx1fCMRv3SKQgDwQAqzxx39zIRo5zUogRQUy5jAE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.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 [207.211.31.120]) by mx.zohomail.com with SMTPS id 159481865038644.40421628757326; Wed, 15 Jul 2020 06:10:50 -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-245-canD1S2aOd2qMwftlrf2cw-1; Wed, 15 Jul 2020 09:10:47 -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 261181009446; Wed, 15 Jul 2020 13:10:40 +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 E635A610AF; Wed, 15 Jul 2020 13:10:39 +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 A8C221806B0C; Wed, 15 Jul 2020 13:10:39 +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 06FDAVox005819 for ; Wed, 15 Jul 2020 09:10:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5465961982; Wed, 15 Jul 2020 13:10:31 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE69719079 for ; Wed, 15 Jul 2020 13:10:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594818649; 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=T3xXqyVQY8d2K4YMuKyH7MwtP0VGWZiKnF0IpJeijLc=; b=Yi/S8kwyU6JJaBL5R6h7Nehnz4J2CKD8Q7RtarWcWYDJa8mglDhOkvPVKVhAr0K0dij63q dz4EGT51WD32agvA0QgG552XzW8oR9mbI68UR/6YUtxqDszjmZXAsDGIDdxcqhlAJ00Evm 7sUtAfLYwG7PpnsXcVJn7jXA/VEnBDs= X-MC-Unique: canD1S2aOd2qMwftlrf2cw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/10] qemuDomainGetStorageSourceByDevstr: Look also in 'mirror' chain Date: Wed, 15 Jul 2020 15:10:11 +0200 Message-Id: <7772c07e2adada6edb8a329f5846c93d9fa05329.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" A disk can have a mirror, look also in it's backing chain. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_domain.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 18fd445e30..ebf18a546e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11553,11 +11553,16 @@ qemuDomainGetStorageSourceByDevstr(const char *de= vstr, } if (idx =3D=3D 0) - src =3D disk->src; - else - src =3D virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL= ); + return disk->src; + + if ((src =3D virStorageFileChainLookup(disk->src, NULL, NULL, idx, NUL= L))) + return src; - return src; + if (disk->mirror && + (src =3D virStorageFileChainLookup(disk->mirror, NULL, NULL, idx, = NULL))) + return src; + + return NULL; } --=20 2.26.2