From nobody Mon Sep 16 20:03:29 2024 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=1678722180; cv=none; d=zohomail.com; s=zohoarc; b=dvwIHGeG4f2fFwEylJs6qW3ospXtgUatdhUDY6xThcrW+F2lN4LnA9W01v3B9d8LtYEsrrTwdmKvhMhqY1Faw7gdZ4EEXpVYy/HD+sEoVKfjEa8uhu5HU230RvbZzec+h9xBKkItb44KLbJkxnSBavERN4dB2zBJpuHgYwrGSjM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722180; 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=zz6g4mQpzPIiI0o/DRggTCkh/pw3grRaiJpu2XNBxn0=; b=WZdku2dZcyJPhE8LQWugqjLPoZYjURwTL58ktryTlpqVh0vco9zUnORUrTZNTfhKRqxZxOQlJxsQSOe4AwXxFEpFzj8WRCdJ89EbqZpcf3zc6KF70ucM/MhK9kqYA7sRQgR2xEOO2fDZmc4cra/P/gxb57VZGSJL2/hEcdRRms0= 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 1678722180672395.7743392868807; Mon, 13 Mar 2023 08:43:00 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-548-B2nUKYRcNkqbaGQokLl9mA-1; Mon, 13 Mar 2023 11:42:53 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 68B9518E0935; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54299202701E; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4237219465B8; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AB75D1946594 for ; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8BD692166B2A; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EB2C2166B26 for ; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722179; 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=zz6g4mQpzPIiI0o/DRggTCkh/pw3grRaiJpu2XNBxn0=; b=K/tsWaxMSeRzFD8LhDta+XpoiOpcWoqM1pTq6xxuynpyTcGaSIgHHDD+VIH5aDELr7hW7E TTWmoiO3yQIIWg7n1etqPEbeXNaO85DkP3rnGLkF7TlQn1iIp2t6D5sW+Jb+l5vaYjev2+ 6Hk1kkyZ/gJa6rHUGc/1IztRR2WMUqw= X-MC-Unique: B2nUKYRcNkqbaGQokLl9mA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 08/20] qemu_snapshot: allow using alternate domain definition when creating qcow2 files Date: Mon, 13 Mar 2023 16:42:09 +0100 Message-Id: <88b433fb7cbb4e21a637c3c1c7b76c0c5ef9722c.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: 1678722180924100007 Content-Type: text/plain; charset="utf-8"; x-default="true" To create new overlay files when external snapshot revert support is introduced we will be using different domain definition than what is currently used by the domain. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 06ed20c815..9e4b978b1b 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -183,6 +183,7 @@ qemuSnapshotDomainDefUpdateDisk(virDomainDef *domdef, =20 static int qemuSnapshotCreateQcow2Files(virDomainObj *vm, + virDomainDef *def, virDomainSnapshotDef *snapdef, virBitmap *created, bool reuse) @@ -194,6 +195,9 @@ qemuSnapshotCreateQcow2Files(virDomainObj *vm, virDomainSnapshotDiskDef *snapdisk =3D NULL; virDomainDiskDef *defdisk =3D NULL; =20 + if (!def) + def =3D vm->def; + if (!(qemuImgPath =3D qemuFindQemuImgBinary(driver))) return -1; =20 @@ -203,7 +207,7 @@ qemuSnapshotCreateQcow2Files(virDomainObj *vm, for (i =3D 0; i < snapdef->ndisks && !reuse; i++) { g_autoptr(virCommand) cmd =3D NULL; snapdisk =3D &(snapdef->disks[i]); - defdisk =3D vm->def->disks[i]; + defdisk =3D def->disks[i]; =20 if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) continue; @@ -268,7 +272,7 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriver *drive= r, virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); g_autoptr(virBitmap) created =3D virBitmapNew(snapdef->ndisks); =20 - if (qemuSnapshotCreateQcow2Files(vm, snapdef, created, reuse) < 0) + if (qemuSnapshotCreateQcow2Files(vm, NULL, snapdef, created, reuse) < = 0) goto cleanup; =20 /* update disk definitions */ --=20 2.39.2