From nobody Fri Dec 19 06:33:01 2025 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=1687879485; cv=none; d=zohomail.com; s=zohoarc; b=hx3sBKFKd1mee2v9WeYn6b10qSY96uatmMcaEtodS2eanMrKX+g/ZWQS/7vGENwXjkViwxS1WqvKFrWvS6L5+LiPw2f6P5d55jXVdb/PPa+XZ4wlOwj9euQp5XbWlrhUqQ9ZKsv819J72rwwppxaMw4XYW8YpLzU4m5jxaoi6eI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687879485; 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=Pcqmd9YdtoqNAhjdcHZmxwGdcAvMr3K0VBf+GsZup90=; b=QTilnu95RQuV+3cFR22SaL62EiFI7r9iL19R9/a6LhMr9p+jrBi5KXLlOsyVsB6foJaTKWzYtxDC5OhP1/0PBT44UckDR+pxMujlGGIl1WIPPecG76ReZ+5alsiOjiWp/BL+wX5evSkiI+ucDcW5FfM5xjMk0DyUdFs36N108lY= 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 1687879485371802.7456276109076; Tue, 27 Jun 2023 08:24:45 -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-170-xFa7lRSVOGy1uH9Kh29vZg-1; Tue, 27 Jun 2023 11:21:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 69D0A8FF741; Tue, 27 Jun 2023 15:08:05 +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 4F3D3C00049; Tue, 27 Jun 2023 15:08:05 +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 EAF6F194E11C; Tue, 27 Jun 2023 15:07:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 64D08194E009 for ; Tue, 27 Jun 2023 15:07:40 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5739348FB02; Tue, 27 Jun 2023 15:07:40 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.45.225.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE84348FB01 for ; Tue, 27 Jun 2023 15:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687879472; 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=Pcqmd9YdtoqNAhjdcHZmxwGdcAvMr3K0VBf+GsZup90=; b=NXxkghSXbZLqUcLKOpXN0iEOsF7lG6viZ1N+Xrw10lTxW+ZZzlt6/HTP9MmkroC/iNxxhr PbIbHyWKdIv8NSVfraaWM2yilhkw70VaZBAEYm/IveJLd7F6AcKSv+gRDL6kh7iACztyPf t9AyBoMpMGon+IhxzKfnXuKHhQlfNX0= X-MC-Unique: xFa7lRSVOGy1uH9Kh29vZg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v2 19/24] qemu_snapshot: remove revertdisks when creating new snapshot Date: Tue, 27 Jun 2023 17:07:22 +0200 Message-ID: <6b822a2cb1aaa85df79781611c70bc37e1668a37.1687877087.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.8 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: 1687879486966100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When user creates a new snapshot after reverting to non-leaf snapshot we no longer need to store the temporary overlays as they will be part of the VM XMLs stored in the newly created snapshot. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index a206f015c4..2950ad7d77 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1652,6 +1652,23 @@ qemuSnapshotCreateWriteMetadata(virDomainObj *vm, } =20 =20 +static void +qemuSnapshotClearRevertdisks(virDomainMomentObj *current) +{ + virDomainSnapshotDef *curdef =3D NULL; + + if (!current) + return; + + curdef =3D virDomainSnapshotObjGetDef(current); + + if (curdef->revertdisks) { + g_clear_pointer(&curdef->revertdisks, g_free); + curdef->nrevertdisks =3D 0; + } +} + + static virDomainSnapshotPtr qemuSnapshotRedefine(virDomainObj *vm, virDomainPtr domain, @@ -1661,6 +1678,7 @@ qemuSnapshotRedefine(virDomainObj *vm, unsigned int flags) { virDomainMomentObj *snap =3D NULL; + virDomainMomentObj *current =3D virDomainSnapshotGetCurrent(vm->snapsh= ots); virDomainSnapshotPtr ret =3D NULL; g_autoptr(virDomainSnapshotDef) snapdef =3D virObjectRef(snapdeftmp); =20 @@ -1678,8 +1696,10 @@ qemuSnapshotRedefine(virDomainObj *vm, * makes sense, such as checking that qemu-img recognizes the * snapshot name in at least one of the domain's disks? */ =20 - if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT) + if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT) { + qemuSnapshotClearRevertdisks(current); qemuSnapshotSetCurrent(vm, snap); + } =20 if (qemuSnapshotCreateWriteMetadata(vm, snap, driver, cfg) < 0) goto error; @@ -1758,6 +1778,7 @@ qemuSnapshotCreate(virDomainObj *vm, } =20 if (!tmpsnap) { + qemuSnapshotClearRevertdisks(current); qemuSnapshotSetCurrent(vm, snap); =20 if (qemuSnapshotCreateWriteMetadata(vm, snap, driver, cfg) < 0) --=20 2.41.0