From nobody Mon Sep 16 19:57:55 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=1678722261; cv=none; d=zohomail.com; s=zohoarc; b=UvPVugQ6zjh4mYVH5y4Ntr7L4ntmj4ktEi2wEZZfI0Ztz91UQnKHIxG3Y5oz2j4eNyABJLBpDOsOu3id0kJMR7/ImEwZDx63ajSwIFVYATHVuR8fCzaC5OytH1X17xYVkMMmCj2RatJ5n3McMxsQHOB3xVH/py0NJSuojhVCbPM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722261; 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=+5RmfVNYfzfF+NyaGf8u5UCzVT51W7jGZnS0NsCtGsA=; b=H5nE3Ou3xl7pawjt9TpwxK5IBB3Li3F44Mgc4cWFy+Bzj8rykA5M3U/6vcFrF3ZDapYBZIyHHL64ktWeYKuKjU9E4rg1e5muBwzaju1o8QAI0pupX6k+Jy6vhaD2Rz5js6yfX5uV3TzqvYwQSe+7yV3PmNvm26bewjQbYHZuHIk= 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 167872226139237.378201100059755; Mon, 13 Mar 2023 08:44:21 -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-481-J2orfDp3P6KI-IaiLoLrPQ-1; Mon, 13 Mar 2023 11:42:58 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E87F18E0A8A; Mon, 13 Mar 2023 15:42:40 +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 87BA21410F1C; Mon, 13 Mar 2023 15:42:40 +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 2E0BF1946A6B; Mon, 13 Mar 2023 15:42:40 +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 D468A1946594 for ; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C59A72166B2A; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 679142166B29 for ; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722260; 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=+5RmfVNYfzfF+NyaGf8u5UCzVT51W7jGZnS0NsCtGsA=; b=AKD3XBx4drAaJx9wnWfTzMKVuYwi5JXrnFyC4sBz4wZa6uQGXZpETJcPipfY6WjNy1ZLSd 3H2YGVIReGLx3PJU7Qhqz6epoesZ54Nn+IeITc1IzjESLKqu7v4vBWGfHJF61/LH6S7+8A dH4RyPEMCGrb1YYl6n+fFvbGGp8w9ZQ= X-MC-Unique: J2orfDp3P6KI-IaiLoLrPQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 16/20] qemu_snapshot: don't allow creating external snapshot after reverting Date: Mon, 13 Mar 2023 16:42:17 +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.7 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: 1678722263444100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This would allow creating new branch in the external snapshot history which we currently don't support. The issue with branching the external snapshot history is that deleting some snapshot would require calling block-stream instead of block-commit which is currently not implemented. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 513bcb5a86..95297cfe6a 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -665,6 +665,8 @@ qemuSnapshotPrepare(virDomainObj *vm, bool found_internal =3D false; bool forbid_internal =3D false; int external =3D 0; + virDomainMomentObj *curSnap =3D NULL; + virDomainSnapshotDef *curDef =3D NULL; =20 for (i =3D 0; i < def->ndisks; i++) { virDomainSnapshotDiskDef *disk =3D &def->disks[i]; @@ -801,6 +803,16 @@ qemuSnapshotPrepare(virDomainObj *vm, return -1; } =20 + curSnap =3D virDomainSnapshotGetCurrent(vm->snapshots); + if (curSnap) + curDef =3D virDomainSnapshotObjGetDef(curSnap); + + if (curDef && curDef->revertdisks) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("creating external snapshot after reverting to no= t last snapshot is not supported")); + return -1; + } + /* Alter flags to let later users know what we learned. */ if (external && !active) *flags |=3D VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY; --=20 2.39.2