From nobody Mon Sep 16 20:00:05 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=1678722176; cv=none; d=zohomail.com; s=zohoarc; b=e37U+mNed5D8RzpXv02iO672PE/OUg9cD48qh5VfAyuWxEbSQP4tHxV47TDVwdAz/0VfBbcZelwd7yaTzfdy3WO/BUWbhdTGFBvzoTWCe7YLcorE1hR99QhVtdgZ4ey165S2q2T+YBfN942f1YeKibnozYTzs1aK32MUgWKPVas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722176; 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=+eA+iDU12nN/LNNXUmt1YNT+LqgW3juv65ndD2HYQZ4=; b=HtuD/BBy/7Z8M3sh6C2O/D/7j8NGk9Sxl4gk9oDGGPrAY3RzWSOQuwWKeg27Pl8oQJKVu/XqlqYxvF0PjJ/Z5i6wzbbWGzVF9SnTRDW5814XB+jxdAM7DRmsCri8umJ4y9JjBkJJs19UEZjFsqBSFZ/TVx7CXXmDjwLrnfVprTU= 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 1678722176447300.93787848462296; Mon, 13 Mar 2023 08:42:56 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-214-clqrlypaOA-48nMYGdjx8w-1; Mon, 13 Mar 2023 11:42:43 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D7723C0F1B4; Mon, 13 Mar 2023 15:42:32 +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 751EC406AA66; Mon, 13 Mar 2023 15:42:32 +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 374FD1946A4B; Mon, 13 Mar 2023 15:42:32 +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 05F11194658F for ; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id EE21D2166B2A; Mon, 13 Mar 2023 15:42:29 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90C752166B29 for ; Mon, 13 Mar 2023 15:42:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722175; 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=+eA+iDU12nN/LNNXUmt1YNT+LqgW3juv65ndD2HYQZ4=; b=a+B/vTiyK8aNfwqElcFTOZLlXzJw7f8qtHQXesZqXoxqkZdYP1Btxfor00Rk22Ev6r929d u1Ji6GY7wD9hm61nnFyM/DwB3dd7S/KdRjkAzNsVmMS9eRfsyMa66W3ZzjDxVlsNBNAVA7 PbnRXsszz56yJS2tbMHgbdRGnFhCGwE= X-MC-Unique: clqrlypaOA-48nMYGdjx8w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 04/20] snapshot_conf: introduce metadata element Date: Mon, 13 Mar 2023 16:42:05 +0100 Message-Id: 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.1 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: 1678722176980100001 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 da1c694cb9..949104c1fd 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 @@ -843,6 +859,17 @@ virDomainSnapshotDefFormatInternal(virBuffer *buf, virBufferAddLit(buf, "\n"); } =20 + if (def->nrevertdisks) { + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + for (i =3D 0; i < def->nrevertdisks; i++) { + if (virDomainSnapshotDiskDefFormat(buf, &def->revertdisks[i], = xmlopt) < 0) + return -1; + } + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } + 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.39.2