From nobody Sun Feb 8 20:53:40 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1565280193; cv=none; d=zoho.com; s=zohoarc; b=PasSCf01jMA9KjUYm0HCEsj4VxW18ICwCX5Gm6fZtvYp5fHYkzBmGJpwKUAHo2KWOiD7iRkxi7GKYrTZ5O+7LuwWyTWy1QiAnih4qqhGJTh/jPNHgAFbZkndbCvg0KRzP++/Vs+S249fcVpUosYcauqI5AwxyWMi+twhwBnrMgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565280193; 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:ARC-Authentication-Results; bh=PiKSWqkMxgLhILaq/vhGUy0EB+KXlLRFKmUE6CUtU0w=; b=SLEj1BCUGAnWaVNOg9Ja8jY7yYfp/cy2FkYz3qvZt22cRMBiz+zATSE0ogyW/GwLXbPTIAlS/80L8ZUtF8bsjQPKe4MhlgQdp9Xyazgyy3npUIICZblp20hBcaaCrGcH6znYwE3Yr2qM86GDV39ltXmhzDpTUP269eoCgnu4g8E= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565280193220564.6582125829436; Thu, 8 Aug 2019 09:03:13 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id B74748E592; Thu, 8 Aug 2019 16:03:11 +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 742E060A35; Thu, 8 Aug 2019 16:03:11 +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 1B2262551D; Thu, 8 Aug 2019 16:03:11 +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 x78G0msE005370 for ; Thu, 8 Aug 2019 12:00:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0E859F6F9; Thu, 8 Aug 2019 16:00:48 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D0E93DB4 for ; Thu, 8 Aug 2019 16:00:47 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 8 Aug 2019 18:00:32 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/12] qemu: Fix logic in qemuDomainBlockCopyCommonValidateUserMirrorBackingStore 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: , 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Aug 2019 16:03:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Allow reusing original backing chain when doing a shallow copy without reuse of external image. The existing logic didn't allow it but it will be possible. Also add a note to explain that logic. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ff83d1c024..3e0aa1b90f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18263,19 +18263,23 @@ qemuDomainBlockCopyCommonValidateUserMirrorBackin= gStore(virStorageSourcePtr mirr { /* note that if original disk does not have backing chain, shallow is = cleared */ bool shallow =3D flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW; - bool reuse =3D flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT; - if (!mirror->backingStore) { - /* deep copy won't need backing store so we can terminate it */ - if (!shallow && + if (!virStorageSourceHasBacking(mirror)) { + /* for deep copy there won't be backing chain so we can terminate = it */ + if (!mirror->backingStore && + !shallow && !(mirror->backingStore =3D virStorageSourceNew())) return -1; - return 0; - } - - /* validate user provided backing store */ - if (virStorageSourceHasBacking(mirror)) { + /* When reusing an external image we document that the user must e= nsure + * that the image must expose data as the original image = did + * either by providing correct chain or prepopulating the image. T= his + * means we can't validate this any more regardless of whether sha= llow + * copy is requested. + * + * For a copy when we are not reusing external image requesting sh= allow + * is okay and will inherit the original backing chain */ + } else { if (!blockdev) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("backingStore of mirror target is not support= ed by this qemu")); @@ -18287,13 +18291,6 @@ qemuDomainBlockCopyCommonValidateUserMirrorBacking= Store(virStorageSourcePtr mirr _("backingStore of mirror without VIR_DOMAIN_BL= OCK_COPY_SHALLOW doesn't make sense")); return -1; } - } else { - /* shallow copy without reuse requires some kind of backing data */ - if (!reuse && shallow) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("VIR_DOMAIN_BLOCK_COPY_SHALLOW implies backin= g chain for mirror")); - return -1; - } } return 0; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list