From nobody Thu Apr 16 23:25:57 2026 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=1692005831; cv=none; d=zohomail.com; s=zohoarc; b=hzyEhP0GZkoVoYK5UW0XcA2psycR1qfX/mvXr05kBIFM6g8g8Y2U7HPLcIsXWc+6Bnev7FX6iIXf58qjNJJOhUdfIWCx4qOJfeOZ1D0ect1LpPVNtC8aidQIhOSewnt55ZWJAS1CyDVtPRfzLyqj271aCJyq3uRh9e2vQPQu2Hs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692005831; 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=wlL9dE7BweqnjmebGMsynguM6GoOxQN6VZclk42eS0M=; b=kGCRe1mYedvlGuM/xe87NIz8ru9BpupTOTLWezhjq5UxzEWOPMDC1J2ob4LOvMJbGrp+eeYnJ0blbeklPjv9QyovnEwooZEPUR+Ac3TUB1efCIjdJlXy7jol+i5N0Zpzua0GOKceZJAI1XvIAGEh5MQhX4X1vRSVerIifSJJJUM= 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 1692005831400406.9201333207616; Mon, 14 Aug 2023 02:37:11 -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-349-O6qpmlngOfiIbnZYCwbAtg-1; Mon, 14 Aug 2023 05:36:59 -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 DFAF785571B; Mon, 14 Aug 2023 09:36:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA5E4C15BBA; Mon, 14 Aug 2023 09:36:56 +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 BA7CC19465B9; Mon, 14 Aug 2023 09:36:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 93C4A19465A0 for ; Mon, 14 Aug 2023 09:36:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BB96340C2079; Mon, 14 Aug 2023 09:36:24 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.45.226.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E81140C2073 for ; Mon, 14 Aug 2023 09:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692005830; 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=wlL9dE7BweqnjmebGMsynguM6GoOxQN6VZclk42eS0M=; b=YIYbrMQViroOA4H9M4uskMGoXqYG08h6XaFfjvazgF6g0vZ+BPCz4Vd8b/JMhJkNYq1mFp bjgEDuGPamtxgTuK5DeZ0HY9KVaACLb7VCViNZClCvkggtKhi1VRxgnqdBkOlTYSFlnBTt 70BtKRBzp0Zgra/FwuBTW2SbT9eSY8M= X-MC-Unique: O6qpmlngOfiIbnZYCwbAtg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v3 10/25] qemu_snapshot: move external disk prepare to single function Date: Mon, 14 Aug 2023 11:36:02 +0200 Message-ID: <501a3b8e4a561e668d2e4eef26b9a0115ef80f9d.1692005543.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1692005833106100001 Content-Type: text/plain; charset="utf-8"; x-default="true" We will need to reuse the functionality when reverting external snapshots. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 50f871baf3..a090ca13d4 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -527,6 +527,25 @@ qemuSnapshotPrepareDiskExternal(virDomainDiskDef *disk, bool active, bool reuse) { + if (!snapdisk->src->format) { + snapdisk->src->format =3D VIR_STORAGE_FILE_QCOW2; + } else if (snapdisk->src->format !=3D VIR_STORAGE_FILE_QCOW2 && + snapdisk->src->format !=3D VIR_STORAGE_FILE_QED) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("external snapshot format for disk %1$s is unsupp= orted: %2$s"), + snapdisk->name, + virStorageFileFormatTypeToString(snapdisk->src->for= mat)); + return -1; + } + + if (snapdisk->src->metadataCacheMaxSize > 0) { + if (snapdisk->src->format !=3D VIR_STORAGE_FILE_QCOW2) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("metadata cache max size control is supported= only with qcow2 images")); + return -1; + } + } + if (qemuTranslateSnapshotDiskSourcePool(snapdisk) < 0) return -1; =20 @@ -707,25 +726,6 @@ qemuSnapshotPrepare(virDomainObj *vm, break; =20 case VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL: - if (!disk->src->format) { - disk->src->format =3D VIR_STORAGE_FILE_QCOW2; - } else if (disk->src->format !=3D VIR_STORAGE_FILE_QCOW2 && - disk->src->format !=3D VIR_STORAGE_FILE_QED) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("external snapshot format for disk %1$s i= s unsupported: %2$s"), - disk->name, - virStorageFileFormatTypeToString(disk->src-= >format)); - return -1; - } - - if (disk->src->metadataCacheMaxSize > 0) { - if (disk->src->format !=3D VIR_STORAGE_FILE_QCOW2) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("metadata cache max size control is s= upported only with qcow2 images")); - return -1; - } - } - if (qemuSnapshotPrepareDiskExternal(dom_disk, disk, active, re= use) < 0) return -1; =20 --=20 2.41.0