From nobody Tue May 7 14:44:07 2024 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=1579883421; cv=none; d=zohomail.com; s=zohoarc; b=Yy1OHmH/BnUx9LFYu2B5tTvORcqlpZeJ/9v7WFGgvnx6yobfWx7pwmQzlOuxpPyBLfETlJPUoDN9Wb7wA1/MDjCef/ZiDEdfalvFu0WRp0eMvbytLRvrJwewrsVBGtRBZrgbgn87p60DURSoavWFai9T7e7YuNOBQYF7LQ6pLyo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579883421; 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=WYkBUjoYU+I+8n8NG0w5IsYIgmbHMlhnQBKBrpnSrtw=; b=RyfOw+6a9AAIRL7ke8vHkIEL+tG12OZsgOrfGSEpNYDxIoPAX+WH84kpYvOMrPqwG6HOl+pet8IBfaBHfXiy8mxblECUniuKuV/e7s93Baqys3LlZsuFAoHPFOl/6QM9iTAkbEDSCvc9+TB2UFZ7hA4geTz+2b4JcmkGprEJE7M= 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 1579883421096314.6864285229236; Fri, 24 Jan 2020 08:30:21 -0800 (PST) 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-79-Arzhq4ppOoOFa5VTaSwVzg-1; Fri, 24 Jan 2020 11:30:17 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7DFE991F03E; Fri, 24 Jan 2020 16:30:10 +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 425A25DA2C; Fri, 24 Jan 2020 16:30:10 +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 AD3F718034EC; Fri, 24 Jan 2020 16:30:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00OGTmet013364 for ; Fri, 24 Jan 2020 11:29:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 854995C241; Fri, 24 Jan 2020 16:29:48 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CBCB5C1B0 for ; Fri, 24 Jan 2020 16:29:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579883420; 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=WYkBUjoYU+I+8n8NG0w5IsYIgmbHMlhnQBKBrpnSrtw=; b=PHexzLXsVdxyCaFX2SP9/z3W7yWG4VObOw1Hq+t+lrVC+JVJKr7ZSlfpFfpG9nPkfGcUrW fOFxSfuJ70zHzFglyvdNAErAZuEQS51Dha2qoGNisr7E3Z9+tbROCPy8DYxSAe/ZG0FexR eWTgMFIKbOI6+Yq4mrjczS2U9GuOyDk= From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 1/2] qemu: snapshot: Always rewrite backingStore data when reusing existing images Date: Fri, 24 Jan 2020 17:29:42 +0100 Message-Id: <256da135e940cf2846cff17680624fb1a9ea312c.1579883300.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.14 X-MC-Unique: Arzhq4ppOoOFa5VTaSwVzg-1 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" Don't adopt the backing store data when reusing images provided by the user. This will force a backing chain re-probe as users might have passed in something unexpected in the overlay where our view of the backing chain would not correspond. This is done only for inactive snapshots as there we have way less verification. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0b23c747ce..e5e7b05e93 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14676,7 +14676,8 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDri= verPtr driver, if (virStorageSourceInitChainElement(newsrc, defdisk->src, false) = < 0) goto cleanup; - if (virStorageSourceHasBacking(defdisk->src)) { + if (!reuse && + virStorageSourceHasBacking(defdisk->src)) { defdisk->src->readonly =3D true; newsrc->backingStore =3D g_steal_pointer(&defdisk->src); } else { --=20 2.24.1 From nobody Tue May 7 14:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1579883438; cv=none; d=zohomail.com; s=zohoarc; b=i06iF7hKc5NscklLOpArEtL9q1I9zi6jcc5E9Z0lKpCUpPQSbz3VLoYky8Uph05SxyZhsUva0VlPvoW2TPV47K6zXX30Chs0+TBbgEvLp09qBe5/FIgdC0kYHAjmrat+pPpXR6l7XsAaLwoIs9868BN6lhX5W45cTICaoRAqYzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579883438; 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=xdxpJhPHEI8l3AdzWhisoHekkfNizpjO64/L5VMWwD8=; b=L/aX6Bz+idEdLbvdeCmozZrhgGemm61P4jyoGp8RJtwYKl9zasAskfWzjmDvloI1UrZxXYKU8fEHB+DaI2qdHmRP3Kjjkg4YxdbTH4TjD4iFVqagk8tsdbNXtgGprssEqgFJkYdtIXKJtJ9aCOC8xgf8QZDWNu3GYM3r0jbHx04= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1579883438040422.62940710938153; Fri, 24 Jan 2020 08:30:38 -0800 (PST) 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-57-Me74-a_cPPKbGki4iStWyg-1; Fri, 24 Jan 2020 11:30:34 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F1D08EA6DC; Fri, 24 Jan 2020 16:30:28 +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 731683CC6; Fri, 24 Jan 2020 16:30:28 +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 1E93D18034E9; Fri, 24 Jan 2020 16:30:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00OGTnl6013371 for ; Fri, 24 Jan 2020 11:29:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 56F915C241; Fri, 24 Jan 2020 16:29:49 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id D26845C1B0 for ; Fri, 24 Jan 2020 16:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579883436; 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=xdxpJhPHEI8l3AdzWhisoHekkfNizpjO64/L5VMWwD8=; b=Ed6r3zmJQgIkUpXKfo7L8PKfexLcPg0y3cgpXD7/2zHDpbgX/r568gMsEsYDV7n0koa9v5 3sfpRXly38GtV5PsbKGXIrVdZ5YOSg0qQjwWjJEQfa3kUN7ODGM+nVV/d+aTP+pU2KxyG0 fRu54Nl479dprp0ozCgBCKbVValsT7s= From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 2/2] qemu: snapshot: Prevent too-nested domain XML when doing inactive snapshot Date: Fri, 24 Jan 2020 17:29:43 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.84 on 10.5.11.23 X-MC-Unique: Me74-a_cPPKbGki4iStWyg-1 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" Similarly to 510d154a0b41aa70aadabc0918d16dee22882394 we need to prevent doing too deeply nested backing chains and reject them with a sane error message. Add a loop to go through the snapshots prior to attempting actually creating them to prevent some possible inconsistent scenarios. We don't need to do it when reusing backing chains as we'll be re-detecting the backing chain in that case anyways. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e5e7b05e93..8faca96a23 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14630,6 +14630,9 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDri= verPtr driver, if (!snapdisk->src->format) snapdisk->src->format =3D VIR_STORAGE_FILE_QCOW2; + if (qemuDomainStorageSourceValidateDepth(defdisk->src, 1, defdisk-= >dst) < 0) + return -1; + /* creates cmd line args: qemu-img create -f qcow2 -o */ if (!(cmd =3D virCommandNewArgList(qemuImgPath, "create", --=20 2.24.1