From nobody Fri Dec 19 20:38:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1687878857; cv=none; d=zohomail.com; s=zohoarc; b=eNIW8H/TgjhiyHD5xIJDdChCfN34WisxpfpH27Fwhj8vU+zdddaZL9drFMV0CbhoQTpRZNaBEOUXLB+Y07sh06dTsc6+QGYYqzW2dheRuBM3soKJwRisaj6Cm7SkIaIcVAEApIK4A9I4iIckG3DhnMBzfGSpDOfdOE4s4KFleiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687878857; 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=pcAC6V4VLheJPPyfI3vyGCsvSaw991onFN5Lqi2jdCU=; b=dOLAcJ0AG6MelWKeNR3nmViCnCaa+b168CYrEI6R+IIN4BrObKhjZZOXzFR/lS6d/H3y3V1um6VfqF4BgY7LRlBXlLjD8UTRRPzQMqNwbY7/xQVIw4FPE3P0Xw/A/QW75RE2DHVxD+kx7OBbcSSF3SYy1tYeBKL6ZRhrzzcw0bo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1687878857605131.94799391502704; Tue, 27 Jun 2023 08:14:17 -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-261-xOyCcupqOeGiWmgzintqkA-1; Tue, 27 Jun 2023 11:13:54 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5195B1869B70; Tue, 27 Jun 2023 15:07:41 +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 3E4F448FB02; Tue, 27 Jun 2023 15:07:41 +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 8D36319451C4; Tue, 27 Jun 2023 15:07:35 +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 5D8101946586 for ; Tue, 27 Jun 2023 15:07:31 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3057C400E88; Tue, 27 Jun 2023 15:07:31 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.45.225.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8B3540140F for ; Tue, 27 Jun 2023 15:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687878856; 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=pcAC6V4VLheJPPyfI3vyGCsvSaw991onFN5Lqi2jdCU=; b=FUl/AH5+Vvz+1E0R3yOULAfZ3/u0X5WZAalXNJG0RY1KBooWhIyZ4+jvC21a1U1HWPz+Lx 2InAyOimVDuGf7ewzxJoHCMuTlk7wDXTtETeFf9/J+VjZod8FZS5UUFSLKbT2nuz2/miQX KxddQo2LH+wS4u/J/QmMAn67TaRF8nA= X-MC-Unique: xOyCcupqOeGiWmgzintqkA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v2 04/24] snapshot_conf: introduce metadata element Date: Tue, 27 Jun 2023 17:07:07 +0200 Message-ID: <89c0f82045e9b7d627becf9247694a7c8c258746.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.9 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: 1687878864458100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This new element will hold the new disk overlay created when reverting to non-leaf snapshot in order to remember the files libvirt created. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/schemas/domainsnapshot.rng | 7 +++++++ src/conf/snapshot_conf.c | 27 +++++++++++++++++++++++++++ src/conf/snapshot_conf.h | 5 +++++ 3 files changed, 39 insertions(+) diff --git a/src/conf/schemas/domainsnapshot.rng b/src/conf/schemas/domains= napshot.rng index 45f01b96cd..2549c47b22 100644 --- a/src/conf/schemas/domainsnapshot.rng +++ b/src/conf/schemas/domainsnapshot.rng @@ -60,6 +60,13 @@ + + + + + + + diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index ac5aba1753..f6725c0e7b 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -376,6 +376,22 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, return NULL; } =20 + if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE) { + g_autofree xmlNodePtr *revertDiskNodes =3D NULL; + + if ((n =3D virXPathNodeSet("./revertDisks/*", ctxt, &revertDiskNod= es)) < 0) + return NULL; + if (n) + def->revertdisks =3D g_new0(virDomainSnapshotDiskDef, n); + def->nrevertdisks =3D n; + for (i =3D 0; i < def->nrevertdisks; i++) { + if (virDomainSnapshotDiskDefParseXML(revertDiskNodes[i], ctxt, + &def->revertdisks[i], + flags, xmlopt) < 0) + return NULL; + } + } + if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL) { int active; =20 @@ -834,6 +850,17 @@ virDomainSnapshotDefFormatInternal(virBuffer *buf, virBufferAddLit(buf, "\n"); } =20 + if (def->nrevertdisks > 0) { + g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + + for (i =3D 0; i < def->nrevertdisks; i++) { + if (virDomainSnapshotDiskDefFormat(&childBuf, &def->revertdisk= s[i], xmlopt) < 0) + return -1; + } + + virXMLFormatElement(buf, "revertDisks", NULL, &childBuf); + } + if (def->parent.dom) { if (virDomainDefFormatInternal(def->parent.dom, xmlopt, buf, domainflags) < 0) diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index ad49990a1e..ab76af604a 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -80,6 +80,11 @@ struct _virDomainSnapshotDef { size_t ndisks; /* should not exceed dom->ndisks */ virDomainSnapshotDiskDef *disks; =20 + /* When we revert to non-leaf snapshot we need to + * store the new overlay disks. */ + size_t nrevertdisks; + virDomainSnapshotDiskDef *revertdisks; + virObject *cookie; }; =20 --=20 2.41.0